Commit 3febe738 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Handle ps 3.0 varyings in a different way.

parent 654571f2
......@@ -361,8 +361,19 @@ static inline VOID IWineD3DPixelShaderImpl_GenerateShader(
shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
/* Pack 3.0 inputs */
if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0))
pshader_glsl_input_pack(&buffer, This->semantics_in);
if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0) &&
!use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) {
if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed) {
This->vertexprocessing = pretransformed;
} else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) {
This->vertexprocessing = fixedfunction;
} else {
This->vertexprocessing = vertexshader;
}
pshader_glsl_input_pack(&buffer, This->semantics_in, iface);
}
/* Base Shader Body */
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
......@@ -605,6 +616,20 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader
goto recompile;
}
}
if(This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) {
if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed &&
This->vertexprocessing != pretransformed) {
WARN("Recompiling shader because pretransformed vertices are provided, which wasn't the case before\n");
goto recompile;
} else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device) &&
This->vertexprocessing != fixedfunction) {
WARN("Recompiling shader because fixed function vp is in use, which wasn't the case before\n");
goto recompile;
} else if(This->vertexprocessing != vertexshader) {
WARN("Recompiling shader because vertex shaders are in use, which wasn't the case before\n");
goto recompile;
}
}
return WINED3D_OK;
......
......@@ -324,8 +324,11 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader(
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
/* Unpack 3.0 outputs */
if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0))
vshader_glsl_output_unpack(&buffer, This->semantics_out);
if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0)) {
shader_addline(&buffer, "order_ps_input(OUT);\n");
} else {
shader_addline(&buffer, "order_ps_input();\n");
}
/* 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)
......
......@@ -1871,12 +1871,8 @@ extern void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg);
extern void pshader_glsl_dp2add(SHADER_OPCODE_ARG* arg);
extern void pshader_glsl_input_pack(
SHADER_BUFFER* buffer,
semantic* semantics_out);
/** GLSL Vertex Shader Prototypes */
extern void vshader_glsl_output_unpack(
SHADER_BUFFER* buffer,
semantic* semantics_out);
semantic* semantics_out,
IWineD3DPixelShader *iface);
/*****************************************************************************
* IDirect3DBaseShader implementation structure
......@@ -2066,6 +2062,13 @@ extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
/*****************************************************************************
* IDirect3DPixelShader implementation structure
*/
enum vertexprocessing_mode {
fixedfunction,
vertexshader,
pretransformed
};
typedef struct IWineD3DPixelShaderImpl {
/* IUnknown parts */
const IWineD3DPixelShaderVtbl *lpVtbl;
......@@ -2094,6 +2097,7 @@ typedef struct IWineD3DPixelShaderImpl {
char vpos_uniform;
BOOL render_offscreen;
UINT height;
enum vertexprocessing_mode vertexprocessing;
#if 0 /* needs reworking */
PSHADERINPUTDATA input;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment