shader: Resize sampler views bit mask

v2:
* Fix type of bit mask (Gert Wollny)
* Make the calculation of VREND_SHADER_SAMPLER_VIEWS_MASK_LENGTH
  simpler (Gert Wollny)

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
macos/master
Akihiko Odaki 3 years ago
parent 138b8ad95a
commit 1822e84319
  1. 2
      src/vrend_renderer.c
  2. 2
      src/vrend_shader.c
  3. 5
      src/vrend_shader.h

@ -3597,7 +3597,7 @@ static inline void vrend_fill_shader_key(struct vrend_sub_context *sub_ctx,
if (view && view->texture->target == GL_TEXTURE_BUFFER && if (view && view->texture->target == GL_TEXTURE_BUFFER &&
tex_conv_table[view->format].flags & VIRGL_TEXTURE_NEED_SWIZZLE) { tex_conv_table[view->format].flags & VIRGL_TEXTURE_NEED_SWIZZLE) {
key->sampler_views_lower_swizzle_mask |= 1 << i; key->sampler_views_lower_swizzle_mask[i / 64] |= 1ull << (i % 64);
key->tex_swizzle[i] = to_pipe_swizzle(view->gl_swizzle[0]) | key->tex_swizzle[i] = to_pipe_swizzle(view->gl_swizzle[0]) |
to_pipe_swizzle(view->gl_swizzle[1]) << 3 | to_pipe_swizzle(view->gl_swizzle[1]) << 3 |
to_pipe_swizzle(view->gl_swizzle[2]) << 6 | to_pipe_swizzle(view->gl_swizzle[2]) << 6 |

@ -2948,7 +2948,7 @@ static void translate_tex(struct dump_ctx *ctx,
tex_ext, srcs[sampler_index], get_string(txfi), srcs[0], tex_ext, srcs[sampler_index], get_string(txfi), srcs[0],
get_wm_string(twm), bias, offset); get_wm_string(twm), bias, offset);
if (ctx->key->sampler_views_lower_swizzle_mask & (1 << sinfo->sreg_index)) { if (ctx->key->sampler_views_lower_swizzle_mask[sinfo->sreg_index / 64] & (1ull << (sinfo->sreg_index % 64))) {
int16_t packed_swizzles = ctx->key->tex_swizzle[sinfo->sreg_index]; int16_t packed_swizzles = ctx->key->tex_swizzle[sinfo->sreg_index];
emit_buff(&ctx->glsl_strbufs, " val = vec4("); emit_buff(&ctx->glsl_strbufs, " val = vec4(");

@ -32,6 +32,9 @@
#define VIRGL_NUM_CLIP_PLANES 8 #define VIRGL_NUM_CLIP_PLANES 8
#define VREND_SHADER_SAMPLER_VIEWS_MASK_LENGTH \
((PIPE_MAX_SHADER_SAMPLER_VIEWS + 63) / 64)
enum gl_advanced_blend_mode enum gl_advanced_blend_mode
{ {
BLEND_NONE = 0, BLEND_NONE = 0,
@ -180,7 +183,7 @@ struct vrend_shader_key {
} gs; } gs;
}; };
uint32_t sampler_views_lower_swizzle_mask; uint64_t sampler_views_lower_swizzle_mask[VREND_SHADER_SAMPLER_VIEWS_MASK_LENGTH];
uint16_t tex_swizzle[PIPE_MAX_SHADER_SAMPLER_VIEWS]; uint16_t tex_swizzle[PIPE_MAX_SHADER_SAMPLER_VIEWS];
uint8_t num_in_cull : 4; uint8_t num_in_cull : 4;

Loading…
Cancel
Save