nir: gather which images are MSAA
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5209>
This commit is contained in:
@@ -598,7 +598,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
|
|||||||
shader->info.num_textures = 0;
|
shader->info.num_textures = 0;
|
||||||
shader->info.num_images = 0;
|
shader->info.num_images = 0;
|
||||||
shader->info.image_buffers = 0;
|
shader->info.image_buffers = 0;
|
||||||
shader->info.last_msaa_image = -1;
|
shader->info.msaa_images = 0;
|
||||||
|
|
||||||
nir_foreach_variable(var, &shader->uniforms) {
|
nir_foreach_variable(var, &shader->uniforms) {
|
||||||
/* Bindless textures and images don't use non-bindless slots.
|
/* Bindless textures and images don't use non-bindless slots.
|
||||||
@@ -618,13 +618,12 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
|
|||||||
shader->info.image_buffers |=
|
shader->info.image_buffers |=
|
||||||
BITFIELD_RANGE(shader->info.num_images, num_image_slots);
|
BITFIELD_RANGE(shader->info.num_images, num_image_slots);
|
||||||
}
|
}
|
||||||
|
if (glsl_get_sampler_dim(image_type) == GLSL_SAMPLER_DIM_MS) {
|
||||||
|
shader->info.msaa_images |=
|
||||||
|
BITFIELD_RANGE(shader->info.num_images, num_image_slots);
|
||||||
|
}
|
||||||
shader->info.num_images += num_image_slots;
|
shader->info.num_images += num_image_slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming image slots don't have holes (e.g. OpenGL) */
|
|
||||||
if (glsl_type_is_image(var->type) &&
|
|
||||||
glsl_get_sampler_dim(var->type) == GLSL_SAMPLER_DIM_MS)
|
|
||||||
shader->info.last_msaa_image = shader->info.num_images - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->info.inputs_read = 0;
|
shader->info.inputs_read = 0;
|
||||||
|
@@ -116,8 +116,6 @@ typedef struct shader_info {
|
|||||||
uint8_t num_ssbos;
|
uint8_t num_ssbos;
|
||||||
/* Number of images used by this shader */
|
/* Number of images used by this shader */
|
||||||
uint8_t num_images;
|
uint8_t num_images;
|
||||||
/* Index of the last MSAA image. */
|
|
||||||
int8_t last_msaa_image;
|
|
||||||
|
|
||||||
/* Which inputs are actually read */
|
/* Which inputs are actually read */
|
||||||
uint64_t inputs_read;
|
uint64_t inputs_read;
|
||||||
@@ -154,6 +152,8 @@ typedef struct shader_info {
|
|||||||
uint32_t images_used;
|
uint32_t images_used;
|
||||||
/** Bitfield of which images are buffers. */
|
/** Bitfield of which images are buffers. */
|
||||||
uint32_t image_buffers;
|
uint32_t image_buffers;
|
||||||
|
/** Bitfield of which images are MSAA. */
|
||||||
|
uint32_t msaa_images;
|
||||||
|
|
||||||
/* SPV_KHR_float_controls: execution mode for floating point ops */
|
/* SPV_KHR_float_controls: execution mode for floating point ops */
|
||||||
uint16_t float_controls_execution_mode;
|
uint16_t float_controls_execution_mode;
|
||||||
|
@@ -2579,7 +2579,6 @@ ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
|
|||||||
|
|
||||||
nir->info.num_images = c->num_images;
|
nir->info.num_images = c->num_images;
|
||||||
nir->info.num_textures = c->num_samplers;
|
nir->info.num_textures = c->num_samplers;
|
||||||
nir->info.last_msaa_image = c->num_msaa_images - 1;
|
|
||||||
|
|
||||||
nir_validate_shader(nir, "TTN: after all optimizations");
|
nir_validate_shader(nir, "TTN: after all optimizations");
|
||||||
}
|
}
|
||||||
|
@@ -718,7 +718,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
|
|||||||
if (nir->num_uniforms > 0)
|
if (nir->num_uniforms > 0)
|
||||||
info->const_buffers_declared |= 1;
|
info->const_buffers_declared |= 1;
|
||||||
info->images_declared = u_bit_consecutive(0, nir->info.num_images);
|
info->images_declared = u_bit_consecutive(0, nir->info.num_images);
|
||||||
info->msaa_images_declared = u_bit_consecutive(0, nir->info.last_msaa_image + 1);
|
info->msaa_images_declared = nir->info.msaa_images;
|
||||||
info->samplers_declared = nir->info.textures_used;
|
info->samplers_declared = nir->info.textures_used;
|
||||||
|
|
||||||
info->num_written_clipdistance = nir->info.clip_distance_array_size;
|
info->num_written_clipdistance = nir->info.clip_distance_array_size;
|
||||||
|
Reference in New Issue
Block a user