[2/2] wined3d: Remove usesFog flag from IWineD3DVertexShaderImpl
Fabian Bieler
der.fabe at gmx.net
Thu Apr 12 12:49:16 CDT 2007
Remove the usesFog flag and replace it with a 'method' as suggested by Ivan
Gyurdiev.
-------------- next part --------------
From 181bcc22db71838a0cd2783632e9acc6a7527594 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Thu, 12 Apr 2007 19:40:45 +0200
Subject: [PATCH] wined3d: Remove usesFog flag from IWineD3DVertexShaderImpl
---
dlls/wined3d/state.c | 4 ++--
dlls/wined3d/vertexshader.c | 14 ++++++++------
dlls/wined3d/wined3d_private.h | 3 ++-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index cd60841..00a18d6 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -765,7 +765,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
}
if (use_vs(stateblock->wineD3DDevice)
- && ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog) {
+ && vshader_uses_fog(stateblock->vertexShader)) {
if( stateblock->renderState[WINED3DRS_FOGTABLEMODE] != WINED3DFOG_NONE ) {
if(!is_ps3) FIXME("Implement table fog for foggy vertex shader\n");
/* Disable fog */
@@ -3018,7 +3018,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
useVertexShaderFunction = TRUE;
- if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog != context->last_was_foggy_shader) {
+ if(vshader_uses_fog(stateblock->vertexShader) != context->last_was_foggy_shader) {
updateFog = TRUE;
}
} else if(context->last_was_foggy_shader) {
diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c
index 22c49c2..082da1f 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -295,6 +295,12 @@ BOOL vshader_input_is_color(
return FALSE;
}
+BOOL vshader_uses_fog(IWineD3DVertexShader *iface) {
+ IWineD3DVertexShaderImpl* This = (IWineD3DVertexShaderImpl*) iface;
+
+ return This->baseShader.reg_maps.fog;
+}
+
/** Generate a vertex shader string using either GL_VERTEX_PROGRAM_ARB
or GLSL and send it to the card */
static VOID IWineD3DVertexShaderImpl_GenerateShader(
@@ -337,9 +343,7 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader(
vshader_glsl_output_unpack(&buffer, This->semantics_out);
/* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */
- if (reg_maps->fog)
- This->usesFog = 1;
- else
+ if (!reg_maps->fog)
shader_addline(&buffer, "gl_FogFragCoord = gl_Position.z;\n");
/* Write the final position.
@@ -386,9 +390,7 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader(
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
/* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */
- if (reg_maps->fog)
- This->usesFog = 1;
- else
+ if (!reg_maps->fog)
shader_addline(&buffer, "MOV result.fogcoord, TMP_OUT.z;\n");
/* Write the final position.
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d0da532..fc23dd5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1633,6 +1633,8 @@ extern BOOL vshader_input_is_color(
IWineD3DVertexShader* iface,
unsigned int regnum);
+extern BOOL vshader_uses_fog(IWineD3DVertexShader *iface);
+
extern HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object);
/* ARB_[vertex/fragment]_program helper functions */
@@ -1867,7 +1869,6 @@ typedef struct IWineD3DVertexShaderImpl {
/* IWineD3DVertexShaderImpl */
IUnknown *parent;
- char usesFog;
DWORD usage;
/* Vertex shader input and output semantics */
--
1.4.4.1
More information about the wine-patches
mailing list