int chipset;
- unsigned dirty;
+ /* HW state derived from pipe states */
+ struct nv40_state state;
+ unsigned fallback;
+ /* Context state */
+ unsigned dirty;
+ struct pipe_scissor_state scissor;
+ unsigned stipple[32];
+ struct pipe_clip_state clip;
+ struct nv40_vertex_program *vertprog;
+ struct nv40_fragment_program *fragprog;
+ struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+ struct nv40_rasterizer_state *rasterizer;
+ struct nv40_zsa_state *zsa;
+ struct nv40_blend_state *blend;
+ struct pipe_blend_color blend_colour;
+ struct pipe_viewport_state viewport;
+ struct pipe_framebuffer_state framebuffer;
+ struct pipe_buffer *idxbuf;
+ unsigned idxbuf_format;
struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
unsigned dirty_samplers;
-
- struct {
- struct pipe_scissor_state scissor;
- unsigned stipple[32];
- struct pipe_clip_state clip;
- struct nv40_vertex_program *vertprog;
- struct nv40_fragment_program *fragprog;
- struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
- struct nv40_rasterizer_state *rasterizer;
- struct nv40_zsa_state *zsa;
- struct nv40_blend_state *blend;
- struct pipe_blend_color blend_colour;
- struct pipe_viewport_state viewport;
- struct pipe_framebuffer_state framebuffer;
- struct pipe_buffer *idxbuf;
- unsigned idxbuf_format;
- } pipe_state;
-
- struct nv40_state state;
- unsigned fallback;
-
struct pipe_vertex_buffer vtxbuf[PIPE_ATTRIB_MAX];
struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX];
};
static boolean
nv40_fragprog_validate(struct nv40_context *nv40)
{
- struct nv40_fragment_program *fp = nv40->pipe_state.fragprog;
+ struct nv40_fragment_program *fp = nv40->fragprog;
struct pipe_buffer *constbuf =
- nv40->pipe_state.constbuf[PIPE_SHADER_FRAGMENT];
+ nv40->constbuf[PIPE_SHADER_FRAGMENT];
struct pipe_winsys *ws = nv40->pipe.winsys;
struct nouveau_stateobj *so;
int i;
static boolean
nv40_fragtex_validate(struct nv40_context *nv40)
{
- struct nv40_fragment_program *fp = nv40->pipe_state.fragprog;
+ struct nv40_fragment_program *fp = nv40->fragprog;
struct nv40_state *state = &nv40->state;
struct nouveau_stateobj *so;
unsigned samplers, unit;
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.blend = hwcso;
+ nv40->blend = hwcso;
nv40->dirty |= NV40_NEW_BLEND;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.rasterizer = hwcso;
+ nv40->rasterizer = hwcso;
nv40->dirty |= NV40_NEW_RAST;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.zsa = hwcso;
+ nv40->zsa = hwcso;
nv40->dirty |= NV40_NEW_ZSA;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.vertprog = hwcso;
+ nv40->vertprog = hwcso;
nv40->dirty |= NV40_NEW_VERTPROG;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.fragprog = hwcso;
+ nv40->fragprog = hwcso;
nv40->dirty |= NV40_NEW_FRAGPROG;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.blend_colour = *bcol;
+ nv40->blend_colour = *bcol;
nv40->dirty |= NV40_NEW_BCOL;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.clip = *clip;
+ nv40->clip = *clip;
nv40->dirty |= NV40_NEW_UCP;
}
struct nv40_context *nv40 = nv40_context(pipe);
if (shader == PIPE_SHADER_VERTEX) {
- nv40->pipe_state.constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
+ nv40->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
nv40->dirty |= NV40_NEW_VERTPROG;
} else
if (shader == PIPE_SHADER_FRAGMENT) {
- nv40->pipe_state.constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
+ nv40->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
nv40->dirty |= NV40_NEW_FRAGPROG;
}
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.framebuffer = *fb;
+ nv40->framebuffer = *fb;
nv40->dirty |= NV40_NEW_FB;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- memcpy(nv40->pipe_state.stipple, stipple->stipple, 4 * 32);
+ memcpy(nv40->stipple, stipple->stipple, 4 * 32);
nv40->dirty |= NV40_NEW_STIPPLE;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.scissor = *s;
+ nv40->scissor = *s;
nv40->dirty |= NV40_NEW_SCISSOR;
}
{
struct nv40_context *nv40 = nv40_context(pipe);
- nv40->pipe_state.viewport = *vpt;
+ nv40->viewport = *vpt;
nv40->dirty |= NV40_NEW_VIEWPORT;
}
static boolean
nv40_state_blend_validate(struct nv40_context *nv40)
{
- so_ref(nv40->pipe_state.blend->so, &nv40->state.hw[NV40_STATE_BLEND]);
+ so_ref(nv40->blend->so, &nv40->state.hw[NV40_STATE_BLEND]);
return TRUE;
}
nv40_state_blend_colour_validate(struct nv40_context *nv40)
{
struct nouveau_stateobj *so = so_new(2, 0);
- struct pipe_blend_color *bcol = &nv40->pipe_state.blend_colour;
+ struct pipe_blend_color *bcol = &nv40->blend_colour;
so_method(so, nv40->hw->curie, NV40TCL_BLEND_COLOR, 1);
so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) |
static boolean
nv40_state_clip_validate(struct nv40_context *nv40)
{
- if (nv40->pipe_state.clip.nr)
+ if (nv40->clip.nr)
nv40->fallback |= NV40_FALLBACK_TNL;
return FALSE;
static boolean
nv40_state_framebuffer_validate(struct nv40_context *nv40)
{
- struct pipe_framebuffer_state *fb = &nv40->pipe_state.framebuffer;
+ struct pipe_framebuffer_state *fb = &nv40->framebuffer;
struct pipe_surface *rt[4], *zeta;
uint32_t rt_enable, rt_format, w, h;
int i, colour_format = 0, zeta_format = 0;
static boolean
nv40_state_rasterizer_validate(struct nv40_context *nv40)
{
- so_ref(nv40->pipe_state.rasterizer->so,
+ so_ref(nv40->rasterizer->so,
&nv40->state.hw[NV40_STATE_RAST]);
return TRUE;
}
static boolean
nv40_state_scissor_validate(struct nv40_context *nv40)
{
- struct pipe_rasterizer_state *rast = &nv40->pipe_state.rasterizer->pipe;
- struct pipe_scissor_state *s = &nv40->pipe_state.scissor;
+ struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
+ struct pipe_scissor_state *s = &nv40->scissor;
struct nouveau_stateobj *so;
if (nv40->state.hw[NV40_STATE_SCISSOR] &&
static boolean
nv40_state_stipple_validate(struct nv40_context *nv40)
{
- struct pipe_rasterizer_state *rast = &nv40->pipe_state.rasterizer->pipe;
+ struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
struct nouveau_grobj *curie = nv40->hw->curie;
struct nouveau_stateobj *so;
so_data (so, 1);
so_method(so, curie, NV40TCL_POLYGON_STIPPLE_PATTERN(0), 32);
for (i = 0; i < 32; i++)
- so_data(so, nv40->pipe_state.stipple[i]);
+ so_data(so, nv40->stipple[i]);
} else {
so = so_new(2, 0);
so_method(so, curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
nv40_state_viewport_validate(struct nv40_context *nv40)
{
struct nouveau_stateobj *so = so_new(9, 0);
- struct pipe_viewport_state *vpt = &nv40->pipe_state.viewport;
+ struct pipe_viewport_state *vpt = &nv40->viewport;
so_method(so, nv40->hw->curie, NV40TCL_VIEWPORT_TRANSLATE_X, 8);
so_data (so, fui(vpt->translate[0]));
static boolean
nv40_state_zsa_validate(struct nv40_context *nv40)
{
- so_ref(nv40->pipe_state.zsa->so,
+ so_ref(nv40->zsa->so,
&nv40->state.hw[NV40_STATE_ZSA]);
return TRUE;
}
unsigned type;
if (!ib) {
- nv40->pipe_state.idxbuf = NULL;
- nv40->pipe_state.idxbuf_format = 0xdeadbeef;
+ nv40->idxbuf = NULL;
+ nv40->idxbuf_format = 0xdeadbeef;
return FALSE;
}
return FALSE;
}
- if (ib != nv40->pipe_state.idxbuf ||
- type != nv40->pipe_state.idxbuf_format) {
+ if (ib != nv40->idxbuf ||
+ type != nv40->idxbuf_format) {
nv40->dirty |= NV40_NEW_ARRAYS;
- nv40->pipe_state.idxbuf = ib;
- nv40->pipe_state.idxbuf_format = type;
+ nv40->idxbuf = ib;
+ nv40->idxbuf_format = type;
}
return TRUE;
static boolean
nv40_vbo_validate(struct nv40_context *nv40)
{
- struct nv40_vertex_program *vp = nv40->pipe_state.vertprog;
+ struct nv40_vertex_program *vp = nv40->vertprog;
struct nouveau_stateobj *vtxbuf, *vtxfmt;
- struct pipe_buffer *ib = nv40->pipe_state.idxbuf;
- unsigned ib_format = nv40->pipe_state.idxbuf_format;
+ struct pipe_buffer *ib = nv40->idxbuf;
+ unsigned ib_format = nv40->idxbuf_format;
unsigned inputs, hw, num_hw;
unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
static boolean
nv40_vertprog_validate(struct nv40_context *nv40)
{
- struct nv40_vertex_program *vp = nv40->pipe_state.vertprog;
+ struct nv40_vertex_program *vp = nv40->vertprog;
struct pipe_buffer *constbuf =
- nv40->pipe_state.constbuf[PIPE_SHADER_VERTEX];
+ nv40->constbuf[PIPE_SHADER_VERTEX];
struct nouveau_winsys *nvws = nv40->nvws;
struct pipe_winsys *ws = nv40->pipe.winsys;
boolean upload_code = FALSE, upload_data = FALSE;