summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-01-31 04:31:16 -0800
committerKenneth Graunke <[email protected]>2015-02-19 15:15:45 -0800
commit231267bf011e1fa6edb52ffad27fcbca8e0e28e1 (patch)
treeb2e361019d61eca2245d3b1232f4396f63ade615 /src/mesa/drivers/dri/i965
parenta07cd42f1e4739000adbbcf5613ba163cf73b666 (diff)
i965/fs: Use VARYING_SLOT checks rather than strcmp().
Comparing the location field is equivalent and more efficient. We'll also need this when we start using NIR for ARB programs, as our NIR converter will set the location field correctly, but probably won't use the GLSL names for these concepts. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 850f132d757..21238296d50 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -195,7 +195,7 @@ fs_visitor::nir_setup_inputs(nir_shader *shader)
fs_reg varying = offset(nir_inputs, var->data.driver_location);
fs_reg reg;
- if (!strcmp(var->name, "gl_FragCoord")) {
+ if (var->data.location == VARYING_SLOT_POS) {
reg = *emit_fragcoord_interpolation(var->data.pixel_center_integer,
var->data.origin_upper_left);
emit_percomp(MOV(varying, reg), 0xF);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index a2343c6b86f..04e0f9a4782 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -92,10 +92,10 @@ fs_visitor::visit(ir_variable *ir)
reg = new(this->mem_ctx)
fs_reg(ATTR, ir->data.location,
brw_type_for_base_type(ir->type->get_scalar_type()));
- } else if (!strcmp(ir->name, "gl_FragCoord")) {
+ } else if (ir->data.location == VARYING_SLOT_POS) {
reg = emit_fragcoord_interpolation(ir->data.pixel_center_integer,
ir->data.origin_upper_left);
- } else if (!strcmp(ir->name, "gl_FrontFacing")) {
+ } else if (ir->data.location == VARYING_SLOT_FACE) {
reg = emit_frontfacing_interpolation();
} else {
reg = new(this->mem_ctx) fs_reg(vgrf(ir->type));