diff options
author | Stephane Marchesin <marchesin@icps.u-strasbg.fr> | 2006-11-21 12:43:16 +0000 |
---|---|---|
committer | Stephane Marchesin <marchesin@icps.u-strasbg.fr> | 2006-11-21 12:43:16 +0000 |
commit | 0ea45b1ad822ebdce2af3faef77ed776ca32d46b (patch) | |
tree | d4a47f1d784544d8fdb40d15d86e9c1170cf3394 /src/mesa/drivers/dri | |
parent | a20cf73053c2c834abe971c9dc824f14c31884fb (diff) |
Add the state caching mechanism. It seems to work, from what I can see.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/Makefile | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_fifo.h | 37 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_state.c | 104 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_state_cache.c | 64 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_state_cache.h | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_state.c | 260 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 53 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv20_state.c | 268 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv30_state.c | 284 |
10 files changed, 605 insertions, 496 deletions
diff --git a/src/mesa/drivers/dri/nouveau/Makefile b/src/mesa/drivers/dri/nouveau/Makefile index 2db6f8989d1..4d1e3e6c70c 100644 --- a/src/mesa/drivers/dri/nouveau/Makefile +++ b/src/mesa/drivers/dri/nouveau/Makefile @@ -22,7 +22,8 @@ DRIVER_SOURCES = \ nv10_swtcl.c \ nv10_state.c \ nv20_state.c \ - nv30_state.c + nv30_state.c \ + nouveau_state_cache.c C_SOURCES = \ $(COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 09972bebac4..8ae7be015dc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -37,6 +37,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_vertex.h" #include "nouveau_screen.h" +#include "nouveau_state_cache.h" #include "xmlconfig.h" @@ -73,7 +74,6 @@ typedef void (*nouveau_line_func)( struct nouveau_context*, typedef void (*nouveau_point_func)( struct nouveau_context*, nouveauVertex * ); - typedef struct nouveau_context { /* Mesa context */ GLcontext *glCtx; @@ -102,6 +102,9 @@ typedef struct nouveau_context { GLboolean lighting_enabled; uint32_t enabled_lights; + /* Cached state */ + nouveau_state_cache state_cache; + /* The drawing fallbacks */ GLuint Fallback; nouveau_tri_func draw_tri; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h index da2dadada74..259e5a1dc76 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h @@ -45,7 +45,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Ring/fifo interface * * - Begin a ring section with BEGIN_RING_SIZE (if you know the full size in advance) - * - Begin a ring section with BEGIN_RING_PRIM otherwise (and then finish with FINISH_RING_PRIM) * - Output stuff to the ring with either OUT_RINGp (outputs a raw mem chunk), OUT_RING (1 uint32_t) or OUT_RINGf (1 float) * - RING_AVAILABLE returns the available fifo (in uint32_ts) * - RING_AHEAD returns how much ahead of the last submission point we are @@ -59,7 +58,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef NOUVEAU_RING_DEBUG #define OUT_RINGp(ptr,sz) do { \ -uint32_t* p=(uint32_t*)ptr; \ +uint32_t* p=(uint32_t*)(ptr); \ int i; printf("OUT_RINGp: (size 0x%x dwords)\n",sz); for(i=0;i<sz;i++) printf(" 0x%08x\n", *(p+i)); \ }while(0) @@ -74,33 +73,47 @@ int i; printf("OUT_RINGp: (size 0x%x dwords)\n",sz); for(i=0;i<sz;i++) printf(" #else #define OUT_RINGp(ptr,sz) do{ \ - memcpy(nmesa->fifo.buffer+nmesa->fifo.current,ptr,sz*4); \ - nmesa->fifo.current+=sz; \ + memcpy(nmesa->fifo.buffer+nmesa->fifo.current,ptr,(sz)*4); \ + nmesa->fifo.current+=(sz); \ }while(0) #define OUT_RING(n) do { \ -nmesa->fifo.buffer[nmesa->fifo.current++]=n; \ +nmesa->fifo.buffer[nmesa->fifo.current++]=(n); \ }while(0) #define OUT_RINGf(n) do { \ -*((float*)(nmesa->fifo.buffer+nmesa->fifo.current++))=n; \ +*((float*)(nmesa->fifo.buffer+nmesa->fifo.current++))=(n); \ }while(0) #endif extern void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size); +extern void nouveau_state_cache_flush(nouveauContextPtr nmesa); +extern void nouveau_state_cache_init(nouveauContextPtr nmesa); -#define BEGIN_RING_PRIM(subchannel,tag,size) do { \ - if (nmesa->fifo.free<size) \ - WAIT_RING(nmesa,(size)); \ - OUT_RING( ((subchannel) << 13) | (tag)); \ +#define BEGIN_RING_CACHE(subchannel,tag,size) do { \ + nmesa->state_cache.dirty=1; \ + nmesa->state_cache.current_pos=((tag)/4); \ +}while(0) + +#define OUT_RING_CACHE(n) do { \ + if (nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value!=(n)) { \ + nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \ + nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value=(n); \ + } \ + nmesa->state_cache.current_pos++; \ }while(0) -#define FINISH_RING_PRIM() do{ \ - nmesa->fifo.buffer[nmesa->fifo.put]|=((nmesa->fifo.current-nmesa->fifo.put) << 18); \ +#define OUT_RING_CACHEf(n) do { \ + if ((*(float*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))!=(n)){ \ + nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \ + (*(float*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))=(n);\ + } \ + nmesa->state_cache.current_pos++; \ }while(0) #define BEGIN_RING_SIZE(subchannel,tag,size) do { \ + nouveau_state_cache_flush(nmesa); \ if (nmesa->fifo.free <= (size)) \ WAIT_RING(nmesa,(size)); \ OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 9811606311f..2f8f3248ce6 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -108,8 +108,6 @@ static void nouveauDDUpdateHWState(GLcontext *ctx) if ( new_state || nmesa->new_render_state & _NEW_TEXTURE ) { - FINISH_RING_PRIM(); - nmesa->new_state = 0; /* Update the various parts of the context's state. @@ -174,6 +172,7 @@ void nouveauDDInitState(nouveauContextPtr nmesa) default: break; } + nouveau_state_cache_init(nmesa); } /* Initialize the driver's state functions */ @@ -231,95 +230,98 @@ void nouveauDDInitStateFuncs(GLcontext *ctx) ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; } +#define STATE_INIT(a) if (ctx->Driver.a) ctx->Driver.a + void nouveauInitState(GLcontext *ctx) { /* * Mesa should do this for us: */ - ctx->Driver.AlphaFunc( ctx, + + STATE_INIT(AlphaFunc)( ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); - ctx->Driver.BlendColor( ctx, + STATE_INIT(BlendColor)( ctx, ctx->Color.BlendColor ); - ctx->Driver.BlendEquationSeparate( ctx, + STATE_INIT(BlendEquationSeparate)( ctx, ctx->Color.BlendEquationRGB, ctx->Color.BlendEquationA); - ctx->Driver.BlendFuncSeparate( ctx, + STATE_INIT(BlendFuncSeparate)( ctx, ctx->Color.BlendSrcRGB, ctx->Color.BlendDstRGB, ctx->Color.BlendSrcA, ctx->Color.BlendDstA); - ctx->Driver.ColorMask( ctx, + STATE_INIT(ColorMask)( ctx, ctx->Color.ColorMask[RCOMP], ctx->Color.ColorMask[GCOMP], ctx->Color.ColorMask[BCOMP], ctx->Color.ColorMask[ACOMP]); - ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode ); - ctx->Driver.DepthFunc( ctx, ctx->Depth.Func ); - ctx->Driver.DepthMask( ctx, ctx->Depth.Mask ); - - ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled ); - ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled ); - ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled ); - ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled ); - ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag ); - ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test ); - ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag ); - ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled ); - ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled ); - ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); - ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag ); - ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled ); - ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled ); - ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE ); - ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE ); - ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE ); - ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE ); - ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE ); - - ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color ); - ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 ); - ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); - ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start ); - ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End ); - - ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace ); + STATE_INIT(CullFace)( ctx, ctx->Polygon.CullFaceMode ); + STATE_INIT(DepthFunc)( ctx, ctx->Depth.Func ); + STATE_INIT(DepthMask)( ctx, ctx->Depth.Mask ); + + STATE_INIT(Enable)( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled ); + STATE_INIT(Enable)( ctx, GL_BLEND, ctx->Color.BlendEnabled ); + STATE_INIT(Enable)( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled ); + STATE_INIT(Enable)( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled ); + STATE_INIT(Enable)( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag ); + STATE_INIT(Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test ); + STATE_INIT(Enable)( ctx, GL_DITHER, ctx->Color.DitherFlag ); + STATE_INIT(Enable)( ctx, GL_FOG, ctx->Fog.Enabled ); + STATE_INIT(Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled ); + STATE_INIT(Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); + STATE_INIT(Enable)( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag ); + STATE_INIT(Enable)( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled ); + STATE_INIT(Enable)( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled ); + STATE_INIT(Enable)( ctx, GL_TEXTURE_1D, GL_FALSE ); + STATE_INIT(Enable)( ctx, GL_TEXTURE_2D, GL_FALSE ); + STATE_INIT(Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE ); + STATE_INIT(Enable)( ctx, GL_TEXTURE_3D, GL_FALSE ); + STATE_INIT(Enable)( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE ); + + STATE_INIT(Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color ); + STATE_INIT(Fogfv)( ctx, GL_FOG_MODE, 0 ); + STATE_INIT(Fogfv)( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); + STATE_INIT(Fogfv)( ctx, GL_FOG_START, &ctx->Fog.Start ); + STATE_INIT(Fogfv)( ctx, GL_FOG_END, &ctx->Fog.End ); + + STATE_INIT(FrontFace)( ctx, ctx->Polygon.FrontFace ); { GLfloat f = (GLfloat)ctx->Light.Model.ColorControl; - ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f ); + STATE_INIT(LightModelfv)( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f ); } - ctx->Driver.LineWidth( ctx, ctx->Line.Width ); - ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); - ctx->Driver.PointSize( ctx, ctx->Point.Size ); - ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple ); - ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y, + STATE_INIT(LineWidth)( ctx, ctx->Line.Width ); + STATE_INIT(LogicOpcode)( ctx, ctx->Color.LogicOp ); + STATE_INIT(PointSize)( ctx, ctx->Point.Size ); + STATE_INIT(PolygonStipple)( ctx, (const GLubyte *)ctx->PolygonStipple ); + STATE_INIT(Scissor)( ctx, ctx->Scissor.X, ctx->Scissor.Y, ctx->Scissor.Width, ctx->Scissor.Height ); - ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel ); - ctx->Driver.StencilFuncSeparate( ctx, GL_FRONT, + STATE_INIT(ShadeModel)( ctx, ctx->Light.ShadeModel ); + STATE_INIT(StencilFuncSeparate)( ctx, GL_FRONT, ctx->Stencil.Function[0], ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0] ); - ctx->Driver.StencilFuncSeparate( ctx, GL_BACK, + STATE_INIT(StencilFuncSeparate)( ctx, GL_BACK, ctx->Stencil.Function[1], ctx->Stencil.Ref[1], ctx->Stencil.ValueMask[1] ); - ctx->Driver.StencilMaskSeparate( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] ); - ctx->Driver.StencilMaskSeparate( ctx, GL_BACK, ctx->Stencil.WriteMask[1] ); - ctx->Driver.StencilOpSeparate( ctx, GL_FRONT, + STATE_INIT(StencilMaskSeparate)( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] ); + STATE_INIT(StencilMaskSeparate)( ctx, GL_BACK, ctx->Stencil.WriteMask[1] ); + STATE_INIT(StencilOpSeparate)( ctx, GL_FRONT, ctx->Stencil.FailFunc[0], ctx->Stencil.ZFailFunc[0], ctx->Stencil.ZPassFunc[0]); - ctx->Driver.StencilOpSeparate( ctx, GL_BACK, + STATE_INIT(StencilOpSeparate)( ctx, GL_BACK, ctx->Stencil.FailFunc[1], ctx->Stencil.ZFailFunc[1], ctx->Stencil.ZPassFunc[1]); - ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] ); + STATE_INIT(DrawBuffer)( ctx, ctx->Color.DrawBuffer[0] ); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state_cache.c b/src/mesa/drivers/dri/nouveau/nouveau_state_cache.c new file mode 100644 index 00000000000..36f0c1024b6 --- /dev/null +++ b/src/mesa/drivers/dri/nouveau/nouveau_state_cache.c @@ -0,0 +1,64 @@ + +#include "nouveau_state_cache.h" +#include "nouveau_context.h" +#include "nouveau_object.h" +#include "nouveau_fifo.h" + +#define BEGIN_RING_NOFLUSH(subchannel,tag,size) do { \ + if (nmesa->fifo.free <= (size)) \ + WAIT_RING(nmesa,(size)); \ + OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \ + nmesa->fifo.free -= ((size) + 1); \ +}while(0) + +// flush all the dirty state +void nouveau_state_cache_flush(nouveauContextPtr nmesa) +{ + int i=0; + int run=0; + + // fast-path no state changes + if (!nmesa->state_cache.dirty) + return; + nmesa->state_cache.dirty=0; + + do + { + // jump to a dirty state + while((nmesa->state_cache.atoms[i].dirty==0)&&(i<NOUVEAU_STATE_CACHE_ENTRIES)) + i++; + + // figure out a run of dirty values + run=0; + while((nmesa->state_cache.atoms[i+run].dirty)&&(i+run<NOUVEAU_STATE_CACHE_ENTRIES)) + run++; + + // output everything as a single run + if (run>0) { + int j; + + BEGIN_RING_NOFLUSH(NvSub3D, i*4, run); + for(j=0;j<run;j++) + { + OUT_RING(nmesa->state_cache.atoms[i+j].value); + nmesa->state_cache.atoms[i+j].dirty=0; + } + i+=run; + } + } + while(i<NOUVEAU_STATE_CACHE_ENTRIES); +} + + +// inits the state cache +void nouveau_state_cache_init(nouveauContextPtr nmesa) +{ + int i; + for(i=0;i<NOUVEAU_STATE_CACHE_ENTRIES;i++) + { + nmesa->state_cache.atoms[i].dirty=0; + nmesa->state_cache.atoms[i].value=0xDEADBEEF; // nvidia cards like beef + } + nmesa->state_cache.dirty=0; +} + diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state_cache.h b/src/mesa/drivers/dri/nouveau/nouveau_state_cache.h new file mode 100644 index 00000000000..24882748468 --- /dev/null +++ b/src/mesa/drivers/dri/nouveau/nouveau_state_cache.h @@ -0,0 +1,23 @@ + +#ifndef __NOUVEAU_STATE_CACHE_H__ +#define __NOUVEAU_STATE_CACHE_H__ + +#include "mtypes.h" + +#define NOUVEAU_STATE_CACHE_ENTRIES 2048 + +typedef struct nouveau_state_atom_t{ + uint32_t value; + uint32_t dirty; +}nouveau_state_atom; + +typedef struct nouveau_state_cache_t{ + nouveau_state_atom atoms[NOUVEAU_STATE_CACHE_ENTRIES]; + uint32_t current_pos; + // master dirty flag + uint32_t dirty; +}nouveau_state_cache; + + +#endif + diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index 368235ac585..0d19ce94af4 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -40,9 +40,9 @@ void nv10AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) GLubyte ubRef; CLAMPED_FLOAT_TO_UBYTE(ubRef, ref); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); - OUT_RING(func); /* NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ - OUT_RING(ubRef); /* NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); + OUT_RING_CACHE(func); /* NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ + OUT_RING_CACHE(ubRef); /* NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ } void nv10BlendColor(GLcontext *ctx, const GLfloat color[4]) @@ -55,15 +55,15 @@ void nv10BlendColor(GLcontext *ctx, const GLfloat color[4]) CLAMPED_FLOAT_TO_UBYTE(cf[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(cf[3], color[3]); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); - OUT_RING(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); + OUT_RING_CACHE(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); } void nv10BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB, GLenum modeA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); - OUT_RING((modeA<<16) | modeRGB); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); + OUT_RING_CACHE((modeA<<16) | modeRGB); } @@ -71,9 +71,9 @@ void nv10BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); - OUT_RING((sfactorA<<16) | sfactorRGB); - OUT_RING((dfactorA<<16) | dfactorRGB); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); + OUT_RING_CACHE((sfactorA<<16) | sfactorRGB); + OUT_RING_CACHE((dfactorA<<16) | dfactorRGB); } /* @@ -82,16 +82,16 @@ void nv30ClearColor(GLcontext *ctx, const GLfloat color[4]) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); GLubyte c[4]; UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,color); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); - OUT_RING(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); + OUT_RING_CACHE(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); } void nv30ClearDepth(GLcontext *ctx, GLclampd d) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8)); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } */ @@ -104,19 +104,19 @@ void nv30ClearStencil(GLcontext *ctx, GLint s) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF)); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } */ void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); - OUT_RINGf(equation[0]); - OUT_RINGf(equation[1]); - OUT_RINGf(equation[2]); - OUT_RINGf(equation[3]); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); + OUT_RING_CACHEf(equation[0]); + OUT_RING_CACHEf(equation[1]); + OUT_RING_CACHEf(equation[2]); + OUT_RING_CACHEf(equation[3]); } /* Seems does not support alpha in color mask */ @@ -124,8 +124,8 @@ void nv10ColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_COLOR_MASK, 1); - OUT_RING(/*((amask && 0x01) << 24) |*/ ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_COLOR_MASK, 1); + OUT_RING_CACHE(/*((amask && 0x01) << 24) |*/ ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); } void nv10ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) @@ -136,37 +136,37 @@ void nv10ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) void nv10CullFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE, 1); + OUT_RING_CACHE(mode); } void nv10FrontFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FRONT_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FRONT_FACE, 1); + OUT_RING_CACHE(mode); } void nv10DepthFunc(GLcontext *ctx, GLenum func) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); - OUT_RING(func); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); + OUT_RING_CACHE(func); } void nv10DepthMask(GLcontext *ctx, GLboolean flag) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); - OUT_RING(flag); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); + OUT_RING_CACHE(flag); } void nv10DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); - OUT_RINGf(nearval); - OUT_RINGf(farval); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); + OUT_RING_CACHEf(nearval); + OUT_RING_CACHEf(farval); } /** Specify the current buffer for writing */ @@ -180,13 +180,13 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) switch(cap) { case GL_ALPHA_TEST: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_AUTO_NORMAL: case GL_BLEND: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_BLEND_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: @@ -194,12 +194,12 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); + OUT_RING_CACHE(state); break; case GL_COLOR_LOGIC_OP: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_COLOR_MATERIAL: // case GL_COLOR_SUM_EXT: @@ -207,20 +207,20 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_CONVOLUTION_1D: // case GL_CONVOLUTION_2D: case GL_CULL_FACE: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DEPTH_TEST: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DITHER: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_FOG: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_HISTOGRAM: // case GL_INDEX_LOGIC_OP: @@ -237,22 +237,22 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) nmesa->enabled_lights=((nmesa->enabled_lights&mask)|(mask*state)); if (nmesa->lighting_enabled) { - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); - OUT_RING(nmesa->enabled_lights); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + OUT_RING_CACHE(nmesa->enabled_lights); } break; } case GL_LIGHTING: nmesa->lighting_enabled=state; - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); if (nmesa->lighting_enabled) - OUT_RING(nmesa->enabled_lights); + OUT_RING_CACHE(nmesa->enabled_lights); else - OUT_RING(0x0); + OUT_RING_CACHE(0x0); break; case GL_LINE_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_LINE_STIPPLE: // case GL_MAP1_COLOR_4: @@ -275,29 +275,29 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_MAP2_VERTEX_4: // case GL_MINMAX: case GL_NORMALIZE: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POINT_SMOOTH: case GL_POLYGON_OFFSET_POINT: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_LINE: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_FILL: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POINT_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POINT_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POINT_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POLYGON_STIPPLE: // case GL_POST_COLOR_MATRIX_COLOR_TABLE: @@ -306,8 +306,8 @@ void nv10Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_SCISSOR_TEST: // case GL_SEPARABLE_2D: case GL_STENCIL_TEST: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_TEXTURE_GEN_Q: // case GL_TEXTURE_GEN_R: @@ -325,8 +325,8 @@ void nv10Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *params) switch(pname) { case GL_FOG_MODE: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FOG_MODE, 1); - //OUT_RING (params); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_FOG_MODE, 1); + //OUT_RING_CACHE (params); break; /* TODO: unsure about the rest.*/ default: @@ -349,60 +349,60 @@ void nv10Lightfv(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *para switch(pname) { case GL_AMBIENT: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_AMBIENT(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_AMBIENT(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_DIFFUSE: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_DIFFUSE(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_DIFFUSE(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPECULAR: - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_SPECULAR(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LIGHT_SPECULAR(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; #if 0 case GL_SPOT_DIRECTION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_POSITION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPOT_EXPONENT: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); + OUT_RING_CACHEf(*params); break; case GL_SPOT_CUTOFF: /* you can't factor these */ - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); - OUT_RINGf(params[0]); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); - OUT_RINGf(params[1]); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); + OUT_RING_CACHEf(params[0]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); + OUT_RING_CACHEf(params[1]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); + OUT_RING_CACHEf(params[2]); break; case GL_CONSTANT_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_LINEAR_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_QUADRATIC_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; #endif default: @@ -417,23 +417,23 @@ void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); void nv30LineStipple(GLcontext *ctx, GLint factor, GLushort pattern ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); - OUT_RING((pattern << 16) | factor); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); + OUT_RING_CACHE((pattern << 16) | factor); } void nv30LineWidth(GLcontext *ctx, GLfloat width) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_WIDTH_SMOOTH, 1); - OUT_RINGf(width); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_WIDTH_SMOOTH, 1); + OUT_RING_CACHEf(width); } */ void nv10LogicOpcode(GLcontext *ctx, GLenum opcode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LOGIC_OP, 1); - OUT_RING(opcode); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_LOGIC_OP, 1); + OUT_RING_CACHE(opcode); } void nv10PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *params) @@ -447,8 +447,8 @@ void nv10PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *params) void nv10PointSize(GLcontext *ctx, GLfloat size) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POINT_SIZE, 1); - OUT_RINGf(size); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_POINT_SIZE, 1); + OUT_RING_CACHEf(size); } /** Select a polygon rasterization mode */ @@ -469,8 +469,8 @@ void nv10ShadeModel(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); + OUT_RING_CACHE(mode); } /** OpenGL 2.0 two-sided StencilFunc */ @@ -479,10 +479,10 @@ static void nv10StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC, 3); - OUT_RING(func); - OUT_RING(ref); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC, 3); + OUT_RING_CACHE(func); + OUT_RING_CACHE(ref); + OUT_RING_CACHE(mask); } /** OpenGL 2.0 two-sided StencilMask */ @@ -490,8 +490,8 @@ static void nv10StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_MASK, 1); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_MASK, 1); + OUT_RING_CACHE(mask); } /** OpenGL 2.0 two-sided StencilOp */ @@ -500,10 +500,10 @@ static void nv10StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL, 1); - OUT_RING(fail); - OUT_RING(zfail); - OUT_RING(zpass); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL, 1); + OUT_RING_CACHE(fail); + OUT_RING_CACHE(zfail); + OUT_RING_CACHE(zpass); } /** Control the generation of texture coordinates */ @@ -523,8 +523,8 @@ void nv10Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); - OUT_RING((w << 16) | x); - OUT_RING((h << 16) | y); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); + OUT_RING_CACHE((w << 16) | x); + OUT_RING_CACHE((h << 16) | y); } diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 832ce4ad21d..198e3a2668a 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -61,6 +61,7 @@ static void nv10ResetLineStipple( GLcontext *ctx ); static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t primitive,uint32_t size) { + // FIXME the primitive type can probably go trough the caching system as well if (nmesa->screen->card->type==NV_10) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) @@ -79,6 +80,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { + // FIXME this is probably not needed if (nmesa->screen->card->type==NV_10) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) @@ -216,23 +218,6 @@ static void nv10_render_noop_verts(GLcontext *ctx,GLuint start,GLuint count,GLui { } -static inline void nv10_render_generic_primitive_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) -{ - struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); - GLubyte *vertptr = (GLubyte *)nmesa->verts; - GLuint vertsize = nmesa->vertex_size; - GLuint size_dword = vertsize*(count-start); - const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; - GLuint j; - - nv10ExtendPrimitive(nmesa, size_dword); - nv10StartPrimitive(nmesa,prim+1,size_dword); - for (j=start; j<count; j++ ) { - OUT_RINGp((nouveauVertex*)(vertptr+(elt[j]*vertsize*4)),vertsize); - } - nv10FinishPrimitive(nmesa); -} - static void (*nv10_render_tab_verts[GL_POLYGON+2])(GLcontext *, GLuint, GLuint, @@ -252,6 +237,23 @@ static void (*nv10_render_tab_verts[GL_POLYGON+2])(GLcontext *, }; +static inline void nv10_render_generic_primitive_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + GLuint size_dword = vertsize*(count-start); + const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j; + + nv10ExtendPrimitive(nmesa, size_dword); + nv10StartPrimitive(nmesa,prim+1,size_dword); + for (j=start; j<count; j++ ) { + OUT_RINGp((nouveauVertex*)(vertptr+(elt[j]*vertsize*4)),vertsize); + } + nv10FinishPrimitive(nmesa); +} + static void nv10_render_points_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags) { nv10_render_generic_primitive_elts(ctx,start,count,flags,GL_POINTS); @@ -440,8 +442,8 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) size = attr_size[j] << 4; \ size |= (attr_size[j]*4) << 8; \ size |= NV_VERTEX_ATTRIBUTE_TYPE_FLOAT; \ - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); \ - OUT_RING(size); \ + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); \ + OUT_RING_CACHE(size); \ } while (0) NV10_SET_VERTEX_ATTRIB(0, _TNL_ATTRIB_POS); @@ -453,22 +455,23 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) NV10_SET_VERTEX_ATTRIB(6, _TNL_ATTRIB_WEIGHT); NV10_SET_VERTEX_ATTRIB(7, _TNL_ATTRIB_FOG); - BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_VALIDATE,1); - OUT_RING(0); + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_VALIDATE,1); + OUT_RING_CACHE(0); } else if (nmesa->screen->card->type==NV_20) { for(i=0;i<16;i++) { int size=attr_size[i]; - BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); - OUT_RING(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); + BEGIN_RING_CACHE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); + OUT_RING_CACHE(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); } } else { - BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS,slots); + BEGIN_RING_CACHE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS,slots); for(i=0;i<slots;i++) { int size=attr_size[i]; - OUT_RING(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); + OUT_RING_CACHE(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); } + // FIXME this is probably not needed BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_UNK_0,1); OUT_RING(0); BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_UNK_0,1); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index 3ad5f5bc44b..7d93368a536 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -40,9 +40,9 @@ static void nv20AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) GLubyte ubRef; CLAMPED_FLOAT_TO_UBYTE(ubRef, ref); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); - OUT_RING(func); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ - OUT_RING(ubRef); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); + OUT_RING_CACHE(func); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ + OUT_RING_CACHE(ubRef); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ } static void nv20BlendColor(GLcontext *ctx, const GLfloat color[4]) @@ -55,15 +55,15 @@ static void nv20BlendColor(GLcontext *ctx, const GLfloat color[4]) CLAMPED_FLOAT_TO_UBYTE(cf[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(cf[3], color[3]); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); - OUT_RING(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); + OUT_RING_CACHE(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); } static void nv20BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB, GLenum modeA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); - OUT_RING((modeA<<16) | modeRGB); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); + OUT_RING_CACHE((modeA<<16) | modeRGB); } @@ -71,9 +71,9 @@ static void nv20BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac GLenum sfactorA, GLenum dfactorA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); - OUT_RING((sfactorA<<16) | sfactorRGB); - OUT_RING((dfactorA<<16) | dfactorRGB); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); + OUT_RING_CACHE((sfactorA<<16) | sfactorRGB); + OUT_RING_CACHE((dfactorA<<16) | dfactorRGB); } static void nv20ClearColor(GLcontext *ctx, const GLfloat color[4]) @@ -81,16 +81,16 @@ static void nv20ClearColor(GLcontext *ctx, const GLfloat color[4]) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); GLubyte c[4]; UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,color); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); - OUT_RING(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); + OUT_RING_CACHE(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); } static void nv20ClearDepth(GLcontext *ctx, GLclampd d) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8)); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } /* we're don't support indexed buffers @@ -101,26 +101,26 @@ static void nv20ClearStencil(GLcontext *ctx, GLint s) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF)); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } static void nv20ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); - OUT_RINGf(equation[0]); - OUT_RINGf(equation[1]); - OUT_RINGf(equation[2]); - OUT_RINGf(equation[3]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); + OUT_RING_CACHEf(equation[0]); + OUT_RING_CACHEf(equation[1]); + OUT_RING_CACHEf(equation[2]); + OUT_RING_CACHEf(equation[3]); } static void nv20ColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_MASK, 1); - OUT_RING(((amask && 0x01) << 24) | ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_MASK, 1); + OUT_RING_CACHE(((amask && 0x01) << 24) | ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); } static void nv20ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) @@ -131,37 +131,37 @@ static void nv20ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) static void nv20CullFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CULL_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CULL_FACE, 1); + OUT_RING_CACHE(mode); } static void nv20FrontFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FRONT_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FRONT_FACE, 1); + OUT_RING_CACHE(mode); } static void nv20DepthFunc(GLcontext *ctx, GLenum func) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); - OUT_RING(func); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); + OUT_RING_CACHE(func); } static void nv20DepthMask(GLcontext *ctx, GLboolean flag) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); - OUT_RING(flag); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); + OUT_RING_CACHE(flag); } static void nv20DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); - OUT_RINGf(nearval); - OUT_RINGf(farval); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); + OUT_RING_CACHEf(nearval); + OUT_RING_CACHEf(farval); } /** Specify the current buffer for writing */ @@ -175,13 +175,13 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) switch(cap) { case GL_ALPHA_TEST: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_AUTO_NORMAL: case GL_BLEND: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: @@ -189,12 +189,12 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); + OUT_RING_CACHE(state); break; case GL_COLOR_LOGIC_OP: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_COLOR_MATERIAL: // case GL_COLOR_SUM_EXT: @@ -202,20 +202,20 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_CONVOLUTION_1D: // case GL_CONVOLUTION_2D: case GL_CULL_FACE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DEPTH_TEST: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DITHER: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_FOG: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_HISTOGRAM: // case GL_INDEX_LOGIC_OP: @@ -232,22 +232,22 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) nmesa->enabled_lights=((nmesa->enabled_lights&mask)|(mask*state)); if (nmesa->lighting_enabled) { - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); - OUT_RING(nmesa->enabled_lights); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + OUT_RING_CACHE(nmesa->enabled_lights); } break; } case GL_LIGHTING: nmesa->lighting_enabled=state; - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); if (nmesa->lighting_enabled) - OUT_RING(nmesa->enabled_lights); + OUT_RING_CACHE(nmesa->enabled_lights); else - OUT_RING(0x0); + OUT_RING_CACHE(0x0); break; case GL_LINE_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_LINE_STIPPLE: // case GL_MAP1_COLOR_4: @@ -270,29 +270,29 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_MAP2_VERTEX_4: // case GL_MINMAX: case GL_NORMALIZE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POINT_SMOOTH: case GL_POLYGON_OFFSET_POINT: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_LINE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_FILL: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_STIPPLE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POST_COLOR_MATRIX_COLOR_TABLE: // case GL_POST_CONVOLUTION_COLOR_TABLE: @@ -301,8 +301,8 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_SEPARABLE_2D: case GL_STENCIL_TEST: // TODO BACK and FRONT ? - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_TEXTURE_GEN_Q: // case GL_TEXTURE_GEN_R: @@ -320,8 +320,8 @@ static void nv20Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *params) switch(pname) { case GL_FOG_MODE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FOG_MODE, 1); - //OUT_RING (params); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_FOG_MODE, 1); + //OUT_RING_CACHE (params); break; /* TODO: unsure about the rest.*/ default: @@ -344,59 +344,59 @@ static void nv20Lightfv(GLcontext *ctx, GLenum light, GLenum pname, const GLfloa switch(pname) { case GL_AMBIENT: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_DIFFUSE: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPECULAR: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPOT_DIRECTION: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_POSITION: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPOT_EXPONENT: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); + OUT_RING_CACHEf(*params); break; case GL_SPOT_CUTOFF: /* you can't factor these */ - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); - OUT_RINGf(params[0]); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); - OUT_RINGf(params[1]); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); + OUT_RING_CACHEf(params[0]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); + OUT_RING_CACHEf(params[1]); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); + OUT_RING_CACHEf(params[2]); break; case GL_CONSTANT_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_LINEAR_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_QUADRATIC_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; default: break; @@ -410,22 +410,22 @@ static void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params) static void nv20LineStipple(GLcontext *ctx, GLint factor, GLushort pattern ) { /* nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); - OUT_RING((pattern << 16) | factor);*/ + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); + OUT_RING_CACHE((pattern << 16) | factor);*/ } static void nv20LineWidth(GLcontext *ctx, GLfloat width) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_WIDTH, 1); - OUT_RINGf(width); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LINE_WIDTH, 1); + OUT_RING_CACHEf(width); } static void nv20LogicOpcode(GLcontext *ctx, GLenum opcode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_OP, 1); - OUT_RING(opcode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_OP, 1); + OUT_RING_CACHE(opcode); } static void nv20PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *params) @@ -439,8 +439,8 @@ static void nv20PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *pa static void nv20PointSize(GLcontext *ctx, GLfloat size) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POINT_SIZE, 1); - OUT_RINGf(size); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POINT_SIZE, 1); + OUT_RING_CACHEf(size); } /** Select a polygon rasterization mode */ @@ -449,12 +449,12 @@ static void nv20PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT, 1); + OUT_RING_CACHE(mode); } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_BACK, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_MODE_BACK, 1); + OUT_RING_CACHE(mode); } } @@ -474,8 +474,8 @@ void nv20ShadeModel(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); + OUT_RING_CACHE(mode); } /** OpenGL 2.0 two-sided StencilFunc */ @@ -484,10 +484,10 @@ static void nv20StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC, 3); - OUT_RING(func); - OUT_RING(ref); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_FUNC_FUNC, 3); + OUT_RING_CACHE(func); + OUT_RING_CACHE(ref); + OUT_RING_CACHE(mask); } /** OpenGL 2.0 two-sided StencilMask */ @@ -495,8 +495,8 @@ static void nv20StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_MASK, 1); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_MASK, 1); + OUT_RING_CACHE(mask); } /** OpenGL 2.0 two-sided StencilOp */ @@ -505,10 +505,10 @@ static void nv20StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL, 1); - OUT_RING(fail); - OUT_RING(zfail); - OUT_RING(zpass); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_STENCIL_OP_FAIL, 1); + OUT_RING_CACHE(fail); + OUT_RING_CACHE(zfail); + OUT_RING_CACHE(zpass); } /** Control the generation of texture coordinates */ @@ -528,9 +528,9 @@ static void nv20Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); - OUT_RING((w << 16) | x); - OUT_RING((h << 16) | y); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); + OUT_RING_CACHE((w << 16) | x); + OUT_RING_CACHE((h << 16) | y); } void nv20InitStateFuncs(struct dd_function_table *func) diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c index a6cbcb8c8d4..7b50cbc4611 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_state.c +++ b/src/mesa/drivers/dri/nouveau/nv30_state.c @@ -43,9 +43,9 @@ static void nv30AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) GLubyte ubRef; CLAMPED_FLOAT_TO_UBYTE(ubRef, ref); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); - OUT_RING(func); /* NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ - OUT_RING(ubRef); /* NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); + OUT_RING_CACHE(func); /* NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ + OUT_RING_CACHE(ubRef); /* NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ } static void nv30BlendColor(GLcontext *ctx, const GLfloat color[4]) @@ -58,15 +58,15 @@ static void nv30BlendColor(GLcontext *ctx, const GLfloat color[4]) CLAMPED_FLOAT_TO_UBYTE(cf[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(cf[3], color[3]); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); - OUT_RING(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_COLOR, 1); + OUT_RING_CACHE(PACK_COLOR_8888(cf[3], cf[1], cf[2], cf[0])); } static void nv30BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB, GLenum modeA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); - OUT_RING((modeA<<16) | modeRGB); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_EQUATION, 1); + OUT_RING_CACHE((modeA<<16) | modeRGB); } @@ -74,9 +74,9 @@ static void nv30BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac GLenum sfactorA, GLenum dfactorA) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); - OUT_RING((sfactorA<<16) | sfactorRGB); - OUT_RING((dfactorA<<16) | dfactorRGB); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_FUNC_SRC, 2); + OUT_RING_CACHE((sfactorA<<16) | sfactorRGB); + OUT_RING_CACHE((dfactorA<<16) | dfactorRGB); } static void nv30ClearColor(GLcontext *ctx, const GLfloat color[4]) @@ -84,16 +84,16 @@ static void nv30ClearColor(GLcontext *ctx, const GLfloat color[4]) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); GLubyte c[4]; UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,color); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); - OUT_RING(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_ARGB, 1); + OUT_RING_CACHE(PACK_COLOR_8888(c[3],c[0],c[1],c[2])); } static void nv30ClearDepth(GLcontext *ctx, GLclampd d) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8)); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } /* we're don't support indexed buffers @@ -104,26 +104,26 @@ static void nv30ClearStencil(GLcontext *ctx, GLint s) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF)); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); - OUT_RING(nmesa->clear_value); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_VALUE_DEPTH, 1); + OUT_RING_CACHE(nmesa->clear_value); } static void nv30ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); - OUT_RINGf(equation[0]); - OUT_RINGf(equation[1]); - OUT_RINGf(equation[2]); - OUT_RINGf(equation[3]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLIP_PLANE_A(plane), 4); + OUT_RING_CACHEf(equation[0]); + OUT_RING_CACHEf(equation[1]); + OUT_RING_CACHEf(equation[2]); + OUT_RING_CACHEf(equation[3]); } static void nv30ColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_MASK, 1); - OUT_RING(((amask && 0x01) << 24) | ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_MASK, 1); + OUT_RING_CACHE(((amask && 0x01) << 24) | ((rmask && 0x01) << 16) | ((gmask && 0x01)<< 8) | ((bmask && 0x01) << 0)); } static void nv30ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) @@ -134,37 +134,37 @@ static void nv30ColorMaterial(GLcontext *ctx, GLenum face, GLenum mode) static void nv30CullFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CULL_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CULL_FACE, 1); + OUT_RING_CACHE(mode); } static void nv30FrontFace(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FRONT_FACE, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FRONT_FACE, 1); + OUT_RING_CACHE(mode); } static void nv30DepthFunc(GLcontext *ctx, GLenum func) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); - OUT_RING(func); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_FUNC, 1); + OUT_RING_CACHE(func); } static void nv30DepthMask(GLcontext *ctx, GLboolean flag) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); - OUT_RING(flag); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_WRITE_ENABLE, 1); + OUT_RING_CACHE(flag); } static void nv30DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); - OUT_RINGf(nearval); - OUT_RINGf(farval); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); + OUT_RING_CACHEf(nearval); + OUT_RING_CACHEf(farval); } /** Specify the current buffer for writing */ @@ -178,13 +178,13 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) switch(cap) { case GL_ALPHA_TEST: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ALPHA_FUNC_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_AUTO_NORMAL: case GL_BLEND: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_BLEND_FUNC_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: @@ -192,12 +192,12 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLIP_PLANE_ENABLE(cap-GL_CLIP_PLANE0), 1); + OUT_RING_CACHE(state); break; case GL_COLOR_LOGIC_OP: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_COLOR_MATERIAL: // case GL_COLOR_SUM_EXT: @@ -205,20 +205,20 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_CONVOLUTION_1D: // case GL_CONVOLUTION_2D: case GL_CULL_FACE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CULL_FACE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DEPTH_TEST: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DEPTH_TEST_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_DITHER: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_DITHER_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_FOG: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FOG_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_HISTOGRAM: // case GL_INDEX_LOGIC_OP: @@ -239,8 +239,8 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) nmesa->enabled_lights=((nmesa->enabled_lights&mask)|(mask*state)); if (nmesa->lighting_enabled) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); - OUT_RING(nmesa->enabled_lights); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + OUT_RING_CACHE(nmesa->enabled_lights); } break; } @@ -249,11 +249,11 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) break; nmesa->lighting_enabled=state; - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_ENABLED_LIGHTS, 1); if (nmesa->lighting_enabled) - OUT_RING(nmesa->enabled_lights); + OUT_RING_CACHE(nmesa->enabled_lights); else - OUT_RING(0x0); + OUT_RING_CACHE(0x0); break; // case GL_LINE_SMOOTH: // case GL_LINE_STIPPLE: @@ -277,29 +277,29 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_MAP2_VERTEX_4: // case GL_MINMAX: case GL_NORMALIZE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_NORMALIZE_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POINT_SMOOTH: case GL_POLYGON_OFFSET_POINT: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_POINT_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_LINE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_LINE_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_OFFSET_FILL: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FILL_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_SMOOTH: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_SMOOTH_ENABLE, 1); + OUT_RING_CACHE(state); break; case GL_POLYGON_STIPPLE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_POST_COLOR_MATRIX_COLOR_TABLE: // case GL_POST_CONVOLUTION_COLOR_TABLE: @@ -308,8 +308,8 @@ static void nv30Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_SEPARABLE_2D: case GL_STENCIL_TEST: // TODO BACK and FRONT ? - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_ENABLE, 1); - OUT_RING(state); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_ENABLE, 1); + OUT_RING_CACHE(state); break; // case GL_TEXTURE_GEN_Q: // case GL_TEXTURE_GEN_R: @@ -327,8 +327,8 @@ static void nv30Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *params) switch(pname) { case GL_FOG_MODE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FOG_MODE, 1); - //OUT_RING (params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_FOG_MODE, 1); + //OUT_RING_CACHE (params); break; /* TODO: unsure about the rest.*/ default: @@ -355,59 +355,59 @@ static void nv30Lightfv(GLcontext *ctx, GLenum light, GLenum pname, const GLfloa switch(pname) { case GL_AMBIENT: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_DIFFUSE: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPECULAR: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_A(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_A(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPOT_DIRECTION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_DIR_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_POSITION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); - OUT_RINGf(params[0]); - OUT_RINGf(params[1]); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_POSITION_X(light), 3); + OUT_RING_CACHEf(params[0]); + OUT_RING_CACHEf(params[1]); + OUT_RING_CACHEf(params[2]); break; case GL_SPOT_EXPONENT: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_EXPONENT(light), 1); + OUT_RING_CACHEf(*params); break; case GL_SPOT_CUTOFF: /* you can't factor these */ - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); - OUT_RINGf(params[0]); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); - OUT_RINGf(params[1]); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); - OUT_RINGf(params[2]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_A(light), 1); + OUT_RING_CACHEf(params[0]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_B(light), 1); + OUT_RING_CACHEf(params[1]); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_SPOT_CUTOFF_C(light), 1); + OUT_RING_CACHEf(params[2]); break; case GL_CONSTANT_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_CONSTANT_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_LINEAR_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_LINEAR_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; case GL_QUADRATIC_ATTENUATION: - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); - OUT_RINGf(*params); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LIGHT_QUADRATIC_ATTENUATION(light), 1); + OUT_RING_CACHEf(*params); break; default: break; @@ -421,8 +421,8 @@ void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); static void nv30LineStipple(GLcontext *ctx, GLint factor, GLushort pattern ) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); - OUT_RING((pattern << 16) | factor); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_STIPPLE_PATTERN, 1); + OUT_RING_CACHE((pattern << 16) | factor); } static void nv30LineWidth(GLcontext *ctx, GLfloat width) @@ -432,15 +432,15 @@ static void nv30LineWidth(GLcontext *ctx, GLfloat width) CLAMPED_FLOAT_TO_UBYTE(ubWidth, width); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_WIDTH_SMOOTH, 1); - OUT_RING(ubWidth); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_LINE_WIDTH_SMOOTH, 1); + OUT_RING_CACHE(ubWidth); } static void nv30LogicOpcode(GLcontext *ctx, GLenum opcode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_OP, 1); - OUT_RING(opcode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_COLOR_LOGIC_OP_OP, 1); + OUT_RING_CACHE(opcode); } static void nv30PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *params) @@ -454,8 +454,8 @@ static void nv30PointParameterfv(GLcontext *ctx, GLenum pname, const GLfloat *pa static void nv30PointSize(GLcontext *ctx, GLfloat size) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POINT_SIZE, 1); - OUT_RINGf(size); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POINT_SIZE, 1); + OUT_RING_CACHEf(size); } /** Select a polygon rasterization mode */ @@ -464,12 +464,12 @@ static void nv30PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_MODE_FRONT, 1); + OUT_RING_CACHE(mode); } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_MODE_BACK, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_MODE_BACK, 1); + OUT_RING_CACHE(mode); } } @@ -511,8 +511,8 @@ static void nv30ShadeModel(GLcontext *ctx, GLenum mode) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); - OUT_RING(mode); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SHADE_MODEL, 1); + OUT_RING_CACHE(mode); } /** OpenGL 2.0 two-sided StencilFunc */ @@ -522,16 +522,16 @@ static void nv30StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_FUNC_FUNC, 3); - OUT_RING(func); - OUT_RING(ref); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_FUNC_FUNC, 3); + OUT_RING_CACHE(func); + OUT_RING_CACHE(ref); + OUT_RING_CACHE(mask); } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_FUNC_FUNC, 3); - OUT_RING(func); - OUT_RING(ref); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_FUNC_FUNC, 3); + OUT_RING_CACHE(func); + OUT_RING_CACHE(ref); + OUT_RING_CACHE(mask); } } @@ -541,12 +541,12 @@ static void nv30StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_MASK, 1); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_MASK, 1); + OUT_RING_CACHE(mask); } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_MASK, 1); - OUT_RING(mask); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_MASK, 1); + OUT_RING_CACHE(mask); } } @@ -557,16 +557,16 @@ static void nv30StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_OP_FAIL, 3); - OUT_RING(fail); - OUT_RING(zfail); - OUT_RING(zpass); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_FRONT_OP_FAIL, 3); + OUT_RING_CACHE(fail); + OUT_RING_CACHE(zfail); + OUT_RING_CACHE(zpass); } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_OP_FAIL, 3); - OUT_RING(fail); - OUT_RING(zfail); - OUT_RING(zpass); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_STENCIL_BACK_OP_FAIL, 3); + OUT_RING_CACHE(fail); + OUT_RING_CACHE(zfail); + OUT_RING_CACHE(zpass); } } @@ -594,9 +594,9 @@ static void nv30Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_DIMS_0, 2); - OUT_RING((w << 16) | x); - OUT_RING((h << 16) | y); + BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_DIMS_0, 2); + OUT_RING_CACHE((w << 16) | x); + OUT_RING_CACHE((h << 16) | y); } void nv30InitStateFuncs(struct dd_function_table *func) |