nvfx: move check for NOUVEAU_SWTNL
authorLuca Barbieri <luca@luca-barbieri.com>
Mon, 12 Apr 2010 16:06:06 +0000 (18:06 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Mon, 12 Apr 2010 16:06:06 +0000 (18:06 +0200)
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/nvfx/nvfx_screen.h
src/gallium/drivers/nvfx/nvfx_vbo.c

index 893086cae85f465046dbde01b5412f1fded43685..cf619f24a1caf18761a0a7a2693ebe828bd19308 100644 (file)
@@ -371,6 +371,8 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
                return NULL;
        }
 
+       screen->force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", FALSE);
+
        nvfx_screen_init_resource_functions(pscreen);
        nvfx_screen_init_buffer_functions(screen);
 
index 14bd6339206468a84cd3b4269d712e45ac98cbd0..ba9a6993ece14c42675e63d41bb6f128a40f7005 100644 (file)
@@ -14,6 +14,7 @@ struct nvfx_screen {
 
        unsigned is_nv4x; /* either 0 or ~0 */
        int vertex_buffer_flags;
+       boolean force_swtnl;
 
        /* HW graphics objects */
        struct nv04_surface_2d *eng2d;
index 74de3a799e1e4174565dfaec9687e0791b4f6983..8c71aa3d1b16feb606ea4595d0b83c240b79bbc5 100644 (file)
 #include "nouveau/nouveau_pushbuf.h"
 #include "nouveau/nouveau_util.h"
 
-static boolean
-nvfx_force_swtnl(struct nvfx_context *nvfx)
-{
-       static int force_swtnl = -1;
-       if(force_swtnl < 0)
-               force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", 0);
-       return force_swtnl;
-}
-
 static INLINE int
 nvfx_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
 {
@@ -166,7 +157,7 @@ nvfx_draw_arrays(struct pipe_context *pipe,
        unsigned restart = 0;
 
        nvfx_vbo_set_idxbuf(nvfx, NULL, 0);
-       if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+       if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
                nvfx_draw_elements_swtnl(pipe, NULL, 0,
                                            mode, start, count);
                 return;
@@ -467,7 +458,7 @@ nvfx_draw_elements(struct pipe_context *pipe,
        boolean idxbuf;
 
        idxbuf = nvfx_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
-       if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+       if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
                nvfx_draw_elements_swtnl(pipe, indexBuffer, indexSize,
                                            mode, start, count);
                return;