From b5a8d0319b8fe14bb9f970fdca1decf6dbc9e603 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 14 Jun 2017 17:35:28 -0700 Subject: [PATCH] meta: Remove support for clearing integer buffers Since i965 no longer uses this function for clearing color buffers, there is no driver left that will ever support integer textures and use _mesa_meta_glsl_Clear. As a side note, the has_integer_textures check was rubbish anyway because meta always smashes the API to API_OPENGL_COMPAT. text data bss dec hex filename 12244406 1344936 1290748 14880090 e30d5a before/lib64/dri/i965_dri.so 12243574 1344936 1290748 14879258 e30a1a after/lib64/dri/i965_dri.so Reviewed-by: Jason Ekstrand Part-of: --- src/mesa/drivers/common/meta.c | 55 ++-------------------------------- src/mesa/drivers/common/meta.h | 1 - 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 59049b951d2..5efe30dead2 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1542,7 +1542,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) "{\n" " gl_FragColor = color;\n" "}\n"; - bool has_integer_textures; _mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->buf_obj, true, 3, 0, 0); @@ -1552,49 +1551,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, "meta clear", &clear->ShaderProg); - - has_integer_textures = _mesa_is_gles3(ctx) || - (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130); - - if (has_integer_textures) { - void *shader_source_mem_ctx = ralloc_context(NULL); - const char *vs_int_source = - ralloc_asprintf(shader_source_mem_ctx, - "#version 130\n" - "#extension GL_AMD_vertex_shader_layer : enable\n" - "#extension GL_ARB_draw_instanced : enable\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" - " gl_Layer = gl_InstanceID;\n" - "#endif\n" - " gl_Position = position;\n" - "}\n"); - const char *fs_int_source = - ralloc_asprintf(shader_source_mem_ctx, - "#version 130\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" - "{\n" - " out_color = color;\n" - "}\n"); - - _mesa_meta_compile_and_link_program(ctx, vs_int_source, fs_int_source, - "integer clear", - &clear->IntegerShaderProg); - ralloc_free(shader_source_mem_ctx); - - /* Note that user-defined out attributes get automatically assigned - * locations starting from 0, so we don't need to explicitly - * BindFragDataLocation to 0. - */ - } } static void @@ -1606,10 +1562,6 @@ meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear) clear->VAO = 0; _mesa_reference_buffer_object(ctx, &clear->buf_obj, NULL); _mesa_reference_shader_program(ctx, &clear->ShaderProg, NULL); - - if (clear->IntegerShaderProg) { - _mesa_reference_shader_program(ctx, &clear->IntegerShaderProg, NULL); - } } static void @@ -1771,6 +1723,7 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl) _mesa_meta_begin(ctx, metaSave); + assert(!fb->_IntegerBuffers); if (glsl) { meta_glsl_clear_init(ctx, clear); @@ -1790,11 +1743,7 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl) z = invert_z(ctx->Depth.Clear); } - if (fb->_IntegerBuffers) { - assert(glsl); - _mesa_meta_use_program(ctx, clear->IntegerShaderProg); - _mesa_Uniform4iv(0, 1, ctx->Color.ClearColor.i); - } else if (glsl) { + if (glsl) { _mesa_meta_use_program(ctx, clear->ShaderProg); _mesa_Uniform4fv(0, 1, ctx->Color.ClearColor.f); } diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 7894cec7241..511ffb45a78 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -318,7 +318,6 @@ struct clear_state GLuint VAO; struct gl_buffer_object *buf_obj; struct gl_shader_program *ShaderProg; - struct gl_shader_program *IntegerShaderProg; }; -- 2.30.2