GEN6_EMIT(BINDING_TABLE_STATE);
GEN6_EMIT(SURFACE_STATE);
GEN6_EMIT(surf_SURFACE_STATE);
- GEN6_EMIT(cbuf_SURFACE_STATE);
GEN6_EMIT(so_SURFACE_STATE);
GEN6_EMIT(SAMPLER_STATE);
GEN6_EMIT(SAMPLER_BORDER_COLOR_STATE);
int shader_type,
struct gen6_pipeline_session *session)
{
- const struct pipe_constant_buffer *buffers =
- ilo->cbuf[shader_type].states;
+ const struct ilo_cbuf_cso *buffers = ilo->cbuf[shader_type].cso;
const int num_buffers = ilo->cbuf[shader_type].count;
uint32_t *surface_state;
int offset, i;
return;
for (i = 0; i < num_buffers; i++) {
- if (buffers[i].buffer) {
+ if (buffers[i].resource) {
+ const struct ilo_view_surface *surf = &buffers[i].surface;
+
surface_state[i] =
- p->gen6_cbuf_SURFACE_STATE(p->dev, &buffers[i], p->cp);
+ p->gen6_SURFACE_STATE(p->dev, surf, false, p->cp);
}
else {
surface_state[i] = 0;
GEN6_USE(p, BINDING_TABLE_STATE, gen6);
GEN6_USE(p, SURFACE_STATE, gen6);
GEN6_USE(p, surf_SURFACE_STATE, gen6);
- GEN6_USE(p, cbuf_SURFACE_STATE, gen6);
GEN6_USE(p, so_SURFACE_STATE, gen6);
GEN6_USE(p, SAMPLER_STATE, gen6);
GEN6_USE(p, SAMPLER_BORDER_COLOR_STATE, gen6);
GEN6_USE(p, BINDING_TABLE_STATE, gen7);
GEN6_USE(p, SURFACE_STATE, gen7);
GEN6_USE(p, surf_SURFACE_STATE, gen7);
- GEN6_USE(p, cbuf_SURFACE_STATE, gen7);
GEN6_USE(p, SAMPLER_STATE, gen7);
GEN6_USE(p, SAMPLER_BORDER_COLOR_STATE, gen7);
GEN6_USE(p, push_constant_buffer, gen7);
unsigned count;
};
+struct ilo_cbuf_cso {
+ struct pipe_resource *resource;
+ struct ilo_view_surface surface;
+};
+
struct ilo_cbuf_state {
- struct pipe_constant_buffer states[ILO_MAX_CONST_BUFFERS];
+ struct ilo_cbuf_cso cso[ILO_MAX_CONST_BUFFERS];
unsigned count;
};
return gen6_emit_SURFACE_STATE(dev, &surf, true, cp);
}
-static uint32_t
-gen6_emit_cbuf_SURFACE_STATE(const struct ilo_dev_info *dev,
- const struct pipe_constant_buffer *cbuf,
- struct ilo_cp *cp)
-{
- const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- struct ilo_buffer *buf = ilo_buffer(cbuf->buffer);
- struct ilo_view_surface surf;
-
- ILO_GPE_VALID_GEN(dev, 6, 6);
-
- ilo_gpe_init_view_surface_for_buffer_gen6(dev, buf,
- cbuf->buffer_offset, cbuf->buffer_size,
- util_format_get_blocksize(elem_format), elem_format,
- false, false, &surf);
-
- return gen6_emit_SURFACE_STATE(dev, &surf, false, cp);
-}
-
static uint32_t
gen6_emit_so_SURFACE_STATE(const struct ilo_dev_info *dev,
const struct pipe_stream_output_target *so,
GEN6_SET(BINDING_TABLE_STATE),
GEN6_SET(SURFACE_STATE),
GEN6_SET(surf_SURFACE_STATE),
- GEN6_SET(cbuf_SURFACE_STATE),
GEN6_SET(so_SURFACE_STATE),
GEN6_SET(SAMPLER_STATE),
GEN6_SET(SAMPLER_BORDER_COLOR_STATE),
const struct pipe_surface *surface,
struct ilo_cp *cp);
-typedef uint32_t
-(*ilo_gpe_gen6_cbuf_SURFACE_STATE)(const struct ilo_dev_info *dev,
- const struct pipe_constant_buffer *cbuf,
- struct ilo_cp *cp);
-
typedef uint32_t
(*ilo_gpe_gen6_so_SURFACE_STATE)(const struct ilo_dev_info *dev,
const struct pipe_stream_output_target *so,
GEN6_EMIT(BINDING_TABLE_STATE);
GEN6_EMIT(SURFACE_STATE);
GEN6_EMIT(surf_SURFACE_STATE);
- GEN6_EMIT(cbuf_SURFACE_STATE);
GEN6_EMIT(so_SURFACE_STATE);
GEN6_EMIT(SAMPLER_STATE);
GEN6_EMIT(SAMPLER_BORDER_COLOR_STATE);
return gen7_emit_SURFACE_STATE(dev, &surf, true, cp);
}
-static uint32_t
-gen7_emit_cbuf_SURFACE_STATE(const struct ilo_dev_info *dev,
- const struct pipe_constant_buffer *cbuf,
- struct ilo_cp *cp)
-{
- const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- struct ilo_buffer *buf = ilo_buffer(cbuf->buffer);
- struct ilo_view_surface surf;
-
- ILO_GPE_VALID_GEN(dev, 7, 7);
-
- ilo_gpe_init_view_surface_for_buffer_gen7(dev, buf,
- cbuf->buffer_offset, cbuf->buffer_size,
- util_format_get_blocksize(elem_format), elem_format,
- false, false, &surf);
-
- return gen7_emit_SURFACE_STATE(dev, &surf, false, cp);
-}
-
static int
gen7_estimate_command_size(const struct ilo_dev_info *dev,
enum ilo_gpe_gen7_command cmd,
GEN7_USE(gen7, BINDING_TABLE_STATE, gen6);
GEN7_USE(gen7, SURFACE_STATE, gen6);
GEN7_SET(gen7, surf_SURFACE_STATE);
- GEN7_SET(gen7, cbuf_SURFACE_STATE);
GEN7_USE(gen7, SAMPLER_STATE, gen6);
GEN7_USE(gen7, SAMPLER_BORDER_COLOR_STATE, gen6);
GEN7_USE(gen7, push_constant_buffer, gen6);
typedef ilo_gpe_gen6_BINDING_TABLE_STATE ilo_gpe_gen7_BINDING_TABLE_STATE;
typedef ilo_gpe_gen6_SURFACE_STATE ilo_gpe_gen7_SURFACE_STATE;
typedef ilo_gpe_gen6_surf_SURFACE_STATE ilo_gpe_gen7_surf_SURFACE_STATE;
-typedef ilo_gpe_gen6_cbuf_SURFACE_STATE ilo_gpe_gen7_cbuf_SURFACE_STATE;
typedef ilo_gpe_gen6_SAMPLER_STATE ilo_gpe_gen7_SAMPLER_STATE;
typedef ilo_gpe_gen6_SAMPLER_BORDER_COLOR_STATE ilo_gpe_gen7_SAMPLER_BORDER_COLOR_STATE;
typedef ilo_gpe_gen6_push_constant_buffer ilo_gpe_gen7_push_constant_buffer;
GEN7_EMIT(BINDING_TABLE_STATE);
GEN7_EMIT(SURFACE_STATE);
GEN7_EMIT(surf_SURFACE_STATE);
- GEN7_EMIT(cbuf_SURFACE_STATE);
GEN7_EMIT(SAMPLER_STATE);
GEN7_EMIT(SAMPLER_BORDER_COLOR_STATE);
GEN7_EMIT(push_constant_buffer);
return;
for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
- int last_cbuf = Elements(ilo->cbuf[sh].states) - 1;
+ int last_cbuf = Elements(ilo->cbuf[sh].cso) - 1;
/* find the last cbuf */
while (last_cbuf >= 0 &&
- !ilo->cbuf[sh].states[last_cbuf].buffer)
+ !ilo->cbuf[sh].cso[last_cbuf].resource)
last_cbuf--;
ilo->cbuf[sh].count = last_cbuf + 1;
struct pipe_constant_buffer *buf)
{
struct ilo_context *ilo = ilo_context(pipe);
- struct pipe_constant_buffer *cbuf;
+ struct ilo_cbuf_cso *cbuf;
assert(shader < Elements(ilo->cbuf));
- assert(index < Elements(ilo->cbuf[shader].states));
+ assert(index < Elements(ilo->cbuf[shader].cso));
- cbuf = &ilo->cbuf[shader].states[index];
-
- pipe_resource_reference(&cbuf->buffer, NULL);
+ cbuf = &ilo->cbuf[shader].cso[index];
if (buf) {
- pipe_resource_reference(&cbuf->buffer, buf->buffer);
- cbuf->buffer_offset = buf->buffer_offset;
- cbuf->buffer_size = buf->buffer_size;
- cbuf->user_buffer = buf->user_buffer;
+ const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ pipe_resource_reference(&cbuf->resource, buf->buffer);
+
+ ilo_gpe_init_view_surface_for_buffer(ilo->dev, ilo_buffer(buf->buffer),
+ buf->buffer_offset, buf->buffer_size,
+ util_format_get_blocksize(elem_format), elem_format,
+ false, false, &cbuf->surface);
}
else {
- cbuf->buffer_offset = 0;
- cbuf->buffer_size = 0;
- cbuf->user_buffer = 0;
+ pipe_resource_reference(&cbuf->resource, NULL);
+ cbuf->surface.bo = NULL;
}
/* the correct value will be set in ilo_finalize_states() */