/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Cedar Park, Texas.
+ VMware, Inc.
All Rights Reserved.
/*
* Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
+ * Keith Whitwell <keithw@vmware.com>
*/
#include "main/glheader.h"
#include "radeon_maos.h"
#include "radeon_tcl.h"
-static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
- GLvoid *data, int stride, int count)
-{
- int i;
- uint32_t *out;
- int size = 1;
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & RADEON_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, &aos->bo, &aos->offset, size * 4, 32 );
- count = 1;
- aos->stride = 0;
- }
- else {
- radeonAllocDmaRegion(rmesa, &aos->bo, &aos->offset, size * 4, 32);
- aos->stride = size;
- }
-
- aos->components = size;
- aos->count = count;
-
-
- /* Emit the data
- */
- out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
- for (i = 0; i < count; i++) {
- out[0] = radeonComputeFogBlendFactor( ctx, *(GLfloat *)data );
- out++;
- data += stride;
- }
-}
-
static void emit_s0_vec(uint32_t *out, GLvoid *data, int stride, int count)
{
int i;
if (RADEON_DEBUG & RADEON_VERTS)
fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
+ __func__, count, stride);
for (i = 0; i < count; i++) {
out[0] = *(int *)data;
if (RADEON_DEBUG & RADEON_VERTS)
fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
+ __func__, count, stride);
for (i = 0; i < count; i++) {
out[0] = *(int *)data;
}
}
-
-
-
-static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
+static void emit_tex_vector(struct gl_context *ctx, struct radeon_aos *aos,
GLvoid *data, int size, int stride, int count)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
uint32_t *out;
if (RADEON_DEBUG & RADEON_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
+ fprintf(stderr, "%s %d/%d\n", __func__, count, size);
switch (size) {
case 4: emitsize = 3; break;
/* Emit the data
*/
+ radeon_bo_map(aos->bo, 1);
out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
switch (size) {
case 1:
exit(1);
break;
}
+ radeon_bo_unmap(aos->bo);
}
/* Emit any changed arrays to new GART memory, re-emit a packet to
* update the arrays.
*/
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
+void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
#if 0
if (RADEON_DEBUG & RADEON_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, inputs );
+ _tnl_print_vert_flags( __func__, inputs );
#endif
if (1) {
are emitted together but for secondary color not. */
if (inputs & VERT_BIT_FOG) {
if (!rmesa->tcl.fog.buf)
- emit_vecfog( ctx,
- &(rmesa->tcl.aos[nr]),
- (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
- VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
- count);
+ rcommon_emit_vecfog( ctx,
+ &(rmesa->tcl.aos[nr]),
+ (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
+ VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
+ count);
vfmt |= RADEON_CP_VC_FRMT_FPFOG;
nr++;
if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
vtx |= RADEON_Q_BIT(unit);
else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
- ((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) {
+ (!ctx->Texture.Unit[unit]._Current ||
+ ctx->Texture.Unit[unit]._Current->Target != GL_TEXTURE_CUBE_MAP)) {
GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3);
if (((rmesa->NeedTexMatrix >> unit) & 1) &&
(swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1)))