nv10_swtcl.c \
nv10_state.c \
nv20_state.c \
- nv30_state.c
+ nv30_state.c \
+ nouveau_state_cache.c
C_SOURCES = \
$(COMMON_SOURCES) \
#include "tnl/t_vertex.h"
#include "nouveau_screen.h"
+#include "nouveau_state_cache.h"
#include "xmlconfig.h"
typedef void (*nouveau_point_func)( struct nouveau_context*,
nouveauVertex * );
-
typedef struct nouveau_context {
/* Mesa context */
GLcontext *glCtx;
GLboolean lighting_enabled;
uint32_t enabled_lights;
+ /* Cached state */
+ nouveau_state_cache state_cache;
+
/* The drawing fallbacks */
GLuint Fallback;
nouveau_tri_func draw_tri;
* 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
#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)
#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)); \
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.
default:
break;
}
+ nouveau_state_cache_init(nmesa);
}
/* Initialize the driver's state functions */
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] );
}
--- /dev/null
+
+#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;
+}
+
--- /dev/null
+
+#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
+
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])
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);
}
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);
}
/*
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);
}
*/
{
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 */
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)
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 */
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:
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:
// 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:
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:
// 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:
// 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:
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:
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:
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)
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 */
{
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 */
{
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 */
{
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 */
{
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 */
{
/* 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);
}
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)
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)
{
}
-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,
};
+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);
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);
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);
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])
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);
}
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])
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
{
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)
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 */
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:
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:
// 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:
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:
// 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:
// 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:
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:
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;
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)
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 */
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);
}
}
{
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 */
{
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 */
{
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 */
{
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 */
{
/* 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)
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])
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);
}
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])
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
{
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)
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 */
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:
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:
// 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:
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;
}
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:
// 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:
// 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:
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:
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;
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)
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)
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 */
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);
}
}
{
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 */
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);
}
}
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);
}
}
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);
}
}
{
/* 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)