diff options
author | Dave Airlie <[email protected]> | 2010-09-08 08:41:57 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-09-08 08:41:57 +1000 |
commit | d42efb9e8df6ef872ab4f142e3daf1b6cb9eff11 (patch) | |
tree | bd6cd1754fdddb6a730ad4fe61478187419df78e /src/gallium/drivers/r600/r600_shader.c | |
parent | 9ef1c51be16ea360481cf9f82ebb1e3eb01efb18 (diff) |
r600g: add support for constants in memory buffers.
DX9 constants were in the constant file, and evergreen no longer support
cfile. r600/700 can also use constants in memory buffers, so add the code
(disabled for now) to enable that as precursor for evergreen.
Diffstat (limited to 'src/gallium/drivers/r600/r600_shader.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1273cd62a28..b643157f56a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -113,6 +113,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx, if (rpshader == NULL) return -ENOMEM; rpshader->shader.family = radeon_get_family(rscreen->rw); + rpshader->shader.use_mem_constant = rscreen->use_mem_constant; r = r600_shader_from_tgsi(tokens, &rpshader->shader); if (r) { R600_ERR("translation from TGSI failed !\n"); @@ -311,6 +312,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s r = r600_bc_init(ctx.bc, shader->family); if (r) return r; + ctx.bc->use_mem_constant = shader->use_mem_constant; ctx.tokens = tokens; tgsi_scan_shader(tokens, &ctx.info); tgsi_parse_init(&ctx.parse, tokens); @@ -346,7 +348,11 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s ctx.info.file_count[TGSI_FILE_INPUT]; ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] + ctx.info.file_count[TGSI_FILE_OUTPUT]; - ctx.file_offset[TGSI_FILE_CONSTANT] = 256; + if (ctx.shader->use_mem_constant) + ctx.file_offset[TGSI_FILE_CONSTANT] = 128; + else + ctx.file_offset[TGSI_FILE_CONSTANT] = 256; + ctx.file_offset[TGSI_FILE_IMMEDIATE] = 253; ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] + ctx.info.file_count[TGSI_FILE_TEMPORARY]; |