[Mesa-dev] [PATCH 24/35] meta: Add rectangle textures to the shader-per-sampler-type table

Ian Romanick idr at freedesktop.org
Wed Jan 29 13:53:15 PST 2014


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

Rectangle textures were not necessary for mipmap generation (because
they cannot have mipmaps), but all of the future users of this common
code will need to support rectangle textures.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index acc81c1..e7154df 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -233,6 +233,7 @@ struct sampler_table {
    struct glsl_sampler sampler_1d;
    struct glsl_sampler sampler_2d;
    struct glsl_sampler sampler_3d;
+   struct glsl_sampler sampler_rect;
    struct glsl_sampler sampler_cubemap;
    struct glsl_sampler sampler_1d_array;
    struct glsl_sampler sampler_2d_array;
@@ -3438,6 +3439,11 @@ setup_texture_sampler(GLenum target, struct sampler_table *table)
       table->sampler_2d.func = "texture2D";
       table->sampler_2d.texcoords = "texCoords.xy";
       return &table->sampler_2d;
+   case GL_TEXTURE_RECTANGLE:
+      table->sampler_rect.type = "sampler2DRect";
+      table->sampler_rect.func = "texture2DRect";
+      table->sampler_rect.texcoords = "texCoords.xy";
+      return &table->sampler_rect;
    case GL_TEXTURE_3D:
       /* Code for mipmap generation with 3D textures is not used yet.
        * It's a sw fallback.
@@ -3474,6 +3480,7 @@ sampler_table_cleanup(struct sampler_table *table)
    _mesa_DeleteObjectARB(table->sampler_1d.shader_prog);
    _mesa_DeleteObjectARB(table->sampler_2d.shader_prog);
    _mesa_DeleteObjectARB(table->sampler_3d.shader_prog);
+   _mesa_DeleteObjectARB(table->sampler_rect.shader_prog);
    _mesa_DeleteObjectARB(table->sampler_cubemap.shader_prog);
    _mesa_DeleteObjectARB(table->sampler_1d_array.shader_prog);
    _mesa_DeleteObjectARB(table->sampler_2d_array.shader_prog);
@@ -3481,6 +3488,7 @@ sampler_table_cleanup(struct sampler_table *table)
    table->sampler_1d.shader_prog = 0;
    table->sampler_2d.shader_prog = 0;
    table->sampler_3d.shader_prog = 0;
+   table->sampler_rect.shader_prog = 0;
    table->sampler_cubemap.shader_prog = 0;
    table->sampler_1d_array.shader_prog = 0;
    table->sampler_2d_array.shader_prog = 0;
-- 
1.8.1.4



More information about the mesa-dev mailing list