summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_state.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-01-28 03:03:38 +0100
committerMarek Olšák <[email protected]>2011-01-30 03:29:48 +0100
commit02f8f134643f631364ca621fe0b6d6b72449e00c (patch)
treebf7352a45f9033373e76ff57aa693dc5c13c8436 /src/gallium/drivers/r600/r600_state.c
parentf8a7a0b6f30ff38b2743860cbc4caeab102c2c29 (diff)
r600g: add back u_upload_mgr integration
I can't see a performance difference with this code, which means all the driver-specific code removed in this commit was unnecessary. Now we use u_upload_mgr in a slightly different way than we did before it got dropped. I am not restoring the original code "as is" due to latest u_upload_mgr changes that r300g performance benefits from. This also fixes: - piglit/fp-kil
Diffstat (limited to 'src/gallium/drivers/r600/r600_state.c')
-rw-r--r--src/gallium/drivers/r600/r600_state.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index d678f42ad67..0191a119d5d 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1105,10 +1105,10 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
}
static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
- struct pipe_resource *buffer)
+ struct pipe_resource *buffer)
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+ struct r600_resource_buffer *rbuffer = r600_buffer(buffer);
uint32_t offset;
/* Note that the state tracker can unbind constant buffers by
@@ -1118,7 +1118,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
return;
}
- r600_upload_const_buffer(rctx, buffer, &offset);
+ r600_upload_const_buffer(rctx, &rbuffer, &offset);
switch (shader) {
case PIPE_SHADER_VERTEX:
@@ -1129,7 +1129,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
0xFFFFFFFF, NULL);
r600_pipe_state_add_reg(&rctx->vs_const_buffer,
R_028980_ALU_CONST_CACHE_VS_0,
- (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ (r600_bo_offset(rbuffer->r.bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->r.bo);
r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer);
break;
case PIPE_SHADER_FRAGMENT:
@@ -1140,13 +1140,16 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
0xFFFFFFFF, NULL);
r600_pipe_state_add_reg(&rctx->ps_const_buffer,
R_028940_ALU_CONST_CACHE_PS_0,
- (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ (r600_bo_offset(rbuffer->r.bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->r.bo);
r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer);
break;
default:
R600_ERR("unsupported %d\n", shader);
return;
}
+
+ if (!rbuffer->user_buffer)
+ pipe_resource_reference((struct pipe_resource**)&rbuffer, NULL);
}
void r600_init_state_functions(struct r600_pipe_context *rctx)