summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-07-27 10:05:40 +0200
committermichal <michal@michal-laptop.(none)>2007-07-27 10:05:40 +0200
commite0a26b046764ae80748b347395ab1b27de83651e (patch)
treeea702756a3e9cedc3b3c41241cbff0956ddc82bc /src/mesa/drivers/dri
parent0360b49afbcd839f99ba0745d01cf9dc5be4d122 (diff)
parente3cef5887540016a6d198598cb50bebe09e3f4cf (diff)
Merge branch 'master' of git+ssh://michal@git.freedesktop.org/git/mesa/mesa into softpipe_0_1_branch
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c10
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c4
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_batchbuffer.h2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_fbo.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c6
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_native_vb.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tris.c13
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c10
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_buffers.c7
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c38
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c718
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.h5
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c16
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tris.c2
16 files changed, 443 insertions, 398 deletions
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index 3ad25282d9..e0d5b2b487 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -380,7 +380,10 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- int width = (int)ctx->Line._Width;
+ /* AA, non-AA limits are same */
+ const int width = (int) CLAMP(ctx->Line.Width,
+ ctx->Const.MinLineWidth,
+ ctx->Const.MaxLineWidth);
imesa->LcsLineWidth = 0;
if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
@@ -396,7 +399,10 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
static void i810PointSize( GLcontext *ctx, GLfloat sz )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- int size = (int)ctx->Point._Size;
+ /* AA, non-AA limits are same */
+ const int size = (int) CLAMP(ctx->Point.Size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
imesa->LcsPointSize = 0;
if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index 3e09427bb9..2c4ee06633 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -112,7 +112,9 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
static __inline__ void i810_draw_point( i810ContextPtr imesa,
i810VertexPtr tmp )
{
- GLfloat sz = imesa->glCtx->Point._Size * .5;
+ GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
int vertsize = imesa->vertex_size;
GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
int j;
diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
index 59261f7274..212f130101 100644
--- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
@@ -9,7 +9,7 @@ struct intel_context;
#define BATCH_SZ 16384
#define BATCH_RESERVED 16
-#define MAX_RELOCS 400
+#define MAX_RELOCS 4096
#define INTEL_BATCH_NO_CLIPRECTS 0x1
#define INTEL_BATCH_CLIPRECTS 0x2
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c
index 2dd3617f93..a09db46163 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c
@@ -509,7 +509,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name)
*/
static void
intel_bind_framebuffer(GLcontext * ctx, GLenum target,
- struct gl_framebuffer *fb)
+ struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
intel_draw_buffer(ctx, fb);
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index bfac52d765..9a6e5f5f19 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -173,7 +173,8 @@ static void upload_sf_unit( struct brw_context *brw )
/* _NEW_LINE */
- sf.sf6.line_width = brw->attribs.Line->_Width * (1<<1);
+ /* XXX use ctx->Const.Min/MaxLineWidth here */
+ sf.sf6.line_width = CLAMP(brw->attribs.Line->Width, 1.0, 5.0) * (1<<1);
sf.sf6.line_endcap_aa_region_width = 1;
if (brw->attribs.Line->SmoothFlag)
@@ -183,7 +184,8 @@ static void upload_sf_unit( struct brw_context *brw )
/* _NEW_POINT */
sf.sf6.point_rast_rule = 1; /* opengl conventions */
- sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3);
+ /* XXX clamp max depends on AA vs. non-AA */
+ sf.sf7.point_size = CLAMP(brw->attribs.Point->Size, 1.0, 3.0) * (1<<3);
sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated;
/* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons:
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
index 75cf0e2ed2..248fa2a9a2 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
@@ -103,7 +103,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
assert( p + 1 - (CARD32 *)src == 10 );
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c
index 08cc1849a1..369f610442 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tris.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tris.c
@@ -673,7 +673,10 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth));
GLfloat ooa;
GLuint *pxy0, *pxy1;
GLuint xy0old, xy0, xy1old, xy1;
@@ -691,9 +694,6 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
mach64_print_vertex( ctx, v1 );
}
- if( !width )
- width = 1; /* round to the nearest supported width */
-
pxy0 = &v0->ui[xyoffset];
xy0old = *pxy0;
xy0 = LE32_IN( &xy0old );
@@ -961,7 +961,10 @@ static __inline void mach64_draw_point( mach64ContextPtr mmesa,
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize));
GLfloat ooa;
GLuint *pxy;
GLuint xyold, xy;
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index 2b7ea05b14..91b413ae76 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -104,8 +104,10 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
static __inline__ void mga_draw_point( mgaContextPtr mmesa,
mgaVertexPtr tmp )
{
- GLfloat sz = mmesa->glCtx->Point._Size * .5;
- int vertex_size = mmesa->vertex_size;
+ const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size,
+ mmesa->glCtx->Const.MinPointSize,
+ mmesa->glCtx->Const.MaxPointSize);
+ const int vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
int j;
@@ -165,7 +167,9 @@ static __inline__ void mga_draw_line( mgaContextPtr mmesa,
GLuint vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
GLfloat dx, dy, ix, iy;
- GLfloat width = mmesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth);
GLint j;
#if 0
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index f98d666563..d498f616c9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
@@ -390,9 +390,12 @@ nouveauNewRenderbuffer(GLcontext *ctx, GLuint name)
}
static void
-nouveauBindFramebuffer(GLcontext *ctx, GLenum target, struct gl_framebuffer *fb)
+nouveauBindFramebuffer(GLcontext *ctx, GLenum target,
+ struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
- nouveau_build_framebuffer(ctx, fb);
+ if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
+ nouveau_build_framebuffer(ctx, fb);
+ }
}
static void
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 2115799b9b..1d975ecd57 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -772,9 +772,11 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
R200_STATECHANGE( rmesa, set );
/* Line width is stored in U6.4 format.
+ * Same min/max limits for AA, non-AA lines.
*/
rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff;
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0);
+ rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)
+ (CLAMP(widthf, ctx->Const.MinLineWidth, ctx->Const.MaxLineWidth) * 16.0);
if ( widthf > 1.0 ) {
rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE;
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 0349bac9a2..be6909724a 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -568,7 +568,7 @@ struct r300_vertex_shader_fragment {
union {
GLuint d[VSF_MAX_FRAGMENT_LENGTH];
float f[VSF_MAX_FRAGMENT_LENGTH];
- struct r300_vertprog_instruction i[VSF_MAX_FRAGMENT_LENGTH / 4];
+ GLuint i[VSF_MAX_FRAGMENT_LENGTH];
} body;
};
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 6789efd428..088216c76e 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -733,8 +733,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
static void r300PointSize(GLcontext * ctx, GLfloat size)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- size = ctx->Point._Size;
+ /* same size limits for AA, non-AA points */
+ size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
R300_STATECHANGE(r300, ps);
r300->hw.ps.cmd[R300_PS_POINTSIZE] =
@@ -749,8 +749,9 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- widthf = ctx->Line._Width;
-
+ widthf = CLAMP(widthf,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
R300_STATECHANGE(r300, lcntl);
r300->hw.lcntl.cmd[1] =
R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
@@ -1566,30 +1567,31 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa)
for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) {
if (rmesa->state.sw_tcl_inputs[i] != -1) {
- prog->program.body.i[program_end].opcode = EASY_VSF_OP(MUL, o_reg++, ALL, RESULT);
- prog->program.body.i[program_end].src[0] = VSF_REG(rmesa->state.sw_tcl_inputs[i]);
- prog->program.body.i[program_end].src[1] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]);
- prog->program.body.i[program_end].src[2] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]);
- program_end++;
+ prog->program.body.i[program_end + 0] = EASY_VSF_OP(MUL, o_reg++, ALL, RESULT);
+ prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]);
+ prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]);
+ prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]);
+ program_end += 4;
}
}
- prog->program.length = program_end * 4;
+ prog->program.length = program_end;
- r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM, &(prog->program));
+ r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM,
+ &(prog->program));
inst_count = (prog->program.length / 4) - 1;
R300_STATECHANGE(rmesa, pvs);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] =
- (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
- (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) |
- (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
+ (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
+ (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) |
+ (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] =
- (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
- (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
+ (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
+ (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] =
- (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) |
- (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT);
+ (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) |
+ (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT);
}
static void r300SetupRealVertexProgram(r300ContextPtr rmesa)
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 0fb6110494..7d4e8c9511 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -31,6 +31,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* \author Aapo Tahkola <aet@rasterburn.org>
*
* \author Oliver McFadden <z3ro.geek@gmail.com>
+ *
+ * For a description of the vertex program instruction set see r300_reg.h.
*/
#include "glheader.h"
@@ -366,20 +368,19 @@ static GLboolean valid_dst(struct r300_vertex_program *vp,
* component.
*/
-static void t_opcode_abs(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_abs(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] =
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -389,13 +390,14 @@ static void t_opcode_abs(struct r300_vertex_program *vp,
(!src[0].
NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
(src[0].RelAddr << 4);
- o_inst->src[2] = 0;
+ inst[3] = 0;
+
+ return inst;
}
-static void t_opcode_add(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_add(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
unsigned long hw_op;
@@ -405,53 +407,55 @@ static void t_opcode_add(struct r300_vertex_program *vp,
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = ONE_SRC_0;
- o_inst->src[1] = t_src(vp, &src[0]);
- o_inst->src[2] = t_src(vp, &src[1]);
+ inst[1] = ONE_SRC_0;
+ inst[2] = t_src(vp, &src[0]);
+ inst[3] = t_src(vp, &src[1]);
#else
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
#endif
+
+ return inst;
}
-static void t_opcode_arl(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_arl(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ARL, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_dp3(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_dp3(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] =
+ inst[1] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -461,7 +465,7 @@ static void t_opcode_dp3(struct r300_vertex_program *vp,
NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
(src[0].RelAddr << 4);
- o_inst->src[1] =
+ inst[2] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -471,36 +475,38 @@ static void t_opcode_dp3(struct r300_vertex_program *vp,
NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
(src[1].RelAddr << 4);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_dp4(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_dp4(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_dph(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_dph(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] =
+ inst[1] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -509,81 +515,84 @@ static void t_opcode_dph(struct r300_vertex_program *vp,
src[0].
NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
(src[0].RelAddr << 4);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_dst(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_dst(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_DST, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_ex2(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_ex2(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_EX2, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_exp(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_exp(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_EXP, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static struct r300_vertprog_instruction *t_opcode_flr(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3],
- int *u_temp_i)
+static GLuint *t_opcode_flr(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3], int *u_temp_i)
{
/* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, *u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask),
VSF_OUT_CLASS_TMP);
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
- o_inst++;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+ inst += 4;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] =
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] =
MAKE_VSF_SOURCE(*u_temp_i, VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z,
VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP,
@@ -592,40 +601,40 @@ static struct r300_vertprog_instruction *t_opcode_flr(struct r300_vertex_program
NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE
/*VSF_FLAG_ALL */ );
- o_inst->src[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
(*u_temp_i)--;
- return o_inst;
+ return inst;
}
-static void t_opcode_frc(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_frc(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_lg2(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_lg2(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
// LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X}
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] =
+ inst[1] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
@@ -635,70 +644,70 @@ static void t_opcode_lg2(struct r300_vertex_program *vp,
src[0].
NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
(src[0].RelAddr << 4);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_lit(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_lit(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
/* NOTE: Users swizzling might not work. */
- o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- VSF_IN_COMPONENT_ZERO, // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_src_class(src[0].File),
- src[0].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[0].
- RelAddr << 4);
- o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- VSF_IN_COMPONENT_ZERO, // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_src_class(src[0].File),
- src[0].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[0].
- RelAddr << 4);
- o_inst->src[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- VSF_IN_COMPONENT_ZERO, // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[0].
- RelAddr << 4);
+ inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
+ t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
+ VSF_IN_COMPONENT_ZERO, // z
+ t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
+ t_src_class(src[0].File),
+ src[0].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+ inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
+ VSF_IN_COMPONENT_ZERO, // z
+ t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
+ t_src_class(src[0].File),
+ src[0].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+ inst[3] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
+ VSF_IN_COMPONENT_ZERO, // z
+ t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
+ t_src_class(src[0].File),
+ src[0].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+ return inst;
}
-static void t_opcode_log(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_log(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_LOG, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_mad(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_mad(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
unsigned long hw_op;
@@ -708,80 +717,84 @@ static void t_opcode_mad(struct r300_vertex_program *vp,
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = t_src(vp, &src[2]);
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = t_src(vp, &src[2]);
+
+ return inst;
}
-static void t_opcode_max(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_max(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_min(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_min(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_MIN, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_mov(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_mov(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
#if 1
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
#else
hw_op =
(src[0].File ==
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ONE_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ONE_SRC_0;
+ inst[3] = ZERO_SRC_0;
#endif
+
+ return inst;
}
-static void t_opcode_mul(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_mul(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
unsigned long hw_op;
@@ -792,94 +805,100 @@ static void t_opcode_mul(struct r300_vertex_program *vp,
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+
+ inst[3] = ZERO_SRC_1;
- o_inst->src[2] = ZERO_SRC_1;
+ return inst;
}
-static void t_opcode_pow(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_pow(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_POW, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = t_src_scalar(vp, &src[1]);
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = t_src_scalar(vp, &src[1]);
+
+ return inst;
}
-static void t_opcode_rcp(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_rcp(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_RCP, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_rsq(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_rsq(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_RSQ, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src_scalar(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src_scalar(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+
+ return inst;
}
-static void t_opcode_sge(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_sge(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_SGE, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_slt(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_slt(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_SLT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = t_src(vp, &src[1]);
- o_inst->src[2] = ZERO_SRC_1;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = t_src(vp, &src[1]);
+ inst[3] = ZERO_SRC_1;
+
+ return inst;
}
-static void t_opcode_sub(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_sub(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
unsigned long hw_op;
@@ -891,13 +910,13 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ONE_SRC_0;
- o_inst->src[2] =
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ONE_SRC_0;
+ inst[3] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -908,13 +927,13 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
(src[1].RelAddr << 4);
#else
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] =
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] =
MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -924,113 +943,110 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
(!src[1].
NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
(src[1].RelAddr << 4);
- o_inst->src[2] = 0;
+ inst[3] = 0;
#endif
+
+ return inst;
}
-static void t_opcode_swz(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3])
+static GLuint *t_opcode_swz(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3])
{
//ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
#if 1
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
#else
hw_op =
(src[0].File ==
PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
R300_VPI_OUT_OP_MAD;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = t_src(vp, &src[0]);
- o_inst->src[1] = ONE_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
+ inst[1] = t_src(vp, &src[0]);
+ inst[2] = ONE_SRC_0;
+ inst[3] = ZERO_SRC_0;
#endif
+
+ return inst;
}
-static struct r300_vertprog_instruction *t_opcode_xpd(struct r300_vertex_program *vp,
- struct prog_instruction *vpi,
- struct r300_vertprog_instruction *o_inst,
- struct prog_src_register src[3],
- int *u_temp_i)
+static GLuint *t_opcode_xpd(struct r300_vertex_program *vp,
+ struct prog_instruction *vpi, GLuint * inst,
+ struct prog_src_register src[3], int *u_temp_i)
{
/* mul r0, r1.yzxw, r2.zxyw
mad r0, -r2.yzxw, r1.zxyw, r0
NOTE: might need MAD_2
*/
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, *u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask),
VSF_OUT_CLASS_TMP);
- o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[0].
- RelAddr << 4);
-
- o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
- t_src_class(src[1].File),
- src[1].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[1].
- RelAddr << 4);
-
- o_inst->src[2] = ZERO_SRC_1;
- o_inst++;
+ inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
+ t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
+ t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
+ t_src_class(src[0].File),
+ src[0].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+ inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
+ t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
+ t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
+ t_src_class(src[1].File),
+ src[1].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[1].RelAddr << 4);
+
+ inst[3] = ZERO_SRC_1;
+ inst += 4;
(*u_temp_i)--;
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask),
t_dst_class(vpi->DstReg.File));
- o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
- t_src_class(src[1].File),
- (!src[1].
- NegateBase) ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[1].
- RelAddr << 4);
-
- o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].
- NegateBase ? VSF_FLAG_ALL :
- VSF_FLAG_NONE) | (src[0].
- RelAddr << 4);
-
- o_inst->src[2] =
+ inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
+ t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
+ t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
+ t_src_class(src[1].File),
+ (!src[1].
+ NegateBase) ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[1].RelAddr << 4);
+
+ inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
+ t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
+ t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
+ t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
+ t_src_class(src[0].File),
+ src[0].
+ NegateBase ? VSF_FLAG_ALL :
+ VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+ inst[3] =
MAKE_VSF_SOURCE(*u_temp_i + 1, VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z,
VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP,
VSF_FLAG_NONE);
- return o_inst;
+ return inst;
}
static void t_inputs_outputs(struct r300_vertex_program *vp)
@@ -1067,7 +1083,7 @@ static void t_inputs_outputs(struct r300_vertex_program *vp)
if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) {
vp->outputs[VERT_RESULT_BFC0] =
vp->outputs[VERT_RESULT_COL0] + 2;
- cur_reg = vp->outputs[VERT_RESULT_BFC0] + 1;
+ cur_reg = vp->outputs[VERT_RESULT_BFC0] + 2;
}
if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) {
@@ -1092,7 +1108,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
struct prog_instruction *vpi)
{
int i;
- struct r300_vertprog_instruction *o_inst;
+ GLuint *inst;
unsigned long num_operands;
/* Initial value should be last tmp reg that hw supports.
Strangely enough r300 doesnt mind even though these would be out of range.
@@ -1108,8 +1124,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
t_inputs_outputs(vp);
- for (o_inst = vp->program.body.i; vpi->Opcode != OPCODE_END;
- vpi++, o_inst++) {
+ for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END;
+ vpi++, inst += 4) {
FREE_TEMPS();
@@ -1129,12 +1145,12 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
if (num_operands == 3) { /* TODO: scalars */
if (CMP_SRCS(src[1], src[2])
|| CMP_SRCS(src[0], src[2])) {
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD,
u_temp_i, VSF_FLAG_ALL,
VSF_OUT_CLASS_TMP);
- o_inst->src[0] =
+ inst[1] =
MAKE_VSF_SOURCE(t_src_index
(vp, &src[2]),
SWIZZLE_X, SWIZZLE_Y,
@@ -1144,9 +1160,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
VSF_FLAG_NONE) |
(src[2].RelAddr << 4);
- o_inst->src[1] = ZERO_SRC_2;
- o_inst->src[2] = ZERO_SRC_2;
- o_inst++;
+ inst[2] = ZERO_SRC_2;
+ inst[3] = ZERO_SRC_2;
+ inst += 4;
src[2].File = PROGRAM_TEMPORARY;
src[2].Index = u_temp_i;
@@ -1157,12 +1173,12 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
if (num_operands >= 2) {
if (CMP_SRCS(src[1], src[0])) {
- o_inst->opcode =
+ inst[0] =
MAKE_VSF_OP(R300_VPI_OUT_OP_ADD,
u_temp_i, VSF_FLAG_ALL,
VSF_OUT_CLASS_TMP);
- o_inst->src[0] =
+ inst[1] =
MAKE_VSF_SOURCE(t_src_index
(vp, &src[0]),
SWIZZLE_X, SWIZZLE_Y,
@@ -1172,9 +1188,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
VSF_FLAG_NONE) |
(src[0].RelAddr << 4);
- o_inst->src[1] = ZERO_SRC_0;
- o_inst->src[2] = ZERO_SRC_0;
- o_inst++;
+ inst[2] = ZERO_SRC_0;
+ inst[3] = ZERO_SRC_0;
+ inst += 4;
src[0].File = PROGRAM_TEMPORARY;
src[0].Index = u_temp_i;
@@ -1185,87 +1201,89 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
switch (vpi->Opcode) {
case OPCODE_ABS:
- t_opcode_abs(vp, vpi, o_inst, src);
+ inst = t_opcode_abs(vp, vpi, inst, src);
break;
case OPCODE_ADD:
- t_opcode_add(vp, vpi, o_inst, src);
+ inst = t_opcode_add(vp, vpi, inst, src);
break;
case OPCODE_ARL:
- t_opcode_arl(vp, vpi, o_inst, src);
+ inst = t_opcode_arl(vp, vpi, inst, src);
break;
case OPCODE_DP3:
- t_opcode_dp3(vp, vpi, o_inst, src);
+ inst = t_opcode_dp3(vp, vpi, inst, src);
break;
case OPCODE_DP4:
- t_opcode_dp4(vp, vpi, o_inst, src);
+ inst = t_opcode_dp4(vp, vpi, inst, src);
break;
case OPCODE_DPH:
- t_opcode_dph(vp, vpi, o_inst, src);
+ inst = t_opcode_dph(vp, vpi, inst, src);
break;
case OPCODE_DST:
- t_opcode_dst(vp, vpi, o_inst, src);
+ inst = t_opcode_dst(vp, vpi, inst, src);
break;
case OPCODE_EX2:
- t_opcode_ex2(vp, vpi, o_inst, src);
+ inst = t_opcode_ex2(vp, vpi, inst, src);
break;
case OPCODE_EXP:
- t_opcode_exp(vp, vpi, o_inst, src);
+ inst = t_opcode_exp(vp, vpi, inst, src);
break;
case OPCODE_FLR:
- /* FIXME */
- o_inst = t_opcode_flr(vp, vpi, o_inst, src, &u_temp_i);
+ inst =
+ t_opcode_flr(vp, vpi, inst, src, /* FIXME */
+ &u_temp_i);
break;
case OPCODE_FRC:
- t_opcode_frc(vp, vpi, o_inst, src);
+ inst = t_opcode_frc(vp, vpi, inst, src);
break;
case OPCODE_LG2:
- t_opcode_lg2(vp, vpi, o_inst, src);
+ inst = t_opcode_lg2(vp, vpi, inst, src);
break;
case OPCODE_LIT:
- t_opcode_lit(vp, vpi, o_inst, src);
+ inst = t_opcode_lit(vp, vpi, inst, src);
break;
case OPCODE_LOG:
- t_opcode_log(vp, vpi, o_inst, src);
+ inst = t_opcode_log(vp, vpi, inst, src);
break;
case OPCODE_MAD:
- t_opcode_mad(vp, vpi, o_inst, src);
+ inst = t_opcode_mad(vp, vpi, inst, src);
break;
case OPCODE_MAX:
- t_opcode_max(vp, vpi, o_inst, src);
+ inst = t_opcode_max(vp, vpi, inst, src);
break;
case OPCODE_MIN:
- t_opcode_min(vp, vpi, o_inst, src);
+ inst = t_opcode_min(vp, vpi, inst, src);
break;
case OPCODE_MOV:
- t_opcode_mov(vp, vpi, o_inst, src);
+ inst = t_opcode_mov(vp, vpi, inst, src);
break;
case OPCODE_MUL:
- t_opcode_mul(vp, vpi, o_inst, src);
+ inst = t_opcode_mul(vp, vpi, inst, src);
break;
case OPCODE_POW:
- t_opcode_pow(vp, vpi, o_inst, src);
+ inst = t_opcode_pow(vp, vpi, inst, src);
break;
case OPCODE_RCP:
- t_opcode_rcp(vp, vpi, o_inst, src);
+ inst = t_opcode_rcp(vp, vpi, inst, src);
break;
case OPCODE_RSQ:
- t_opcode_rsq(vp, vpi, o_inst, src);
+ inst = t_opcode_rsq(vp, vpi, inst, src);
break;
case OPCODE_SGE:
- t_opcode_sge(vp, vpi, o_inst, src);
+ inst = t_opcode_sge(vp, vpi, inst, src);
break;
case OPCODE_SLT:
- t_opcode_slt(vp, vpi, o_inst, src);
+ inst = t_opcode_slt(vp, vpi, inst, src);
break;
case OPCODE_SUB:
- t_opcode_sub(vp, vpi, o_inst, src);
+ inst = t_opcode_sub(vp, vpi, inst, src);
break;
case OPCODE_SWZ:
- t_opcode_swz(vp, vpi, o_inst, src);
+ inst = t_opcode_swz(vp, vpi, inst, src);
break;
case OPCODE_XPD:
- /* FIXME */
- o_inst = t_opcode_xpd(vp, vpi, o_inst, src, &u_temp_i);
+ inst =
+ t_opcode_xpd(vp, vpi, inst, src, /* FIXME */
+ &u_temp_i);
break;
default:
assert(0);
@@ -1273,7 +1291,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
}
}
- vp->program.length = (o_inst - vp->program.body.i) * 4;
+ vp->program.length = (inst - vp->program.body.i);
if (vp->program.length >= VSF_MAX_FRAGMENT_LENGTH) {
vp->program.length = 0;
vp->native = GL_FALSE;
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h
index 2d399e243a..3df0eee799 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.h
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.h
@@ -3,11 +3,6 @@
#include "r300_reg.h"
-struct r300_vertprog_instruction {
- GLuint opcode;
- GLuint src[3];
-};
-
#define VSF_FLAG_X 1
#define VSF_FLAG_Y 2
#define VSF_FLAG_Z 4
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index 3dd821a4d3..4ce2f60b4f 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -131,7 +131,9 @@ static __inline__ void savage_draw_point (savageContextPtr imesa,
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
const GLfloat x = tmp->v.x;
const GLfloat y = tmp->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
+ const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
GLuint j;
*(float *)&vb[0] = x - sz;
@@ -164,7 +166,9 @@ static __inline__ void savage_draw_line (savageContextPtr imesa,
savageVertexPtr v1 ) {
GLuint vertsize = imesa->HwVertexSize;
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+ imesa->glCtx->Const.MinLineWidth,
+ imesa->glCtx->Const.MaxLineWidth);
GLfloat dx, dy, ix, iy;
GLuint j;
@@ -234,7 +238,9 @@ static __inline__ void savage_ptex_line (savageContextPtr imesa,
savageVertexPtr v1 ) {
GLuint vertsize = imesa->HwVertexSize;
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+ imesa->glCtx->Const.MinLineWidth,
+ imesa->glCtx->Const.MaxLineWidth);
GLfloat dx, dy, ix, iy;
savageVertex tmp0, tmp1;
GLuint j;
@@ -281,7 +287,9 @@ static __inline__ void savage_ptex_point (savageContextPtr imesa,
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
const GLfloat x = v0->v.x;
const GLfloat y = v0->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
+ const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
savageVertex tmp;
GLuint j;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
index 96f9ae27fc..7252a7e7dc 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
@@ -184,7 +184,7 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
}
}
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}