summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nvfx_fragprog.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-04-18 08:41:25 -0600
committerBrian Paul <[email protected]>2010-04-18 08:41:25 -0600
commitb74f4bc6b8fa68da398c63d9c6cfb67a7f87d628 (patch)
tree2bdb2610f274891499a3f52fb6a521b6c3860929 /src/gallium/drivers/nvfx/nvfx_fragprog.c
parentd84b8cb1a8e3ce846de9affe2f72457c6e698872 (diff)
nvfx: move declarations before code
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_fragprog.c')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_fragprog.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index 0a4f35ef8e7..6772d9bd516 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -846,6 +846,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
if (!fp->translated)
{
+ const int min_size = 4096;
+
nvfx_fragprog_translate(nvfx, fp);
if (!fp->translated) {
static unsigned dummy[8] = {1, 0, 0, 0, 1, 0, 0, 0};
@@ -866,7 +868,6 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
fp->prog_size = (fp->insn_len * 4 + 63) & ~63;
- int min_size = 4096;
if(fp->prog_size >= min_size)
fp->progs_per_bo = 1;
else
@@ -881,6 +882,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
update = TRUE;
if(update) {
+ int offset;
+
++fp->bo_prog_idx;
if(fp->bo_prog_idx >= fp->progs_per_bo)
{
@@ -891,6 +894,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
else
{
struct nvfx_fragment_program_bo* fpbo = os_malloc_aligned(sizeof(struct nvfx_fragment_program) + fp->prog_size * fp->progs_per_bo, 16);
+ char *map, *buf;
+
if(fp->fpbo)
{
fpbo->next = fp->fpbo->next;
@@ -903,8 +908,8 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
nouveau_bo_new(nvfx->screen->base.device, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 64, fp->prog_size * fp->progs_per_bo, &fpbo->bo);
nouveau_bo_map(fpbo->bo, NOUVEAU_BO_NOSYNC);
- char* map = fpbo->bo->map;
- char* buf = fpbo->insn;
+ map = fpbo->bo->map;
+ buf = fpbo->insn;
for(int i = 0; i < fp->progs_per_bo; ++i)
{
memcpy(buf, fp->insn, fp->insn_len * 4);
@@ -916,7 +921,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
fp->bo_prog_idx = 0;
}
- int offset = fp->bo_prog_idx * fp->prog_size;
+ offset = fp->bo_prog_idx * fp->prog_size;
if(nvfx->constbuf[PIPE_SHADER_FRAGMENT]) {
struct pipe_resource* constbuf = nvfx->constbuf[PIPE_SHADER_FRAGMENT];