Mesa (master): svga: emit sampler constants only if sampler view exists
Brian Paul
brianp at kemper.freedesktop.org
Tue Oct 3 18:10:05 UTC 2017
Module: Mesa
Branch: master
Commit: 3c71c42827766f66c300cf1f32679c33c54950c8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c71c42827766f66c300cf1f32679c33c54950c8
Author: Charmaine Lee <charmainel at vmware.com>
Date: Fri Jul 21 22:42:30 2017 -0700
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 <brianp at vmware.com>
---
src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 19 ++++++++++++-------
1 file 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 a864616c05..30046ca57a 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++;
+ }
}
}
More information about the mesa-commit
mailing list