diff options
author | Christian König <[email protected]> | 2012-07-24 18:50:49 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2012-07-30 14:45:08 +0200 |
commit | d51b9b70d581fe47370897ec517f229f1cea2903 (patch) | |
tree | cb545a1e7c92b0d0fec86327d51b9afecd0b3dea /src/gallium/drivers/radeonsi/radeonsi_shader.c | |
parent | fe41287ffa8cb35421cadfb16d4cc27c5fcb8b76 (diff) |
radeonsi: fix shader size and handling
We should always upload the shader here.
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 70081370b3e..cc4777ffd4d 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -554,6 +554,7 @@ int si_pipe_shader_create( unsigned char * inst_bytes; unsigned inst_byte_count; unsigned i; + uint32_t *ptr; bool dump; dump = debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE); @@ -608,23 +609,22 @@ int si_pipe_shader_create( tgsi_parse_free(&si_shader_ctx.parse); /* copy new shader */ + si_resource_reference(&shader->bo, NULL); + shader->bo = si_resource_create_custom(ctx->screen, PIPE_USAGE_IMMUTABLE, + inst_byte_count - 12); if (shader->bo == NULL) { - uint32_t *ptr; + return -ENOMEM; + } - shader->bo = si_resource_create_custom(ctx->screen, PIPE_USAGE_IMMUTABLE, inst_byte_count); - if (shader->bo == NULL) { - return -ENOMEM; - } - ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); - if (0 /*R600_BIG_ENDIAN*/) { - for (i = 0; i < (inst_byte_count-12)/4; ++i) { - ptr[i] = util_bswap32(*(uint32_t*)(inst_bytes+12 + i*4)); - } - } else { - memcpy(ptr, inst_bytes + 12, inst_byte_count - 12); + ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE); + if (0 /*R600_BIG_ENDIAN*/) { + for (i = 0; i < (inst_byte_count-12)/4; ++i) { + ptr[i] = util_bswap32(*(uint32_t*)(inst_bytes+12 + i*4)); } - rctx->ws->buffer_unmap(shader->bo->cs_buf); + } else { + memcpy(ptr, inst_bytes + 12, inst_byte_count - 12); } + rctx->ws->buffer_unmap(shader->bo->cs_buf); free(inst_bytes); |