diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-01-17 18:09:25 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-01-17 18:09:25 -0500 |
commit | 94556f359450acebe87d6c9b4f4fd8ccf78589d8 (patch) | |
tree | 04743bcf4d1efac30f8627dcce948e67e7bb3ec5 /src/mesa/drivers/dri/radeon/radeon_dma.c | |
parent | e77c495d09105a1b6a13fd62d0d3585b019e1c66 (diff) | |
download | external_mesa3d-94556f359450acebe87d6c9b4f4fd8ccf78589d8.zip external_mesa3d-94556f359450acebe87d6c9b4f4fd8ccf78589d8.tar.gz external_mesa3d-94556f359450acebe87d6c9b4f4fd8ccf78589d8.tar.bz2 |
radeon: share common fog code between radeon and r200
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_dma.c')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_dma.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index b49486f..61cddda 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -32,6 +32,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <errno.h> #include "radeon_common.h" +#include "radeon_fog.h" #include "main/simple_list.h" #if defined(USE_X86_ASM) @@ -165,6 +166,41 @@ void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos, radeon_bo_unmap(aos->bo); } +void rcommon_emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos, + GLvoid *data, int stride, int count) +{ + int i; + float *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 * count * 4, 32); + aos->stride = size; + } + + aos->components = size; + aos->count = count; + + /* Emit the data */ + radeon_bo_map(aos->bo, 1); + out = (float*)((char*)aos->bo->ptr + aos->offset); + for (i = 0; i < count; i++) { + out[0] = radeonComputeFogBlendFactor( ctx, *(GLfloat *)data ); + out++; + data += stride; + } + radeon_bo_unmap(aos->bo); +} + void radeon_init_dma(radeonContextPtr rmesa) { make_empty_list(&rmesa->dma.free); |