[Mesa-dev] [PATCH 22/22] meta/blit: Use GL_EXT_shader_samples_identical in MSAA-SS resolve blit
Ian Romanick
idr at freedesktop.org
Thu Feb 18 01:58:15 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Somewhat surprisingly, this didn't have any affect on performance in the
benchmarks that Martin tried for me.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/common/meta_blit.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 28aabd3..c0ec51f 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -530,6 +530,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
fs_source = ralloc_asprintf(mem_ctx,
"#version 130\n"
"#extension GL_ARB_texture_multisample: require\n"
+ "#extension GL_EXT_shader_samples_identical: enable\n"
"#define gvec4 %svec4\n"
"uniform %ssampler2DMS%s texSampler;\n"
"in %s texCoords;\n"
@@ -569,7 +570,14 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
" i%s tc = i%s(texCoords);\n"
" int i;\n"
"\n"
- " for (i = 0; i < SAMPLES; i++)\n"
+ " S[0] = texelFetch(texSampler, tc, 0);\n"
+ "#if defined(GL_EXT_shader_samples_identical) && SAMPLES > 1\n"
+ " if (textureSamplesIdenticalEXT(texSampler, tc)) {\n"
+ " emit2(S[0]);\n"
+ " return;\n"
+ " }\n"
+ "#endif\n"
+ " for (i = 1; i < SAMPLES; i++)\n"
" S[i] = texelFetch(texSampler, tc, i);\n"
"\n"
" REDUCE(s16, s32);\n"
--
2.5.0
More information about the mesa-dev
mailing list