wined3d: Const correctness fixes for drawprim.c.

This commit is contained in:
Henri Verbeet 2008-11-28 15:30:12 +01:00 committed by Alexandre Julliard
parent 21b8535902
commit 6f98f19703
1 changed files with 23 additions and 24 deletions

View File

@ -146,10 +146,10 @@ void primitiveDeclarationConvertToStridedData(
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexDeclarationImpl* vertexDeclaration = (IWineD3DVertexDeclarationImpl *)This->stateBlock->vertexDecl; IWineD3DVertexDeclarationImpl* vertexDeclaration = (IWineD3DVertexDeclarationImpl *)This->stateBlock->vertexDecl;
unsigned int i; unsigned int i;
WINED3DVERTEXELEMENT *element; const WINED3DVERTEXELEMENT *element;
DWORD stride; DWORD stride;
DWORD numPreloadStreams = This->stateBlock->streamIsUP ? 0 : vertexDeclaration->num_streams; DWORD numPreloadStreams = This->stateBlock->streamIsUP ? 0 : vertexDeclaration->num_streams;
DWORD *streams = vertexDeclaration->streams; const DWORD *streams = vertexDeclaration->streams;
/* Check for transformed vertices, disable vertex shader if present */ /* Check for transformed vertices, disable vertex shader if present */
strided->u.s.position_transformed = vertexDeclaration->position_transformed; strided->u.s.position_transformed = vertexDeclaration->position_transformed;
@ -286,16 +286,15 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
* Slower GL version which extracts info about each vertex in turn * Slower GL version which extracts info about each vertex in turn
*/ */
static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT NumVertexes,
UINT NumVertexes, GLenum glPrimType, GLenum glPrimType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) { {
unsigned int textureNo = 0; unsigned int textureNo = 0;
const WORD *pIdxBufS = NULL; const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL; const DWORD *pIdxBufL = NULL;
ULONG vx_index; ULONG vx_index;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
UINT *streamOffset = This->stateBlock->streamOffset; const UINT *streamOffset = This->stateBlock->streamOffset;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex; long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
BOOL pixelShader = use_ps(This); BOOL pixelShader = use_ps(This);
@ -595,10 +594,9 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, const DWORD type, co
} }
} }
static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices, static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
ULONG startVertex) { {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex; long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
const WORD *pIdxBufS = NULL; const WORD *pIdxBufS = NULL;
@ -656,9 +654,10 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedDa
glEnd(); glEnd();
} }
static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices, static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd,
GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex,
ULONG startIdx, ULONG startVertex) { ULONG startIdx, ULONG startVertex)
{
UINT numInstances = 0, i; UINT numInstances = 0, i;
int numInstancedAttribs = 0, j; int numInstancedAttribs = 0, j;
UINT instancedData[sizeof(sd->u.input) / sizeof(sd->u.input[0]) /* 16 */]; UINT instancedData[sizeof(sd->u.input) / sizeof(sd->u.input[0]) /* 16 */];
@ -854,7 +853,7 @@ void drawPrimitive(IWineD3DDevice *iface,
{ {
GLenum glPrimType; GLenum glPrimType;
BOOL emulation = FALSE; BOOL emulation = FALSE;
WineDirect3DVertexStridedData *strided = &This->strided_streams; const WineDirect3DVertexStridedData *strided = &This->strided_streams;
WineDirect3DVertexStridedData stridedlcl; WineDirect3DVertexStridedData stridedlcl;
/* Ok, Work out which primitive is requested and how many vertexes that /* Ok, Work out which primitive is requested and how many vertexes that
will be */ will be */
@ -1006,7 +1005,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
float max_x = 0.0, max_y = 0.0, max_z = 0.0, neg_z = 0.0; float max_x = 0.0, max_y = 0.0, max_z = 0.0, neg_z = 0.0;
WineDirect3DVertexStridedData strided; WineDirect3DVertexStridedData strided;
const BYTE *data; const BYTE *data;
WINED3DRECTPATCH_INFO *info = &patch->RectPatchInfo; const WINED3DRECTPATCH_INFO *info = &patch->RectPatchInfo;
DWORD vtxStride; DWORD vtxStride;
GLenum feedback_type; GLenum feedback_type;
GLfloat *feedbuffer; GLfloat *feedbuffer;
@ -1085,11 +1084,11 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)"); checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_FILLMODE)); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_FILLMODE));
if(patch->has_normals) { if(patch->has_normals) {
float black[4] = {0, 0, 0, 0}; const GLfloat black[4] = {0, 0, 0, 0};
float red[4] = {1, 0, 0, 0}; const GLfloat red[4] = {1, 0, 0, 0};
float green[4] = {0, 1, 0, 0}; const GLfloat green[4] = {0, 1, 0, 0};
float blue[4] = {0, 0, 1, 0}; const GLfloat blue[4] = {0, 0, 1, 0};
float white[4] = {1, 1, 1, 1}; const GLfloat white[4] = {1, 1, 1, 1};
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
checkGLcall("glEnable(GL_LIGHTING)"); checkGLcall("glEnable(GL_LIGHTING)");
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);
@ -1256,9 +1255,9 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
if(patch->has_normals) { if(patch->has_normals) {
/* Now do the same with reverse light directions */ /* Now do the same with reverse light directions */
float x[4] = {-1, 0, 0, 0}; const GLfloat x[4] = {-1, 0, 0, 0};
float y[4] = { 0, -1, 0, 0}; const GLfloat y[4] = { 0, -1, 0, 0};
float z[4] = { 0, 0, -1, 0}; const GLfloat z[4] = { 0, 0, -1, 0};
glLightfv(GL_LIGHT0, GL_POSITION, x); glLightfv(GL_LIGHT0, GL_POSITION, x);
glLightfv(GL_LIGHT1, GL_POSITION, y); glLightfv(GL_LIGHT1, GL_POSITION, y);
glLightfv(GL_LIGHT2, GL_POSITION, z); glLightfv(GL_LIGHT2, GL_POSITION, z);