summaryrefslogtreecommitdiff
path: root/src/compiler/nir/nir_lower_drawpixels.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_lower_drawpixels.c')
-rw-r--r--src/compiler/nir/nir_lower_drawpixels.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/compiler/nir/nir_lower_drawpixels.c b/src/compiler/nir/nir_lower_drawpixels.c
index 59120ee92cc..ac5490cc9c3 100644
--- a/src/compiler/nir/nir_lower_drawpixels.c
+++ b/src/compiler/nir/nir_lower_drawpixels.c
@@ -41,26 +41,8 @@ static nir_ssa_def *
get_texcoord(nir_builder *b, lower_drawpixels_state *state)
{
if (state->texcoord == NULL) {
- nir_variable *texcoord = NULL;
-
- /* find gl_TexCoord, if it exists: */
- nir_foreach_shader_in_variable(var, state->shader) {
- if (var->data.location == VARYING_SLOT_TEX0) {
- texcoord = var;
- break;
- }
- }
-
- /* otherwise create it: */
- if (texcoord == NULL) {
- texcoord = nir_variable_create(state->shader,
- nir_var_shader_in,
- glsl_vec4_type(),
- "gl_TexCoord");
- texcoord->data.location = VARYING_SLOT_TEX0;
- }
-
- state->texcoord = texcoord;
+ state->texcoord = nir_get_variable_with_location(state->shader, nir_var_shader_in,
+ VARYING_SLOT_TEX0, glsl_vec4_type());
}
return nir_load_var(b, state->texcoord);
}