<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 29, 2014 at 2:53 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
<br>
This will allow the same table of shader-per-sampler-type to be used for<br>
paths in meta other than just mipmap generation. This is also the<br>
reason the declarations of the structures was moved towards the top of<br>
the file.<br>
<br>
Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
---<br>
src/mesa/drivers/common/meta.c | 128 +++++++++++++++++++++++------------------<br>
1 file changed, 72 insertions(+), 56 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c<br>
index a987fd7..0241c34 100644<br>
--- a/src/mesa/drivers/common/meta.c<br>
+++ b/src/mesa/drivers/common/meta.c<br>
@@ -215,6 +215,28 @@ struct temp_texture<br>
GLfloat Sright, Ttop; /**< right, top texcoords */<br>
};<br>
<br>
+/**<br>
+ * State for GLSL texture sampler which is used to generate fragment<br>
+ * shader in _mesa_meta_generate_mipmap().<br>
+ */<br>
+struct glsl_sampler {<br>
+ const char *type;<br>
+ const char *func;<br>
+ const char *texcoords;<br>
+ GLuint shader_prog;<br>
+};<br>
+<br>
+/**<br>
+ * Table of all sampler types and shaders for accessing them.<br>
+ */<br>
+struct sampler_table {<br>
+ struct glsl_sampler sampler_1d;<br>
+ struct glsl_sampler sampler_2d;<br>
+ struct glsl_sampler sampler_3d;<br>
+ struct glsl_sampler sampler_cubemap;<br>
+ struct glsl_sampler sampler_1d_array;<br>
+ struct glsl_sampler sampler_2d_array;<br>
+};<br>
<br>
/**<br>
* State for glBlitFramebufer()<br>
@@ -281,17 +303,6 @@ struct bitmap_state<br>
};<br>
<br>
/**<br>
- * State for GLSL texture sampler which is used to generate fragment<br>
- * shader in _mesa_meta_generate_mipmap().<br>
- */<br>
-struct glsl_sampler {<br>
- const char *type;<br>
- const char *func;<br>
- const char *texcoords;<br>
- GLuint shader_prog;<br>
-};<br>
-<br>
-/**<br>
* State for _mesa_meta_generate_mipmap()<br>
*/<br>
struct gen_mipmap_state<br>
@@ -301,12 +312,8 @@ struct gen_mipmap_state<br>
GLuint FBO;<br>
GLuint Sampler;<br>
GLuint ShaderProg;<br>
- struct glsl_sampler sampler_1d;<br>
- struct glsl_sampler sampler_2d;<br>
- struct glsl_sampler sampler_3d;<br>
- struct glsl_sampler sampler_cubemap;<br>
- struct glsl_sampler sampler_1d_array;<br>
- struct glsl_sampler sampler_2d_array;<br>
+<br>
+ struct sampler_table samplers;<br>
};<br>
<br>
/**<br>
@@ -356,12 +363,16 @@ struct vertex {<br>
GLfloat r, g, b, a;<br>
};<br>
<br>
+static struct glsl_sampler * setup_texture_sampler(GLenum target,<br>
+ struct sampler_table *table);<br>
</blockquote><div><br></div><div>Minor nit, but I'd format that function prototype as we do elsewhere (return type on its own line).<br> <br><br></div><div>-Brian<br><br></div></div></div></div>