[Mesa-dev] [PATCH 19/22] meta/blit: Don't dynamically select the MSAA "merge" function
Ian Romanick
idr at freedesktop.org
Thu Feb 18 01:58:12 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Just include all 3 versions in the shader. The GLSL type system will
pick the correct one. This simplifies the code a bit, and it helps pave
the way for additional simplifications.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/common/meta_blit.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 551ed29..72428f9 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -519,19 +519,9 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
} else {
char *sample_resolve;
- const char *merge_function;
int i;
int step;
- if (src_datatype == GL_INT || src_datatype == GL_UNSIGNED_INT) {
- merge_function =
- "gvec4 merge(gvec4 a, gvec4 b) { return (a >> 1) + (b >> 1) + (a & b & gvec4(1)); }\n";
- } else {
- /* The divide will happen at the end for floats. */
- merge_function =
- "vec4 merge(vec4 a, vec4 b) { return (a + b); }\n";
- }
-
/* We're assuming power of two samples for this resolution procedure.
*
* To avoid losing any floating point precision if the samples all
@@ -581,7 +571,11 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
"in %s texCoords;\n"
"out gvec4 out_color[%u];\n"
"\n"
- "%s" /* merge_function */
+ "uvec4 merge(uvec4 a, uvec4 b) { return (a >> 1) + (b >> 1) + (a & b & 1u); }\n"
+ "ivec4 merge(ivec4 a, ivec4 b) { return (a >> 1) + (b >> 1) + (a & b & 1); }\n"
+ /* The divide will happen at the end for floats. */
+ "vec4 merge(vec4 a, vec4 b) { return a + b; }\n"
+ "\n"
"void main()\n"
"{\n"
"%s\n" /* sample_resolve */
@@ -591,7 +585,6 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
sampler_array_suffix,
texcoord_type,
drawFb->_NumColorDrawBuffers,
- merge_function,
sample_resolve);
}
--
2.5.0
More information about the mesa-dev
mailing list