r600g: Put shaders into immutable buffers.
authorMathias Fröhlich <Mathias.Froehlich@web.de>
Fri, 3 Jun 2011 22:21:29 +0000 (00:21 +0200)
committerAlex Deucher <alexdeucher@gmail.com>
Mon, 13 Jun 2011 15:33:20 +0000 (11:33 -0400)
Put the shader programs into an immutable buffer object.
Also make sure that those object can be taken from the user
space buffer object pool.

src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_shader.c

index 3196d97dbbb4cbeda4512d30ee84f1d89fd8b87f..aeb1175958c2370a91307d0f5f164a9144fc303e 100644 (file)
@@ -2258,7 +2258,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
        ve->fs_size = bc.ndw*4;
 
        /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
-       ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, PIPE_BIND_VERTEX_BUFFER, 0);
+       ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE);
        if (ve->fetch_shader == NULL) {
                r600_bc_clear(&bc);
                return -ENOMEM;
index 39e6d85d7b4acfa154e0f19fd1ec980d2db89a63..d111caa64493833cd5191a42faeba9d843407c28 100644 (file)
@@ -85,7 +85,8 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s
 
        /* copy new shader */
        if (shader->bo == NULL) {
-               shader->bo = r600_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0, 0);
+               /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
+               shader->bo = r600_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE);
                if (shader->bo == NULL) {
                        return -ENOMEM;
                }