meta: Remove support for clearing integer buffers
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 15 Jun 2017 00:35:28 +0000 (17:35 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 14 May 2020 15:35:43 +0000 (15:35 +0000)
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 <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/856>

src/mesa/drivers/common/meta.c
src/mesa/drivers/common/meta.h

index 59049b951d2e808823f7f816fa2b3e9d5c660b73..5efe30dead2fbc59a22ef305265a98d1264fb65a 100644 (file)
@@ -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);
    }
index 7894cec72413bd6cbf0c5c3ce1c8e4d6d099e9f6..511ffb45a783d7d6ec028423b9be2ff6b7f97c57 100644 (file)
@@ -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;
 };