}
-static struct nouveau_stateobj *
+struct nouveau_stateobj *
nv30_fragtex_build(struct nvfx_context *nvfx, int unit)
{
struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
return so;
}
-static boolean
-nv30_fragtex_validate(struct nvfx_context *nvfx)
-{
- struct nvfx_fragment_program *fp = nvfx->fragprog;
- struct nvfx_state *state = &nvfx->state;
- struct nouveau_stateobj *so;
- unsigned samplers, unit;
-
- samplers = state->fp_samplers & ~fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = so_new(1, 1, 0);
- so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1);
- so_data (so, 0);
- so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
- }
-
- samplers = nvfx->dirty_samplers & fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = nv30_fragtex_build(nvfx, unit);
- so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
- }
-
- nvfx->state.fp_samplers = fp->samplers;
- return FALSE;
-}
-
-struct nvfx_state_entry nv30_state_fragtex = {
- .validate = nv30_fragtex_validate,
- .dirty = {
- .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG,
- .hw = 0
- }
-};
}
-static struct nouveau_stateobj *
+struct nouveau_stateobj *
nv40_fragtex_build(struct nvfx_context *nvfx, int unit)
{
struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
return so;
}
-
-static boolean
-nv40_fragtex_validate(struct nvfx_context *nvfx)
-{
- struct nvfx_fragment_program *fp = nvfx->fragprog;
- struct nvfx_state *state = &nvfx->state;
- struct nouveau_stateobj *so;
- unsigned samplers, unit;
-
- samplers = state->fp_samplers & ~fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = so_new(1, 1, 0);
- so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1);
- so_data (so, 0);
- so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
- state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
- }
-
- samplers = nvfx->dirty_samplers & fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = nv40_fragtex_build(nvfx, unit);
- so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
- }
-
- nvfx->state.fp_samplers = fp->samplers;
- return FALSE;
-}
-
-struct nvfx_state_entry nv40_state_fragtex = {
- .validate = nv40_fragtex_validate,
- .dirty = {
- .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG,
- .hw = 0
- }
-};
-
nvfx_clear.c \
nvfx_draw.c \
nvfx_fragprog.c \
+ nvfx_fragtex.c \
nvfx_miptree.c \
nvfx_query.c \
nvfx_screen.c \
extern struct nvfx_state_entry nvfx_state_blend;
extern struct nvfx_state_entry nvfx_state_blend_colour;
extern struct nvfx_state_entry nvfx_state_fragprog;
+extern struct nvfx_state_entry nvfx_state_fragtex;
extern struct nvfx_state_entry nvfx_state_framebuffer;
extern struct nvfx_state_entry nvfx_state_rasterizer;
extern struct nvfx_state_entry nvfx_state_scissor;
/* nv30_fragtex.c */
extern void nv30_init_sampler_functions(struct nvfx_context *nvfx);
extern void nv30_fragtex_bind(struct nvfx_context *);
-extern struct nvfx_state_entry nv30_state_fragtex;
+extern struct nouveau_stateobj *
+nv30_fragtex_build(struct nvfx_context *nvfx, int unit);
/* nv40_fragtex.c */
extern void nv40_init_sampler_functions(struct nvfx_context *nvfx);
extern void nv40_fragtex_bind(struct nvfx_context *);
-extern struct nvfx_state_entry nv40_state_fragtex;
+extern struct nouveau_stateobj *
+nv40_fragtex_build(struct nvfx_context *nvfx, int unit);
/* nvfx_state.c */
extern void nvfx_init_state_functions(struct nvfx_context *nvfx);
--- /dev/null
+#include "nvfx_context.h"
+
+static boolean
+nvfx_fragtex_validate(struct nvfx_context *nvfx)
+{
+ struct nvfx_fragment_program *fp = nvfx->fragprog;
+ struct nvfx_state *state = &nvfx->state;
+ struct nouveau_stateobj *so;
+ unsigned samplers, unit;
+
+ samplers = state->fp_samplers & ~fp->samplers;
+ while (samplers) {
+ unit = ffs(samplers) - 1;
+ samplers &= ~(1 << unit);
+
+ so = so_new(1, 1, 0);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1);
+ so_data (so, 0);
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
+ state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
+ }
+
+ samplers = nvfx->dirty_samplers & fp->samplers;
+ while (samplers) {
+ unit = ffs(samplers) - 1;
+ samplers &= ~(1 << unit);
+
+ if(!nvfx->is_nv4x)
+ so = nv30_fragtex_build(nvfx, unit);
+ else
+ so = nv40_fragtex_build(nvfx, unit);
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
+ state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
+ }
+
+ nvfx->state.fp_samplers = fp->samplers;
+ return FALSE;
+}
+
+struct nvfx_state_entry nvfx_state_fragtex = {
+ .validate = nvfx_fragtex_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG,
+ .hw = 0
+ }
+};
#include "nvfx_state.h"
#include "draw/draw_context.h"
-#define RENDER_STATES(name, nvxx, vbo) \
-static struct nvfx_state_entry *name##_render_states[] = { \
+#define RENDER_STATES(name, vbo) \
+static struct nvfx_state_entry *name##render_states[] = { \
&nvfx_state_framebuffer, \
&nvfx_state_rasterizer, \
&nvfx_state_scissor, \
&nvfx_state_stipple, \
&nvfx_state_fragprog, \
- &nvxx##_state_fragtex, \
+ &nvfx_state_fragtex, \
&nvfx_state_vertprog, \
&nvfx_state_blend, \
&nvfx_state_blend_colour, \
NULL \
}
-RENDER_STATES(nv30, nv30, vbo);
-RENDER_STATES(nv30_swtnl, nv30, vtxfmt);
-RENDER_STATES(nv40, nv40, vbo);
-RENDER_STATES(nv40_swtnl, nv40, vtxfmt);
+RENDER_STATES(, vbo);
+RENDER_STATES(swtnl_, vtxfmt);
static void
nvfx_state_do_validate(struct nvfx_context *nvfx,
nvfx->render_mode = HW;
}
- if(!nvfx->is_nv4x)
- nvfx_state_do_validate(nvfx, nv30_render_states);
- else
- nvfx_state_do_validate(nvfx, nv40_render_states);
+ nvfx_state_do_validate(nvfx, render_states);
if (nvfx->fallback_swtnl || nvfx->fallback_swrast)
return FALSE;
draw_set_vertex_elements(draw, nvfx->vtxelt->num_elements, nvfx->vtxelt->pipe);
}
- if(!nvfx->is_nv4x)
- nvfx_state_do_validate(nvfx, nv30_swtnl_render_states);
- else
- nvfx_state_do_validate(nvfx, nv40_swtnl_render_states);
+ nvfx_state_do_validate(nvfx, swtnl_render_states);
if (nvfx->fallback_swrast) {
NOUVEAU_ERR("swtnl->swrast 0x%08x\n", nvfx->fallback_swrast);