summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger@gmx.ch>2004-05-28 14:55:07 +0000
committerRoland Scheidegger <rscheidegger@gmx.ch>2004-05-28 14:55:07 +0000
commit1071162b366d733ff2f46f6234d66e1db5282f32 (patch)
tree383e7075755a685c651bdba4a0c885995a199727 /src
parent957b7343228e28d62a1c1e96903bb2a0b74dec20 (diff)
update so it compiles again (untested driver path!). Basically ported changes from r200_maos_arrays.c cvs rev. 1.3-1.5.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_maos_arrays.c140
1 files changed, 76 insertions, 64 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
index 07958b7d139..98f66898c73 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
@@ -42,7 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
-#include "tnl/t_imm_debug.h"
#include "radeon_context.h"
#include "radeon_ioctl.h"
@@ -50,6 +49,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_swtcl.h"
#include "radeon_maos.h"
+#if 0
/* Usage:
* - from radeon_tcl_render
* - call radeonEmitArrays to ensure uptodate arrays in dma
@@ -69,7 +69,7 @@ static void emit_ubyte_rgba3( GLcontext *ctx,
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf(stderr, "%s count %d stride %d out %p\n",
- __FUNCTION__, count, stride, out);
+ __FUNCTION__, count, stride, (void *)out);
for (i = 0; i < count; i++) {
out->red = *data;
@@ -81,29 +81,6 @@ static void emit_ubyte_rgba3( GLcontext *ctx,
}
}
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-
static void emit_ubyte_rgba4( GLcontext *ctx,
struct radeon_dma_region *rvb,
char *data,
@@ -170,8 +147,51 @@ static void emit_ubyte_rgba( GLcontext *ctx,
break;
}
}
+#endif
+#if defined(USE_X86_ASM)
+#define COPY_DWORDS( dst, src, nr ) \
+do { \
+ int __tmp; \
+ __asm__ __volatile__( "rep ; movsl" \
+ : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
+ : "0" (nr), \
+ "D" ((long)dst), \
+ "S" ((long)src) ); \
+} while (0)
+#else
+#define COPY_DWORDS( dst, src, nr ) \
+do { \
+ int j; \
+ for ( j = 0 ; j < nr ; j++ ) \
+ dst[j] = ((int *)src)[j]; \
+ dst += nr; \
+} while (0)
+#endif
+
+
+static void emit_vec4( GLcontext *ctx,
+ struct radeon_dma_region *rvb,
+ char *data,
+ int stride,
+ int count )
+{
+ int i;
+ int *out = (int *)(rvb->address + rvb->start);
+
+ if (RADEON_DEBUG & DEBUG_VERTS)
+ fprintf(stderr, "%s count %d stride %d\n",
+ __FUNCTION__, count, stride);
+ if (stride == 4)
+ COPY_DWORDS( out, data, count );
+ else
+ for (i = 0; i < count; i++) {
+ out[0] = *(int *)data;
+ out++;
+ data += stride;
+ }
+}
static void emit_vec8( GLcontext *ctx,
@@ -209,7 +229,7 @@ static void emit_vec12( GLcontext *ctx,
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, out, data);
+ __FUNCTION__, count, stride, (void *)out, (void *)data);
if (stride == 12)
COPY_DWORDS( out, data, count*3 );
@@ -282,6 +302,9 @@ static void emit_vector( GLcontext *ctx,
/* Emit the data
*/
switch (size) {
+ case 1:
+ emit_vec4( ctx, rvb, data, stride, count );
+ break;
case 2:
emit_vec8( ctx, rvb, data, stride, count );
break;
@@ -440,6 +463,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
case 3: vfmt |= RADEON_CP_VC_FRMT_Z;
case 2: vfmt |= RADEON_CP_VC_FRMT_XY;
default:
+ break;
}
component[nr++] = &rmesa->tcl.obj;
}
@@ -459,40 +483,28 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
}
if (inputs & VERT_BIT_COLOR0) {
- if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
- if (!rmesa->tcl.rgba.buf)
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.rgba,
- (char *)VB->ColorPtr[0]->Ptr,
- VB->ColorPtr[0]->Size,
- VB->ColorPtr[0]->StrideB,
- count);
-
- vfmt |= RADEON_CP_VC_FRMT_PKCOLOR;
+ int emitsize;
+ if (VB->ColorPtr[0]->size == 4 &&
+ (VB->ColorPtr[0]->stride != 0 ||
+ VB->ColorPtr[0]->data[0][3] != 1.0)) {
+ vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
+ emitsize = 4;
}
+
else {
- int emitsize;
-
- if (VB->ColorPtr[0]->Size == 4 &&
- (VB->ColorPtr[0]->StrideB != 0 ||
- ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
- emitsize = 4;
- }
- else {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->Ptr,
- emitsize,
- VB->ColorPtr[0]->StrideB,
- count);
+ vfmt |= RADEON_CP_VC_FRMT_FPCOLOR;
+ emitsize = 3;
}
+ if (!rmesa->tcl.rgba.buf)
+ emit_vector( ctx,
+ &(rmesa->tcl.rgba),
+ (char *)VB->ColorPtr[0]->data,
+ emitsize,
+ VB->ColorPtr[0]->stride,
+ count);
+
+
component[nr++] = &rmesa->tcl.rgba;
}
@@ -500,21 +512,21 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
if (inputs & VERT_BIT_COLOR1) {
if (!rmesa->tcl.spec.buf) {
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->Ptr,
- 3,
- VB->SecondaryColorPtr[0]->StrideB,
- count);
+ emit_vector( ctx,
+ &rmesa->tcl.spec,
+ (char *)VB->SecondaryColorPtr[0]->data,
+ 3,
+ VB->SecondaryColorPtr[0]->stride,
+ count);
}
- vfmt |= RADEON_CP_VC_FRMT_PKSPEC;
+ vfmt |= RADEON_CP_VC_FRMT_FPSPEC;
component[nr++] = &rmesa->tcl.spec;
}
vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
-
+
if (inputs & VERT_BIT_TEX0) {
if (!rmesa->tcl.tex[0].buf)
emit_tex_vector( ctx,