wined3d: Move decoding the streams to their own inline function.
This commit is contained in:
parent
5d2ce97136
commit
51a9810693
|
@ -1973,36 +1973,15 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
|
/* Helper for vertexdeclaration() */
|
||||||
BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
|
static inline void handleStreams(IWineD3DStateBlockImpl *stateblock, BOOL useVertexShaderFunction) {
|
||||||
BOOL transformed;
|
|
||||||
/* Some stuff is in the device until we have per context tracking */
|
|
||||||
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
||||||
BOOL wasrhw = device->last_was_rhw;
|
|
||||||
|
|
||||||
device->streamFixedUp = FALSE;
|
|
||||||
|
|
||||||
/* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
|
|
||||||
* here simply check whether a shader was set, or the user disabled shaders
|
|
||||||
*/
|
|
||||||
if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
|
|
||||||
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
|
|
||||||
useVertexShaderFunction = TRUE;
|
|
||||||
|
|
||||||
if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog != device->last_was_foggy_shader) {
|
|
||||||
updateFog = TRUE;
|
|
||||||
}
|
|
||||||
} else if(device->last_was_foggy_shader) {
|
|
||||||
updateFog = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(device->up_strided) {
|
if(device->up_strided) {
|
||||||
|
|
||||||
/* Note: this is a ddraw fixed-function code path */
|
/* Note: this is a ddraw fixed-function code path */
|
||||||
TRACE("================ Strided Input ===================\n");
|
TRACE("================ Strided Input ===================\n");
|
||||||
memcpy(&device->strided_streams, device->up_strided, sizeof(device->strided_streams));
|
memcpy(&device->strided_streams, device->up_strided, sizeof(device->strided_streams));
|
||||||
}
|
} else if (stateblock->vertexDecl || stateblock->vertexShader) {
|
||||||
else if (stateblock->vertexDecl || stateblock->vertexShader) {
|
|
||||||
/* Note: This is a fixed function or shader codepath.
|
/* Note: This is a fixed function or shader codepath.
|
||||||
* This means it must handle both types of strided data.
|
* This means it must handle both types of strided data.
|
||||||
* Shaders must go through here to zero the strided data, even if they
|
* Shaders must go through here to zero the strided data, even if they
|
||||||
|
@ -2027,6 +2006,33 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
|
||||||
primitiveConvertToStridedData((IWineD3DDevice *) device, &device->strided_streams,
|
primitiveConvertToStridedData((IWineD3DDevice *) device, &device->strided_streams,
|
||||||
&device->streamFixedUp);
|
&device->streamFixedUp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
|
||||||
|
BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
|
||||||
|
BOOL transformed;
|
||||||
|
/* Some stuff is in the device until we have per context tracking */
|
||||||
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
||||||
|
BOOL wasrhw = device->last_was_rhw;
|
||||||
|
|
||||||
|
device->streamFixedUp = FALSE;
|
||||||
|
|
||||||
|
/* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
|
||||||
|
* here simply check whether a shader was set, or the user disabled shaders
|
||||||
|
*/
|
||||||
|
if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
|
||||||
|
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
|
||||||
|
useVertexShaderFunction = TRUE;
|
||||||
|
|
||||||
|
if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog != device->last_was_foggy_shader) {
|
||||||
|
updateFog = TRUE;
|
||||||
|
}
|
||||||
|
} else if(device->last_was_foggy_shader) {
|
||||||
|
updateFog = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleStreams(stateblock, useVertexShaderFunction);
|
||||||
|
|
||||||
/* Do I have to use ? TRUE : FALSE ? Or can I rely on 15==15 beeing equal to TRUE(=1)? */
|
/* Do I have to use ? TRUE : FALSE ? Or can I rely on 15==15 beeing equal to TRUE(=1)? */
|
||||||
transformed = ((device->strided_streams.u.s.position.lpData != NULL ||
|
transformed = ((device->strided_streams.u.s.position.lpData != NULL ||
|
||||||
device->strided_streams.u.s.position.VBO != 0) &&
|
device->strided_streams.u.s.position.VBO != 0) &&
|
||||||
|
|
Loading…
Reference in New Issue