wined3d: Make the stream source application a regular state function.

This commit is contained in:
Stefan Dösinger 2008-07-02 09:33:24 -05:00 committed by Alexandre Julliard
parent 68dec9d161
commit 6675374dda
1 changed files with 13 additions and 6 deletions

View File

@ -3381,11 +3381,19 @@ static inline void drawPrimitiveTraceDataLocations(
return; return;
} }
/* Helper for vertexdeclaration() */ static void handleStreams(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
static inline void handleStreams(IWineD3DStateBlockImpl *stateblock, BOOL useVertexShaderFunction, WineD3DContext *context) {
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL fixup = FALSE; BOOL fixup = FALSE;
WineDirect3DVertexStridedData *dataLocations = &device->strided_streams; WineDirect3DVertexStridedData *dataLocations = &device->strided_streams;
BOOL useVertexShaderFunction;
if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
useVertexShaderFunction = TRUE;
} else {
useVertexShaderFunction = FALSE;
}
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 */
@ -3470,11 +3478,12 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL wasrhw = context->last_was_rhw; BOOL wasrhw = context->last_was_rhw;
handleStreams(state, stateblock, context);
/* Shaders can be implemented using ARB_PROGRAM, GLSL, or software - /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
* here simply check whether a shader was set, or the user disabled shaders * here simply check whether a shader was set, or the user disabled shaders
*/ */
if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader && if (use_vs(device)) {
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
useVertexShaderFunction = TRUE; useVertexShaderFunction = TRUE;
if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.fog != context->last_was_foggy_shader) { if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.fog != context->last_was_foggy_shader) {
@ -3484,8 +3493,6 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
updateFog = TRUE; updateFog = TRUE;
} }
handleStreams(stateblock, useVertexShaderFunction, context);
transformed = device->strided_streams.u.s.position_transformed; transformed = device->strided_streams.u.s.position_transformed;
if (transformed) useVertexShaderFunction = FALSE; if (transformed) useVertexShaderFunction = FALSE;