[Mesa-dev] [PATCH 02/13] meta: Remove support for clearing integer buffers

Ian Romanick idr at freedesktop.org
Mon Jun 19 02:07:41 UTC 2017


From: Ian Romanick <ian.d.romanick at intel.com>

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
7155858	 256860	  37332	7450050	 71adc2	32-bit i965_dri.so before
7155026	 256860	  37332	7449218	 71aa82	32-bit i965_dri.so after
6789299	 328056	  50704	7168059	 6d603b	64-bit i965_dri.so before
6788499	 328056	  50704	7167259	 6d5d1b	64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 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 39499c7..9c1a4f2 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1497,7 +1497,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);
@@ -1507,49 +1506,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
@@ -1561,10 +1517,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);
-   }
 }
 
 /**
@@ -1725,6 +1677,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);
 
@@ -1744,11 +1697,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 1b5cf42..c09cb3e 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -325,7 +325,6 @@ struct clear_state
    GLuint VAO;
    struct gl_buffer_object *buf_obj;
    struct gl_shader_program *ShaderProg;
-   struct gl_shader_program *IntegerShaderProg;
 };
 
 
-- 
2.9.4



More information about the mesa-dev mailing list