r600g: clarify const buffer numbering and handling
authorDave Airlie <airlied@redhat.com>
Tue, 6 Nov 2012 05:31:41 +0000 (15:31 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 8 Nov 2012 23:24:40 +0000 (09:24 +1000)
For cube map arrays I'll need another driver private constant
buffer, and looking forward to UBOs. So clean up with some
defines, that can be modified when adding cube map array and ubos
later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_state_common.c

index b5280e32160ee66e31e6f4fa707b9b01047406c9..3a69eb23bf18843085d2e7181a00eab387e79fbb 100644 (file)
@@ -540,7 +540,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
        case PIPE_SHADER_CAP_MAX_CONSTS:
                return R600_MAX_CONST_BUFFER_SIZE;
        case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
-               return R600_MAX_CONST_BUFFERS-1;
+               return R600_MAX_USER_CONST_BUFFERS;
        case PIPE_SHADER_CAP_MAX_PREDS:
                return 0; /* nothing uses this */
        case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
index 7f1902564ccce533d84dc8b9e8bc814321325109..2287d6371ff8b8e8796cd6feca9adc62351f4f36 100644 (file)
 
 #define R600_NUM_ATOMS 36
 
-#define R600_MAX_CONST_BUFFERS 2
+#define R600_MAX_USER_CONST_BUFFERS 1
+#define R600_MAX_DRIVER_CONST_BUFFERS 1
+#define R600_MAX_CONST_BUFFERS (R600_MAX_USER_CONST_BUFFERS + R600_MAX_DRIVER_CONST_BUFFERS)
+
+/* start driver buffers after user buffers */
+#define R600_UCP_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS)
+
 #define R600_MAX_CONST_BUFFER_SIZE 4096
 
 #ifdef PIPE_ARCH_BIG_ENDIAN
index 8862d0ee70b0d747b6d42d3cdcc1e9f696899c3e..782fa4c469c7429375d274a33c7cb45df59b5e03 100644 (file)
@@ -1516,7 +1516,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
                                alu.src[0].chan = j;
 
                                alu.src[1].sel = 512 + i;
-                               alu.src[1].kc_bank = 1;
+                               alu.src[1].kc_bank = R600_UCP_CONST_BUFFER;
                                alu.src[1].chan = j;
 
                                alu.dst.sel = ctx.temp_reg + oreg;
index 7cd84bcac8138bf0489253b89177ea309fee8764..e7062c384a32961cb5dbd5233b76e676b9d934df 100644 (file)
@@ -218,7 +218,7 @@ static void r600_set_clip_state(struct pipe_context *ctx,
        cb.user_buffer = state->ucp;
        cb.buffer_offset = 0;
        cb.buffer_size = 4*4*8;
-       ctx->set_constant_buffer(ctx, PIPE_SHADER_VERTEX, 1, &cb);
+       ctx->set_constant_buffer(ctx, PIPE_SHADER_VERTEX, R600_UCP_CONST_BUFFER, &cb);
        pipe_resource_reference(&cb.buffer, NULL);
 }