summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-06-30 14:08:49 -0700
committerBrian Paul <[email protected]>2017-07-03 10:10:13 -0600
commite6d1cc31fa7a7252c07933a7e311fb0d8b331e12 (patch)
treeac3b53db1c178d996b7062397da2be1d570152c1 /src/gallium/drivers/svga
parent6b4bf7e8be3cc0f350c701efa67313197881cf99 (diff)
svga: fix texture buffer object regression
With change 8aba778fa2cd98a0b5a7429d3c5057778a0c808c we stopped binding sampler objects for texture buffers. That broke our texture sample / sampler view setup code. Now, we loop over the max(num samplers, num sampler views) and handle the sampler and view information separately. For texture buffers, the sampler will be NULL but the sampler view non-null. Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_shader.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index d069b0d29c4..ef3b021d404 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -199,13 +199,13 @@ svga_init_shader_key_common(const struct svga_context *svga,
/* In case the number of samplers and sampler_views doesn't match,
* loop over the lower of the two counts.
*/
- key->num_textures = MIN2(svga->curr.num_sampler_views[shader],
+ key->num_textures = MAX2(svga->curr.num_sampler_views[shader],
svga->curr.num_samplers[shader]);
for (i = 0; i < key->num_textures; i++) {
struct pipe_sampler_view *view = svga->curr.sampler_views[shader][i];
const struct svga_sampler_state *sampler = svga->curr.sampler[shader][i];
- if (view && sampler) {
+ if (view) {
assert(view->texture);
assert(view->texture->target < (1 << 4)); /* texture_target:4 */
@@ -224,13 +224,6 @@ svga_init_shader_key_common(const struct svga_context *svga,
}
}
- if (!sampler->normalized_coords) {
- assert(idx < (1 << 5)); /* width_height_idx:5 bitfield */
- key->tex[i].width_height_idx = idx++;
- key->tex[i].unnormalized = TRUE;
- ++key->num_unnormalized_coords;
- }
-
swizzle_tab = (!util_format_has_alpha(view->format) &&
svga_texture_device_format_has_alpha(view->texture)) ?
set_alpha : copy_alpha;
@@ -246,6 +239,15 @@ svga_init_shader_key_common(const struct svga_context *svga,
key->tex[i].swizzle_b = swizzle_tab[view->swizzle_b];
key->tex[i].swizzle_a = swizzle_tab[view->swizzle_a];
}
+
+ if (sampler) {
+ if (!sampler->normalized_coords) {
+ assert(idx < (1 << 5)); /* width_height_idx:5 bitfield */
+ key->tex[i].width_height_idx = idx++;
+ key->tex[i].unnormalized = TRUE;
+ ++key->num_unnormalized_coords;
+ }
+ }
}
}