[Mesa-dev] [PATCH 09/10] meta: Add support for MSAA resolves from 2D_MS_ARRAY textures.
Kenneth Graunke
kenneth at whitecape.org
Sun Mar 9 23:58:07 PDT 2014
On 03/04/2014 02:17 PM, Eric Anholt wrote:
> ---
> src/mesa/drivers/common/meta.h | 8 ++++++++
> src/mesa/drivers/common/meta_blit.c | 23 +++++++++++++++++++----
> 2 files changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
> index 00553e2..5d60690 100644
> --- a/src/mesa/drivers/common/meta.h
> +++ b/src/mesa/drivers/common/meta.h
> @@ -238,6 +238,14 @@ enum blit_msaa_shader {
> BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
> BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
> BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_INT,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_UINT,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE,
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY,
> BLIT_MSAA_SHADER_COUNT,
> };
>
> diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
> index 9756d86..550133f 100644
> --- a/src/mesa/drivers/common/meta_blit.c
> +++ b/src/mesa/drivers/common/meta_blit.c
> @@ -97,6 +97,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> bool dst_is_msaa = false;
> GLenum src_datatype;
> const char *vec4_prefix;
> + const char *sampler_array_suffix = "";
> char *name;
>
> if (src_rb) {
> @@ -125,6 +126,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
>
> switch (target) {
> case GL_TEXTURE_2D_MULTISAMPLE:
> + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> if (src_rb->_BaseFormat == GL_DEPTH_COMPONENT ||
> src_rb->_BaseFormat == GL_DEPTH_STENCIL) {
> if (dst_is_msaa)
> @@ -137,6 +139,12 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> else
> shader_index = BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE;
> }
> +
> + if (target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
> + shader_index += (BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE -
> + BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE);
> + sampler_array_suffix = "Array";
> + }
> break;
> default:
> _mesa_problem(ctx, "Unkown texture target %s\n",
> @@ -167,6 +175,8 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> mem_ctx = ralloc_context(NULL);
>
> if (shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE ||
> + shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE ||
> + shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY ||
> shader_index == BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY) {
> char *sample_index;
> const char *arb_sample_shading_extension_string;
> @@ -208,7 +218,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> "#version 130\n"
> "#extension GL_ARB_texture_multisample : enable\n"
> "%s\n"
> - "uniform sampler2DMS texSampler;\n"
> + "uniform sampler2DMS%s texSampler;\n"
> "in vec2 texCoords;\n"
> "out vec4 out_color;\n"
> "\n"
> @@ -217,6 +227,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> " gl_FragDepth = texelFetch(texSampler, ivec2(texCoords), %s).r;\n"
> "}\n",
> arb_sample_shading_extension_string,
> + sampler_array_suffix,
> sample_index);
> } else {
> /* You can create 2D_MULTISAMPLE textures with 0 sample count (meaning 1
> @@ -306,7 +317,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> "#extension GL_ARB_texture_multisample : enable\n"
> "%s\n"
> "#define gvec4 %svec4\n"
> - "uniform %ssampler2DMS texSampler;\n"
> + "uniform %ssampler2DMS%s texSampler;\n"
> "in vec2 texCoords;\n"
> "out gvec4 out_color;\n"
> "\n"
> @@ -318,6 +329,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
> arb_sample_shading_extension_string,
> vec4_prefix,
> vec4_prefix,
> + sampler_array_suffix,
> merge_function,
> sample_resolve);
> }
> @@ -350,7 +362,8 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
>
> _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
>
> - if (target == GL_TEXTURE_2D_MULTISAMPLE) {
> + if (target == GL_TEXTURE_2D_MULTISAMPLE ||
> + target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
> setup_glsl_msaa_blit_shader(ctx, blit, src_rb, target);
> } else {
> _mesa_meta_setup_blit_shader(ctx, target, &blit->shaders);
> @@ -410,6 +423,7 @@ blitframebuffer_texture(struct gl_context *ctx,
> case GL_TEXTURE_2D:
> case GL_TEXTURE_RECTANGLE:
> case GL_TEXTURE_2D_MULTISAMPLE:
> + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> break;
> default:
> return false;
> @@ -533,7 +547,8 @@ blitframebuffer_texture(struct gl_context *ctx,
> }
> else {
> assert(target == GL_TEXTURE_RECTANGLE_ARB ||
> - target == GL_TEXTURE_2D_MULTISAMPLE);
> + target == GL_TEXTURE_2D_MULTISAMPLE ||
> + target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
> s0 = (float) srcX0;
> s1 = (float) srcX1;
> t0 = (float) srcY0;
>
This can't possibly work. Your texture coordinates are still an ivec2,
and are missing the array index.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140309/387134ff/attachment-0001.pgp>
More information about the mesa-dev
mailing list