summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-02-18 18:23:12 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-02-18 18:23:12 +1100
commitc0f9cab905f3f54cc01bf947665f8a731b8cb347 (patch)
tree92b71dba7535052dc4988e0bc0e21b83f16245ee /src/gallium/drivers
parent9a5dd26fe22c37b85787130a2b724e6e8ef4f553 (diff)
nouveau: cleanups + fixes
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h21
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c8
2 files changed, 14 insertions, 15 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 07c31b014a..459cc7d77a 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -45,22 +45,19 @@ so_new(unsigned push, unsigned reloc)
static INLINE void
so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
{
- struct nouveau_stateobj *so;
-
- so = *pso;
- if (so) {
- if (--so->refcount <= 0) {
- free(so->push);
- free(so->reloc);
- free(so);
- }
- *pso = NULL;
- }
+ struct nouveau_stateobj *so = *pso;
if (ref) {
ref->refcount++;
- *pso = ref;
}
+
+ if (so && --so->refcount <= 0) {
+ free(so->push);
+ free(so->reloc);
+ free(so);
+ }
+
+ *pso = ref;
}
static INLINE void
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
index e702b10323..e8230111bb 100644
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ b/src/gallium/drivers/nv40/nv40_state_emit.c
@@ -103,8 +103,10 @@ nv40_emit_hw_state(struct nv40_context *nv40)
nv40->hw_dirty &= ~NV40_NEW_STIPPLE;
}
- if (nv40->hw_dirty & NV40_NEW_FRAGPROG)
+ if (nv40->hw_dirty & NV40_NEW_FRAGPROG) {
so_emit(nv40->nvws, nv40->state.fragprog);
+ nv40->hw_dirty &= ~NV40_NEW_FRAGPROG;
+ }
if (nv40->dirty_samplers || (nv40->dirty & NV40_NEW_FRAGPROG)) {
nv40_fragtex_bind(nv40);
@@ -116,9 +118,9 @@ nv40_emit_hw_state(struct nv40_context *nv40)
nv40->dirty &= ~NV40_NEW_FRAGPROG;
}
- if (nv40->dirty & NV40_NEW_VERTPROG) {
+ if (nv40->hw_dirty & NV40_NEW_VERTPROG) {
so_emit(nv40->nvws, nv40->state.vertprog);
- nv40->dirty &= ~NV40_NEW_VERTPROG;
+ nv40->hw_dirty &= ~NV40_NEW_VERTPROG;
}
nv40->dirty_samplers = 0;