summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_state.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 0f46afb882b..e1e1af039bb 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -121,7 +121,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
boolean emit_common_func = cso->rt[0].blend_enable;
uint32_t ms;
- if (nv50_context(pipe)->screen->tesla->grclass >= NVA3_3D) {
+ if (nv50_context(pipe)->screen->tesla->oclass >= NVA3_3D_CLASS) {
SB_BEGIN_3D(so, BLEND_INDEPENDENT, 1);
SB_DATA (so, cso->independent_blend_enable);
}
@@ -142,7 +142,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
emit_common_func = TRUE;
}
- if (nv50_context(pipe)->screen->tesla->grclass >= NVA3_3D) {
+ if (nv50_context(pipe)->screen->tesla->oclass >= NVA3_3D_CLASS) {
emit_common_func = FALSE;
for (i = 0; i < 8; ++i) {
@@ -628,7 +628,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s,
nv50->num_textures[s] = nr;
- nv50_bufctx_reset(nv50, NV50_BUFCTX_TEXTURES);
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_TEXTURES);
nv50->dirty |= NV50_NEW_TEXTURES;
}
@@ -741,13 +741,15 @@ nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
{
struct nv50_context *nv50 = nv50_context(pipe);
- if (nv50->constbuf[shader][index])
- nv50_bufctx_del_resident(nv50, NV50_BUFCTX_CONSTANT,
- nv04_resource(nv50->constbuf[shader][index]));
-
pipe_resource_reference(&nv50->constbuf[shader][index], res);
nv50->constbuf_dirty[shader] |= 1 << index;
+ if (res)
+ nv50->constbuf_valid[shader] |= 1 << index;
+ else
+ nv50->constbuf_valid[shader] &= ~(1 << index);
+
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_CB(shader, index));
nv50->dirty |= NV50_NEW_CONSTBUF;
}
@@ -802,6 +804,8 @@ nv50_set_framebuffer_state(struct pipe_context *pipe,
{
struct nv50_context *nv50 = nv50_context(pipe);
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_FB);
+
nv50->framebuffer = *fb;
nv50->dirty |= NV50_NEW_FRAMEBUFFER;
}
@@ -852,7 +856,7 @@ nv50_set_vertex_buffers(struct pipe_context *pipe,
memcpy(nv50->vtxbuf, vb, sizeof(*vb) * count);
nv50->num_vtxbufs = count;
- nv50_bufctx_reset(nv50, NV50_BUFCTX_VERTEX);
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_VERTEX);
nv50->dirty |= NV50_NEW_ARRAYS;
}
@@ -863,10 +867,15 @@ nv50_set_index_buffer(struct pipe_context *pipe,
{
struct nv50_context *nv50 = nv50_context(pipe);
- if (ib) {
- pipe_resource_reference(&nv50->idxbuf.buffer, ib->buffer);
+ if (nv50->idxbuf.buffer)
+ nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_INDEX);
- memcpy(&nv50->idxbuf, ib, sizeof(nv50->idxbuf));
+ if (ib && ib->buffer) {
+ pipe_resource_reference(&nv50->idxbuf.buffer, ib->buffer);
+ nv50->idxbuf.offset = ib->offset;
+ nv50->idxbuf.index_size = ib->index_size;
+ if (nouveau_resource_mapped_by_gpu(ib->buffer))
+ BCTX_REFN(nv50->bufctx_3d, INDEX, nv04_resource(ib->buffer), RD);
} else {
pipe_resource_reference(&nv50->idxbuf.buffer, NULL);
}