From ed29d145f4017d601e458366b20d2b3c9cfbebe6 Mon Sep 17 00:00:00 2001 From: Christoph Brill Date: Mon, 25 Feb 2008 22:55:13 +0100 Subject: [PATCH] [r300] Document POLY_MODE and add some TODOs that might have triggered some bugs --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 4 +-- src/mesa/drivers/dri/r300/r300_reg.h | 34 +++++++++++++++++-------- src/mesa/drivers/dri/r300/r300_state.c | 18 ++++++------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 0db4017b1f1..ba8ecb0d0de 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -344,7 +344,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0); r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1); ALLOC_STATE(ga_point_s0, always, 5, 0); - r300->hw.ga_point_s0.cmd[0] = cmdpacket0(R300_GA_POINT_S0, 4); + r300->hw.ga_point_s0.cmd[0] = cmdpacket0(GA_POINT_S0, 4); ALLOC_STATE(ga_triangle_stipple, always, 2, 0); r300->hw.ga_triangle_stipple.cmd[0] = cmdpacket0(R300_GA_TRIANGLE_STIPPLE, 1); ALLOC_STATE(ps, always, R300_PS_CMDSIZE, 0); @@ -358,7 +358,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(shade, always, 5, 0); r300->hw.shade.cmd[0] = cmdpacket0(GA_ENHANCE, 4); ALLOC_STATE(polygon_mode, always, 4, 0); - r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_GA_POLY_MODE, 3); + r300->hw.polygon_mode.cmd[0] = cmdpacket0(GA_POLY_MODE, 3); ALLOC_STATE(fogp, always, 3, 0); r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); ALLOC_STATE(zbias_cntl, always, 2, 0); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 5bc71b1b053..fd551d9e1c9 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -627,10 +627,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R500_TX_DIRECTION_VERITCAL (1<<27) /* S Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) */ -#define R300_GA_POINT_S0 0x4200 +#define GA_POINT_S0 0x4200 + +/* T Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) */ +#define GA_POINT_T0 0x4204 /* S Texture Coordinate of Vertex 2 for Point texture stuffing (URC) */ -#define R300_GA_POINT_S1 0x4208 +#define GA_POINT_S1 0x4208 + +/* T Texture Coordinate of Vertex 2 for Point texture stuffing (URC) */ +#define GA_POINT_T1 0x420c #define R300_GA_TRIANGLE_STIPPLE 0x4214 @@ -870,15 +876,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_GA_SOLID_RG 0x427c #define R300_GA_SOLID_BA 0x4280 -/* Dangerous */ -#define R300_GA_POLY_MODE 0x4288 -# define R300_PM_ENABLED (1 << 0) -# define R300_PM_FRONT_POINT (0 << 0) -# define R300_PM_BACK_POINT (0 << 0) -# define R300_PM_FRONT_LINE (1 << 4) -# define R300_PM_FRONT_FILL (1 << 5) -# define R300_PM_BACK_LINE (1 << 7) -# define R300_PM_BACK_FILL (1 << 8) +/* Polygon Mode + * Dangerous + */ +#define GA_POLY_MODE 0x4288 +# define GA_POLY_MODE_DISABLE (0 << 0) +# define GA_POLY_MODE_DUAL (1 << 0) /* send 2 sets of 3 polys with specified poly type */ +/* reserved */ +# define GA_POLY_MODE_FRONT_PTYPE_POINT (0 << 4) +# define GA_POLY_MODE_FRONT_PTYPE_LINE (1 << 4) +# define GA_POLY_MODE_FRONT_PTYPE_TRI (2 << 4) +/* reserved */ +# define GA_POLY_MODE_BACK_PTYPE_POINT (0 << 7) +# define GA_POLY_MODE_BACK_PTYPE_LINE (1 << 7) +# define GA_POLY_MODE_BACK_PTYPE_TRI (2 << 7) +/* reserved */ #define R300_GA_ROUND_MODE 0x428c diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 5d408554400..d3da15981b7 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -515,29 +515,29 @@ static void r300UpdatePolygonMode(GLcontext * ctx) b = ctx->Polygon.FrontMode; } - hw_mode |= R300_PM_ENABLED; + hw_mode |= GA_POLY_MODE_DUAL; switch (f) { case GL_LINE: - hw_mode |= R300_PM_FRONT_LINE; + hw_mode |= GA_POLY_MODE_FRONT_PTYPE_LINE; break; - case GL_POINT: /* noop */ - hw_mode |= R300_PM_FRONT_POINT; + case GL_POINT: /* TODO: noops, find out why */ + hw_mode |= GA_POLY_MODE_DISABLE; break; case GL_FILL: - hw_mode |= R300_PM_FRONT_FILL; + hw_mode |= GA_POLY_MODE_FRONT_PTYPE_TRI; break; } switch (b) { case GL_LINE: - hw_mode |= R300_PM_BACK_LINE; + hw_mode |= GA_POLY_MODE_BACK_PTYPE_LINE; break; - case GL_POINT: /* noop */ - hw_mode |= R300_PM_BACK_POINT; + case GL_POINT: /* TODO: noops, find out why */ + hw_mode |= GA_POLY_MODE_DISABLE; break; case GL_FILL: - hw_mode |= R300_PM_BACK_FILL; + hw_mode |= GA_POLY_MODE_BACK_PTYPE_TRI; break; } } -- 2.30.2