aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_state.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-03 15:25:48 +0800
committerChia-I Wu <[email protected]>2013-06-07 11:13:16 +0800
commit5354dc742899c498a97fe6f64cc5d9237beb1e9f (patch)
tree0e6e88d3de023d20dee84a1cb54fcbbb926adf28 /src/gallium/drivers/ilo/ilo_state.c
parent2d82885d3cd9c5ab90e4777da8dfd723da273cd8 (diff)
ilo: use emit_SURFACE_STATE() for constant buffers
Introduce ilo_cbuf_cso and initialize it in set_constant_buffer(). As ilo_view_surface is embedded in ilo_cbuf_cso, switch to emit_SURFACE_STATE() for constant buffers and remove emit_cbuf_SURFACE_STATE().
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_state.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index a88d643a3bf..35e2e85e4e4 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -131,11 +131,11 @@ finalize_constant_buffers(struct ilo_context *ilo)
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;
@@ -519,25 +519,26 @@ ilo_set_constant_buffer(struct pipe_context *pipe,
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() */