diff options
author | Rob Clark <[email protected]> | 2015-06-10 19:59:20 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-06-21 07:52:07 -0400 |
commit | b516e68afb548894eff6b1f375c01f6dfafb6aed (patch) | |
tree | 8a847b6c205a76f2fd5620d801bfb48281211165 /src/gallium/auxiliary | |
parent | f481af110e6ab42b2d184f225bfe7eb1e66df393 (diff) |
draw: updates to support SVIEW decls
To allow for shaders which use SVIEW decls for TEX* instructions, we
need to preserve the constraint that the shader either has no SVIEW's or
it has one matching SVIEW for each SAMP.
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_aaline.c | 17 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 17 |
2 files changed, 32 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 2f14efea96f..936046ea5f5 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -51,7 +51,7 @@ /** Approx number of new tokens for instructions in aa_transform_inst() */ -#define NUM_NEW_TOKENS 50 +#define NUM_NEW_TOKENS 53 /** @@ -137,6 +137,7 @@ struct aa_transform_context { uint tempsUsed; /**< bitmask */ int colorOutput; /**< which output is the primary color */ uint samplersUsed; /**< bitfield of samplers used */ + bool hasSview; int freeSampler; /** an available sampler for the pstipple */ int maxInput, maxGeneric; /**< max input index found */ int colorTemp, texTemp; /**< temp registers */ @@ -165,6 +166,9 @@ aa_transform_decl(struct tgsi_transform_context *ctx, aactx->samplersUsed |= 1 << i; } } + else if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { + aactx->hasSview = true; + } else if (decl->Declaration.File == TGSI_FILE_INPUT) { if ((int) decl->Range.Last > aactx->maxInput) aactx->maxInput = decl->Range.Last; @@ -232,6 +236,17 @@ aa_transform_prolog(struct tgsi_transform_context *ctx) /* declare new sampler */ tgsi_transform_sampler_decl(ctx, aactx->freeSampler); + /* if the src shader has SVIEW decl's for each SAMP decl, we + * need to continue the trend and ensure there is a matching + * SVIEW for the new SAMP we just created + */ + if (aactx->hasSview) { + tgsi_transform_sampler_view_decl(ctx, + aactx->freeSampler, + TGSI_TEXTURE_2D, + TGSI_RETURN_TYPE_FLOAT); + } + /* declare new temp regs */ tgsi_transform_temp_decl(ctx, aactx->texTemp); tgsi_transform_temp_decl(ctx, aactx->colorTemp); diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 8f21c46a43a..445f195e59c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -53,7 +53,7 @@ /** Approx number of new tokens for instructions in pstip_transform_inst() */ -#define NUM_NEW_TOKENS 50 +#define NUM_NEW_TOKENS 53 /** @@ -126,6 +126,7 @@ struct pstip_transform_context { int wincoordInput; int maxInput; uint samplersUsed; /**< bitfield of samplers used */ + bool hasSview; int freeSampler; /** an available sampler for the pstipple */ int texTemp; /**< temp registers */ int numImmed; @@ -149,6 +150,9 @@ pstip_transform_decl(struct tgsi_transform_context *ctx, pctx->samplersUsed |= 1 << i; } } + else if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { + pctx->hasSview = true; + } else if (decl->Declaration.File == TGSI_FILE_INPUT) { pctx->maxInput = MAX2(pctx->maxInput, (int) decl->Range.Last); if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) @@ -232,6 +236,17 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx) /* declare new sampler */ tgsi_transform_sampler_decl(ctx, pctx->freeSampler); + /* if the src shader has SVIEW decl's for each SAMP decl, we + * need to continue the trend and ensure there is a matching + * SVIEW for the new SAMP we just created + */ + if (pctx->hasSview) { + tgsi_transform_sampler_view_decl(ctx, + pctx->freeSampler, + TGSI_TEXTURE_2D, + TGSI_RETURN_TYPE_FLOAT); + } + /* declare new temp regs */ tgsi_transform_temp_decl(ctx, pctx->texTemp); |