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 <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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);
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));