freedreno: a2xx: fix fast clear not being used for Z24X8 buffers
[mesa.git] / src / gallium / drivers / freedreno / a5xx / fd5_image.c
index f5d25ff8a696862cc0658a7fe6bf05569714e17e..c53b2e9224539f0d2ade101ad6db886bcf3141be 100644 (file)
@@ -189,48 +189,25 @@ static void emit_image_ssbo(struct fd_ringbuffer *ring, unsigned slot,
        }
 }
 
-/* Note that to avoid conflicts with textures and non-image "SSBO"s, images
- * are placedd, in reverse order, at the end of the state block, so for
- * example the sampler state:
- *
- *   0:   first texture
- *   1:   second texture
- *   ....
- *   N-1: second image
- *   N:   first image
- */
-static unsigned
-get_image_slot(unsigned index)
-{
-       /* TODO figure out real limit per generation, and don't hardcode.
-        * This needs to match get_image_slot() in ir3_compiler_nir.
-        * Possibly should be factored out into shared helper?
-        */
-       const unsigned max_samplers = 16;
-       return max_samplers - index - 1;
-}
-
 /* Emit required "SSBO" and sampler state.  The sampler state is used by the
  * hw for imageLoad(), and "SSBO" state for imageStore().  Returns max sampler
  * used.
  */
 void
 fd5_emit_images(struct fd_context *ctx, struct fd_ringbuffer *ring,
-               enum pipe_shader_type shader)
+               enum pipe_shader_type shader, const struct ir3_shader_variant *v)
 {
        struct fd_shaderimg_stateobj *so = &ctx->shaderimg[shader];
+       unsigned enabled_mask = so->enabled_mask;
+       const struct ir3_ibo_mapping *m = &v->image_mapping;
 
-       so->dirty_mask &= so->enabled_mask;
-
-       while (so->dirty_mask) {
-               unsigned index = u_bit_scan(&so->dirty_mask);
-               unsigned slot = get_image_slot(index);
+       while (enabled_mask) {
+               unsigned index = u_bit_scan(&enabled_mask);
                struct fd5_image img;
 
                translate_image(&img, &so->si[index]);
 
-               emit_image_tex(ring, slot, &img, shader);
-               emit_image_ssbo(ring, slot, &img, shader);
+               emit_image_tex(ring, m->image_to_tex[index] + m->tex_base, &img, shader);
+               emit_image_ssbo(ring, m->image_to_ibo[index], &img, shader);
        }
 }
-