[Mesa-dev] [PATCH 2/3] mesa/st: add support for ARB_sample_shading
Marek Olšák
maraeo at gmail.com
Tue Apr 1 07:14:22 PDT 2014
1) Adding functions to cso_context only makes sense for features which
need to be disabled or changed for meta ops (e.g. clear_with_quad,
glBitmap, glDrawPixels). I don't see you using
cso_save_sample_shading, which clearly shows it's useless. Does sample
shading need to be set differently for meta ops?
2) The changes of mesa/main should be in a separate patch.
3) We shouldn't call get_param in update_sample_shading. Either just
check if pipe->set_sample_shading is not NULL, or store the result of
get_param in st_context and use that instead.
Marek
On Mon, Mar 31, 2014 at 2:52 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> ---
> src/gallium/auxiliary/cso_cache/cso_context.c | 19 ++++++++++++
> src/gallium/auxiliary/cso_cache/cso_context.h | 4 +++
> src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
> src/gallium/drivers/i915/i915_screen.c | 1 +
> src/gallium/drivers/ilo/ilo_screen.c | 1 +
> src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +
> src/gallium/drivers/r300/r300_screen.c | 1 +
> src/gallium/drivers/r600/r600_pipe.c | 1 +
> src/gallium/drivers/radeonsi/si_pipe.c | 1 +
> src/gallium/drivers/softpipe/sp_screen.c | 1 +
> src/gallium/drivers/svga/svga_screen.c | 1 +
> src/mesa/program/program.c | 39 +++++++++++++++---------
> src/mesa/program/program.h | 4 +++
> src/mesa/state_tracker/st_atom.c | 1 +
> src/mesa/state_tracker/st_atom.h | 1 +
> src/mesa/state_tracker/st_atom_msaa.c | 24 +++++++++++++++
> src/mesa/state_tracker/st_extensions.c | 3 +-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 16 ++++++++--
> src/mesa/state_tracker/st_program.c | 21 ++++++++-----
> 22 files changed, 119 insertions(+), 25 deletions(-)
>
> diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
> index 9146684..3e9c257 100644
> --- a/src/gallium/auxiliary/cso_cache/cso_context.c
> +++ b/src/gallium/auxiliary/cso_cache/cso_context.c
> @@ -120,6 +120,7 @@ struct cso_context {
> struct pipe_viewport_state vp, vp_saved;
> struct pipe_blend_color blend_color;
> unsigned sample_mask, sample_mask_saved;
> + float sample_shading, sample_shading_saved;
> struct pipe_stencil_ref stencil_ref, stencil_ref_saved;
> };
>
> @@ -716,6 +717,24 @@ void cso_restore_sample_mask(struct cso_context *ctx)
> cso_set_sample_mask(ctx, ctx->sample_mask_saved);
> }
>
> +void cso_set_sample_shading(struct cso_context *ctx, float sample_shading)
> +{
> + if (ctx->sample_shading != sample_shading) {
> + ctx->sample_shading = sample_shading;
> + ctx->pipe->set_sample_shading(ctx->pipe, sample_shading);
> + }
> +}
> +
> +void cso_save_sample_shading(struct cso_context *ctx)
> +{
> + ctx->sample_shading_saved = ctx->sample_shading;
> +}
> +
> +void cso_restore_sample_shading(struct cso_context *ctx)
> +{
> + cso_set_sample_shading(ctx, ctx->sample_shading_saved);
> +}
> +
> void cso_set_stencil_ref(struct cso_context *ctx,
> const struct pipe_stencil_ref *sr)
> {
> diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
> index 1aa9998..4cae22d 100644
> --- a/src/gallium/auxiliary/cso_cache/cso_context.h
> +++ b/src/gallium/auxiliary/cso_cache/cso_context.h
> @@ -164,6 +164,10 @@ void cso_set_sample_mask(struct cso_context *cso, unsigned stencil_mask);
> void cso_save_sample_mask(struct cso_context *ctx);
> void cso_restore_sample_mask(struct cso_context *ctx);
>
> +void cso_set_sample_shading(struct cso_context *cso, float sample_shading);
> +void cso_save_sample_shading(struct cso_context *ctx);
> +void cso_restore_sample_shading(struct cso_context *ctx);
> +
> void cso_set_stencil_ref(struct cso_context *cso,
> const struct pipe_stencil_ref *sr);
> void cso_save_stencil_ref(struct cso_context *cso);
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 228ed18..79a5d89 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -206,6 +206,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> /* Stream output. */
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 88b190b..813e91e 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -218,6 +218,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
> case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index 4a04662..5c3b084 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -436,6 +436,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> default:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index fe06e34..0bb9ed7 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -238,6 +238,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 5378913..bc46345 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -131,6 +131,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
> case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index e8c7fe3..26f4162 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -195,6 +195,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_TGSI_VS_LAYER:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> case PIPE_CAP_MAX_VIEWPORTS:
> return NV50_MAX_VIEWPORTS;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 04f3088..114b0a1 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -177,6 +177,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> case PIPE_CAP_MAX_VIEWPORTS:
> return 1;
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 0977d39..4b73833 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -169,6 +169,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_TGSI_VS_LAYER:
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 982e18d..b912d7e 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -374,6 +374,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_USER_VERTEX_BUFFERS:
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> /* Stream output. */
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 401bf6a..f5cbff6 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -290,6 +290,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_TGSI_TEXCOORD:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
>
> case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 71f4c4f..a4a172c 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -188,6 +188,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 0d50e61..4fb2502 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -269,6 +269,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
> case PIPE_CAP_TEXTURE_GATHER_SM5:
> case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> + case PIPE_CAP_SAMPLE_SHADING:
> return 0;
> case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> return 64;
> diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
> index b7332fc..7971a11 100644
> --- a/src/mesa/program/program.c
> +++ b/src/mesa/program/program.c
> @@ -1038,14 +1038,10 @@ _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
> }
> }
>
> -/* Gets the minimum number of shader invocations per fragment.
> - * This function is useful to determine if we need to do per
> - * sample shading or per fragment shading.
> - */
> -GLint
> -_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
> - const struct gl_fragment_program *prog,
> - bool ignore_sample_qualifier)
> +float
> +_mesa_get_min_sample_shading(struct gl_context *ctx,
> + const struct gl_fragment_program *prog,
> + bool ignore_sample_qualifier)
> {
> /* From ARB_sample_shading specification:
> * "Using gl_SampleID in a fragment shader causes the entire shader
> @@ -1064,16 +1060,31 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
> * forces per-sample shading"
> */
> if (prog->IsSample && !ignore_sample_qualifier)
> - return MAX2(ctx->DrawBuffer->Visual.samples, 1);
> + return 1.0;
>
> if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
> SYSTEM_BIT_SAMPLE_POS))
> - return MAX2(ctx->DrawBuffer->Visual.samples, 1);
> + return 1.0;
> else if (ctx->Multisample.SampleShading)
> - return MAX2(ceil(ctx->Multisample.MinSampleShadingValue *
> - ctx->DrawBuffer->Visual.samples), 1);
> + return ctx->Multisample.MinSampleShadingValue;
> else
> - return 1;
> + return 0;
> }
> - return 1;
> + return 0;
> +
> }
> +
> +/* Gets the minimum number of shader invocations per fragment.
> + * This function is useful to determine if we need to do per
> + * sample shading or per fragment shading.
> + */
> +GLint
> +_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
> + const struct gl_fragment_program *prog,
> + bool ignore_sample_qualifier)
> +{
> + float sample_shading = _mesa_get_min_sample_shading(
> + ctx, prog, ignore_sample_qualifier);
> + return MAX2(ceil(sample_shading * ctx->DrawBuffer->Visual.samples), 1);
> +}
> +
> diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
> index ef69824..313caba 100644
> --- a/src/mesa/program/program.h
> +++ b/src/mesa/program/program.h
> @@ -192,6 +192,10 @@ _mesa_valid_register_index(const struct gl_context *ctx,
> extern void
> _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog);
>
> +extern float
> +_mesa_get_min_sample_shading(struct gl_context *ctx,
> + const struct gl_fragment_program *prog,
> + bool ignore_sample_qualifier);
> extern GLint
> _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
> const struct gl_fragment_program *prog,
> diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
> index 99e9df2..625ea29 100644
> --- a/src/mesa/state_tracker/st_atom.c
> +++ b/src/mesa/state_tracker/st_atom.c
> @@ -61,6 +61,7 @@ static const struct st_tracked_state *atoms[] =
> &st_update_sampler, /* depends on update_*_texture for swizzle */
> &st_update_framebuffer,
> &st_update_msaa,
> + &st_update_sample_shading,
> &st_update_vs_constants,
> &st_update_gs_constants,
> &st_update_fs_constants,
> diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
> index 60d89d7..c50111d 100644
> --- a/src/mesa/state_tracker/st_atom.h
> +++ b/src/mesa/state_tracker/st_atom.h
> @@ -59,6 +59,7 @@ extern const struct st_tracked_state st_update_viewport;
> extern const struct st_tracked_state st_update_scissor;
> extern const struct st_tracked_state st_update_blend;
> extern const struct st_tracked_state st_update_msaa;
> +extern const struct st_tracked_state st_update_sample_shading;
> extern const struct st_tracked_state st_update_sampler;
> extern const struct st_tracked_state st_update_fragment_texture;
> extern const struct st_tracked_state st_update_vertex_texture;
> diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c
> index 2f3a42e..1d6e571 100644
> --- a/src/mesa/state_tracker/st_atom_msaa.c
> +++ b/src/mesa/state_tracker/st_atom_msaa.c
> @@ -27,8 +27,10 @@
>
>
> #include "st_context.h"
> +#include "pipe/p_screen.h"
> #include "pipe/p_context.h"
> #include "st_atom.h"
> +#include "st_program.h"
>
> #include "cso_cache/cso_context.h"
> #include "util/u_framebuffer.h"
> @@ -70,6 +72,19 @@ static void update_sample_mask( struct st_context *st )
> }
> }
>
> +static void update_sample_shading( struct st_context *st )
> +{
> + struct pipe_screen *screen = st->pipe->screen;
> + if (!st->fp)
> + return;
> +
> + if (!screen->get_param(screen, PIPE_CAP_SAMPLE_SHADING))
> + return;
> +
> + cso_set_sample_shading(
> + st->cso_context,
> + _mesa_get_min_sample_shading(st->ctx, &st->fp->Base, false));
> +}
>
> const struct st_tracked_state st_update_msaa = {
> "st_update_msaa", /* name */
> @@ -79,3 +94,12 @@ const struct st_tracked_state st_update_msaa = {
> },
> update_sample_mask /* update */
> };
> +
> +const struct st_tracked_state st_update_sample_shading = {
> + "st_update_sample_shading", /* name */
> + { /* dirty */
> + (_NEW_MULTISAMPLE | _NEW_PROGRAM), /* mesa */
> + ST_NEW_FRAGMENT_PROGRAM, /* st */
> + },
> + update_sample_shading /* update */
> +};
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 18ddd4e..04e4ea1 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -421,7 +421,8 @@ void st_init_extensions(struct st_context *st)
>
> { o(OES_standard_derivatives), PIPE_CAP_SM3 },
> { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY },
> - { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }
> + { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
> + { o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING },
> };
>
> /* Required: render target and sampler support */
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index f019a55..8c882f3 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4160,7 +4160,9 @@ struct st_translate {
> static unsigned mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = {
> TGSI_SEMANTIC_FACE,
> TGSI_SEMANTIC_VERTEXID,
> - TGSI_SEMANTIC_INSTANCEID
> + TGSI_SEMANTIC_INSTANCEID,
> + TGSI_SEMANTIC_SAMPLEID,
> + TGSI_SEMANTIC_SAMPLEPOS,
> };
>
> /**
> @@ -4378,7 +4380,8 @@ translate_dst(struct st_translate *t,
> break;
>
> case TGSI_PROCESSOR_FRAGMENT:
> - if (dst_reg->index >= FRAG_RESULT_COLOR) {
> + if (dst_reg->index == FRAG_RESULT_COLOR ||
> + dst_reg->index >= FRAG_RESULT_DATA0) {
> dst = ureg_saturate(dst);
> }
> break;
> @@ -4872,6 +4875,15 @@ st_translate_program(
> TGSI_SEMANTIC_COLOR,
> outputSemanticIndex[i]);
> break;
> + case TGSI_SEMANTIC_SAMPLEMASK:
> + t->outputs[i] = ureg_DECL_output(ureg,
> + TGSI_SEMANTIC_SAMPLEMASK,
> + outputSemanticIndex[i]);
> + /* TODO: If we ever support more than 32 samples, this will have
> + * to become an array.
> + */
> + t->outputs[i] = ureg_writemask(t->outputs[i], TGSI_WRITEMASK_X);
> + break;
> default:
> assert(!"fragment shader outputs must be POSITION/STENCIL/COLOR");
> ret = PIPE_ERROR_BAD_INPUT;
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index 2f0ec32..f9887a2 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -682,6 +682,7 @@ st_translate_fragment_program(struct st_context *st,
> /* handle remaining outputs (color) */
> for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
> if (outputsWritten & BITFIELD64_BIT(attr)) {
> + int semantic = TGSI_SEMANTIC_COLOR;
> switch (attr) {
> case FRAG_RESULT_DEPTH:
> case FRAG_RESULT_STENCIL:
> @@ -689,17 +690,21 @@ st_translate_fragment_program(struct st_context *st,
> assert(0);
> break;
> case FRAG_RESULT_COLOR:
> - write_all = GL_TRUE; /* fallthrough */
> - default:
> - assert(attr == FRAG_RESULT_COLOR ||
> - (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
> - fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
> - fs_output_semantic_index[fs_num_outputs] = numColors;
> - outputMapping[attr] = fs_num_outputs;
> - numColors++;
> + write_all = GL_TRUE;
> + break;
> + case FRAG_RESULT_SAMPLE_MASK:
> + semantic = TGSI_SEMANTIC_SAMPLEMASK;
> break;
> }
>
> + assert(attr == FRAG_RESULT_COLOR ||
> + attr == FRAG_RESULT_SAMPLE_MASK ||
> + (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
> + fs_output_semantic_name[fs_num_outputs] = semantic;
> + fs_output_semantic_index[fs_num_outputs] = numColors;
> + outputMapping[attr] = fs_num_outputs;
> + numColors++;
> +
> fs_num_outputs++;
> }
> }
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list