draw: add vs/gs images support
[mesa.git] / src / gallium / auxiliary / draw / draw_context.c
index 74436f98016e689212050135e44aee92fa49cac5..9de40d76221b4451899becabc5b8c05fd20e2fcd 100644 (file)
@@ -1033,6 +1033,27 @@ draw_set_samplers(struct draw_context *draw,
 #endif
 }
 
+void
+draw_set_images(struct draw_context *draw,
+                enum pipe_shader_type shader_stage,
+                struct pipe_image_view *views,
+                unsigned num)
+{
+   unsigned i;
+
+   debug_assert(shader_stage < PIPE_SHADER_TYPES);
+   debug_assert(num <= PIPE_MAX_SHADER_IMAGES);
+
+   draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+
+   for (i = 0; i < num; ++i)
+      draw->images[shader_stage][i] = &views[i];
+   for (i = num; i < draw->num_sampler_views[shader_stage]; ++i)
+      draw->images[shader_stage][i] = NULL;
+
+   draw->num_images[shader_stage] = num;
+}
+
 void
 draw_set_mapped_texture(struct draw_context *draw,
                         enum pipe_shader_type shader_stage,
@@ -1055,6 +1076,26 @@ draw_set_mapped_texture(struct draw_context *draw,
 #endif
 }
 
+void
+draw_set_mapped_image(struct draw_context *draw,
+                      enum pipe_shader_type shader_stage,
+                      unsigned idx,
+                      uint32_t width, uint32_t height, uint32_t depth,
+                      const void *base_ptr,
+                      uint32_t row_stride,
+                      uint32_t img_stride)
+{
+#ifdef HAVE_LLVM
+   if (draw->llvm)
+      draw_llvm_set_mapped_image(draw,
+                                 shader_stage,
+                                 idx,
+                                 width, height, depth,
+                                 base_ptr,
+                                 row_stride, img_stride);
+#endif
+}
+
 /**
  * XXX: Results for PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS because there are two
  * different ways of setting textures, and drivers typically only support one.