summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/common/meta.c27
-rw-r--r--src/mesa/drivers/common/meta.h5
2 files changed, 12 insertions, 20 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 5610e9ff80f..36bed77b481 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1544,7 +1544,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
const char *vs_source =
"#extension GL_AMD_vertex_shader_layer : enable\n"
"#extension GL_ARB_draw_instanced : enable\n"
- "attribute vec4 position;\n"
+ "#extension GL_ARB_explicit_attrib_location :enable\n"
+ "layout(location = 0) in vec4 position;\n"
"void main()\n"
"{\n"
"#ifdef GL_AMD_vertex_shader_layer\n"
@@ -1553,7 +1554,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
" gl_Position = position;\n"
"}\n";
const char *fs_source =
- "uniform vec4 color;\n"
+ "#extension GL_ARB_explicit_attrib_location :enable\n"
+ "#extension GL_ARB_explicit_uniform_location :enable\n"
+ "layout(location = 0) uniform vec4 color;\n"
"void main()\n"
"{\n"
" gl_FragColor = color;\n"
@@ -1580,12 +1583,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
_mesa_DeleteShader(fs);
_mesa_AttachShader(clear->ShaderProg, vs);
_mesa_DeleteShader(vs);
- _mesa_BindAttribLocation(clear->ShaderProg, 0, "position");
_mesa_ObjectLabel(GL_PROGRAM, clear->ShaderProg, -1, "meta clear");
_mesa_LinkProgram(clear->ShaderProg);
- clear->ColorLocation = _mesa_GetUniformLocation(clear->ShaderProg, "color");
-
has_integer_textures = _mesa_is_gles3(ctx) ||
(_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130);
@@ -1596,7 +1596,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
"#version 130\n"
"#extension GL_AMD_vertex_shader_layer : enable\n"
"#extension GL_ARB_draw_instanced : enable\n"
- "in vec4 position;\n"
+ "#extension GL_ARB_explicit_attrib_location :enable\n"
+ "layout(location = 0) in vec4 position;\n"
"void main()\n"
"{\n"
"#ifdef GL_AMD_vertex_shader_layer\n"
@@ -1607,7 +1608,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
const char *fs_int_source =
ralloc_asprintf(shader_source_mem_ctx,
"#version 130\n"
- "uniform ivec4 color;\n"
+ "#extension GL_ARB_explicit_attrib_location :enable\n"
+ "#extension GL_ARB_explicit_uniform_location :enable\n"
+ "layout(location = 0) uniform ivec4 color;\n"
"out ivec4 out_color;\n"
"\n"
"void main()\n"
@@ -1626,7 +1629,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
_mesa_DeleteShader(fs);
_mesa_AttachShader(clear->IntegerShaderProg, vs);
_mesa_DeleteShader(vs);
- _mesa_BindAttribLocation(clear->IntegerShaderProg, 0, "position");
/* Note that user-defined out attributes get automatically assigned
* locations starting from 0, so we don't need to explicitly
@@ -1636,9 +1638,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
_mesa_ObjectLabel(GL_PROGRAM, clear->IntegerShaderProg, -1,
"integer clear");
_mesa_meta_link_program_with_debug(ctx, clear->IntegerShaderProg);
-
- clear->IntegerColorLocation =
- _mesa_GetUniformLocation(clear->IntegerShaderProg, "color");
}
}
@@ -1770,12 +1769,10 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
if (fb->_IntegerColor) {
assert(glsl);
_mesa_UseProgram(clear->IntegerShaderProg);
- _mesa_Uniform4iv(clear->IntegerColorLocation, 1,
- ctx->Color.ClearColor.i);
+ _mesa_Uniform4iv(0, 1, ctx->Color.ClearColor.i);
} else if (glsl) {
_mesa_UseProgram(clear->ShaderProg);
- _mesa_Uniform4fv(clear->ColorLocation, 1,
- ctx->Color.ClearColor.f);
+ _mesa_Uniform4fv(0, 1, ctx->Color.ClearColor.f);
}
/* GL_COLOR_BUFFER_BIT */
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 21495eecd27..5b04755a63e 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -322,12 +322,7 @@ struct clear_state
GLuint VAO;
struct gl_buffer_object *buf_obj;
GLuint ShaderProg;
- GLint ColorLocation;
- GLint LayerLocation;
-
GLuint IntegerShaderProg;
- GLint IntegerColorLocation;
- GLint IntegerLayerLocation;
};