Commit 85af0b29 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Don't emulate clipplanes with ffp vp and fix a wrong if condition.

b2f09fd2 accidentally got the device->vs_clipping check wrong. The FFP replacement should emulate clipping if GL can't do this natively with vertex shaders, not the other way. Also don't emulate clipping if we're using fixed function vertex processing because (a) clipping is always supported by GL in this case, and (b), fragment.texcoord[7] is undefined. (Or in the worst case set to something bad by the app).
parent e096b59c
......@@ -5151,7 +5151,6 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
BOOL tempreg_used = FALSE, tfactor_used = FALSE;
BOOL op_equal;
const char *final_combiner_src = "ret";
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
/* Find out which textures are read */
for(stage = 0; stage < MAX_TEXTURES; stage++) {
......@@ -5242,7 +5241,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
srgb_sub_high, 0.0, 0.0, 0.0);
}
if(ffp_clip_emul(stateblock) && device->vs_clipping) shader_addline(&buffer, "KIL fragment.texcoord[7];\n");
if(ffp_clip_emul(stateblock) && settings->emul_clipplanes) shader_addline(&buffer, "KIL fragment.texcoord[7];\n");
/* Generate texture sampling instructions) */
for(stage = 0; stage < MAX_TEXTURES && settings->op[stage].cop != WINED3DTOP_DISABLE; stage++) {
......
......@@ -2091,6 +2091,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
unsigned int i;
DWORD ttff;
DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
for(i = 0; i < GL_LIMITS(texture_stages); i++) {
IWineD3DBaseTextureImpl *texture;
......@@ -2144,8 +2145,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
carg2 = (args[cop] & ARG2) ? stateblock->textureState[i][WINED3DTSS_COLORARG2] : ARG_UNUSED;
carg0 = (args[cop] & ARG0) ? stateblock->textureState[i][WINED3DTSS_COLORARG0] : ARG_UNUSED;
if(is_invalid_op(stateblock->wineD3DDevice, i, cop,
carg1, carg2, carg0)) {
if(is_invalid_op(device, i, cop, carg1, carg2, carg0)) {
carg0 = ARG_UNUSED;
carg2 = ARG_UNUSED;
carg1 = WINED3DTA_CURRENT;
......@@ -2204,8 +2204,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
}
}
if(is_invalid_op(stateblock->wineD3DDevice, i, aop,
aarg1, aarg2, aarg0)) {
if(is_invalid_op(device, i, aop, aarg1, aarg2, aarg0)) {
aarg0 = ARG_UNUSED;
aarg2 = ARG_UNUSED;
aarg1 = WINED3DTA_CURRENT;
......@@ -2284,6 +2283,14 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
} else {
settings->sRGB_write = 0;
}
if(device->vs_clipping || !use_vs(stateblock)) {
/* No need to emulate clipplanes if GL supports native vertex shader clipping or if
* the fixed function vertex pipeline is used(which always supports clipplanes)
*/
settings->emul_clipplanes = 0;
} else {
settings->emul_clipplanes = 1;
}
}
#undef GLINFO_LOCATION
......
......@@ -1378,8 +1378,9 @@ struct texture_stage_op
struct ffp_frag_settings {
struct texture_stage_op op[MAX_TEXTURES];
enum fogmode fog;
/* Use an int instead of a char to get dword alignment */
unsigned int sRGB_write;
/* Use shorts instead of chars to get dword alignment */
unsigned short sRGB_write;
unsigned short emul_clipplanes;
};
struct ffp_frag_desc
......
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