aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2017-07-21 22:42:30 -0700
committerBrian Paul <[email protected]>2017-10-03 12:07:05 -0600
commit3c71c42827766f66c300cf1f32679c33c54950c8 (patch)
tree4ebff48a674ef92acec9edc1a7c9b7a288a36c52 /src/gallium/drivers
parentb7c08e50812cd356bfe8caa00f1962c97774744f (diff)
svga: emit sampler constants only if sampler view exists
It is possible to have holes in the shader emitter's sampler_target array. 0 sampler_target does not necessarily mean there is no sampler view specified since texture buffer target has the value 0. With this patch, a sampler_view array is added to the shader emitter structure to specify if there is a sampler view for each texture unit. Only if there is a sampler view, we will emit constant for texcoord scale factor or texture buffer size for that sampler view. Fixes a rendering issue with Turbine after commit 1020e960440. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_vgpu10.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index a864616c05a..30046ca57ae 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -134,6 +134,7 @@ struct svga_shader_emitter_v10
/* Samplers */
unsigned num_samplers;
+ boolean sampler_view[PIPE_MAX_SAMPLERS]; /**< True if sampler view exists*/
ubyte sampler_target[PIPE_MAX_SAMPLERS]; /**< TGSI_TEXTURE_x */
ubyte sampler_return_type[PIPE_MAX_SAMPLERS]; /**< TGSI_RETURN_TYPE_x */
@@ -2322,6 +2323,7 @@ emit_vgpu10_declaration(struct svga_shader_emitter_v10 *emit,
emit->sampler_target[unit] = decl->SamplerView.Resource;
/* Note: we can ignore YZW return types for now */
emit->sampler_return_type[unit] = decl->SamplerView.ReturnTypeX;
+ emit->sampler_view[unit] = TRUE;
}
return TRUE;
@@ -2886,14 +2888,17 @@ emit_constant_declaration(struct svga_shader_emitter_v10 *emit)
for (i = 0; i < emit->num_samplers; i++) {
- /* Texcoord scale factors for RECT textures */
- if (emit->key.tex[i].unnormalized) {
- emit->texcoord_scale_index[i] = total_consts++;
- }
+ if (emit->sampler_view[i]) {
+
+ /* Texcoord scale factors for RECT textures */
+ if (emit->key.tex[i].unnormalized) {
+ emit->texcoord_scale_index[i] = total_consts++;
+ }
- /* Texture buffer sizes */
- if (emit->sampler_target[i] == TGSI_TEXTURE_BUFFER) {
- emit->texture_buffer_size_index[i] = total_consts++;
+ /* Texture buffer sizes */
+ if (emit->sampler_target[i] == TGSI_TEXTURE_BUFFER) {
+ emit->texture_buffer_size_index[i] = total_consts++;
+ }
}
}