struct pipe_constant_buffer aux_constbuf_current[PIPE_SHADER_TYPES];
struct pipe_constant_buffer aux_constbuf_saved[PIPE_SHADER_TYPES];
+ struct pipe_image_view fragment_image0_current;
+ struct pipe_image_view fragment_image0_saved;
+
unsigned nr_so_targets;
struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS];
pipe_resource_reference(&ctx->aux_constbuf_saved[i].buffer, NULL);
}
+ pipe_resource_reference(&ctx->fragment_image0_current.resource, NULL);
+ pipe_resource_reference(&ctx->fragment_image0_saved.resource, NULL);
+
for (i = 0; i < PIPE_MAX_SO_BUFFERS; i++) {
pipe_so_target_reference(&ctx->so_targets[i], NULL);
pipe_so_target_reference(&ctx->so_targets_saved[i], NULL);
}
+void
+cso_set_shader_images(struct cso_context *ctx, unsigned shader_stage,
+ unsigned start, unsigned count,
+ struct pipe_image_view *images)
+{
+ if (shader_stage == PIPE_SHADER_FRAGMENT && start == 0 && count >= 1) {
+ util_copy_image_view(&ctx->fragment_image0_current, &images[0]);
+ }
+
+ ctx->pipe->set_shader_images(ctx->pipe, shader_stage, start, count, images);
+}
+
+
+static void
+cso_save_fragment_image0(struct cso_context *ctx)
+{
+ util_copy_image_view(&ctx->fragment_image0_saved,
+ &ctx->fragment_image0_current);
+}
+
+
+static void
+cso_restore_fragment_image0(struct cso_context *ctx)
+{
+ cso_set_shader_images(ctx, PIPE_SHADER_FRAGMENT, 0, 1,
+ &ctx->fragment_image0_saved);
+}
+
+
void
cso_set_stream_outputs(struct cso_context *ctx,
unsigned num_targets,
cso_save_viewport(cso);
if (state_mask & CSO_BIT_PAUSE_QUERIES)
cso->pipe->set_active_query_state(cso->pipe, false);
+ if (state_mask & CSO_BIT_FRAGMENT_IMAGE0)
+ cso_save_fragment_image0(cso);
}
cso_restore_viewport(cso);
if (state_mask & CSO_BIT_PAUSE_QUERIES)
cso->pipe->set_active_query_state(cso->pipe, true);
+ if (state_mask & CSO_BIT_FRAGMENT_IMAGE0)
+ cso_restore_fragment_image0(cso);
cso->saved_state = 0;
}
#define CSO_BIT_VERTEX_SHADER 0x20000
#define CSO_BIT_VIEWPORT 0x40000
#define CSO_BIT_PAUSE_QUERIES 0x80000
+#define CSO_BIT_FRAGMENT_IMAGE0 0x100000
#define CSO_BITS_ALL_SHADERS (CSO_BIT_VERTEX_SHADER | \
CSO_BIT_FRAGMENT_SHADER | \
struct pipe_sampler_view **views);
+/* shader images */
+
+void
+cso_set_shader_images(struct cso_context *cso, unsigned shader_stage,
+ unsigned start, unsigned count,
+ struct pipe_image_view *views);
+
+
/* constant buffers */
void cso_set_constant_buffer(struct cso_context *cso, unsigned shader_stage,
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_surface.h"
+#include "cso_cache/cso_context.h"
#include "st_cb_texture.h"
#include "st_debug.h"
}
}
}
- st->pipe->set_shader_images(st->pipe, shader_type, 0, shader->NumImages,
- images);
+ cso_set_shader_images(st->cso_context, shader_type, 0, shader->NumImages,
+ images);
/* clear out any stale shader images */
if (shader->NumImages < c->MaxImageUniforms)
- st->pipe->set_shader_images(
- st->pipe, shader_type,
+ cso_set_shader_images(
+ st->cso_context, shader_type,
shader->NumImages,
c->MaxImageUniforms - shader->NumImages,
NULL);