wined3d: Care for the inverted y coords in dsy.

This commit is contained in:
Stefan Dösinger 2007-10-13 13:03:56 +02:00 committed by Alexandre Julliard
parent 9694cb2df3
commit 8f3accc718
4 changed files with 11 additions and 3 deletions

View File

@ -389,6 +389,8 @@ HRESULT shader_get_registers_used(
} else {
reg_maps->bumpmat = regnum;
}
} else if(WINED3DSIO_DSY == curOpcode->opcode) {
reg_maps->usesdsy = 1;
}
/* This will loop over all the registers and try to

View File

@ -559,7 +559,7 @@ void shader_generate_glsl_declarations(
ps_impl->srgb_enabled = 0;
ps_impl->srgb_mode_hardcoded = 1;
}
if(reg_maps->vpos) {
if(reg_maps->vpos || reg_maps->usesdsy) {
if(This->baseShader.limits.constant_float + extra_constants_needed + 1 < GL_LIMITS(pshader_constantsF)) {
shader_addline(buffer, "uniform vec4 ycorrection;\n");
((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1;
@ -1392,7 +1392,7 @@ void shader_glsl_map2gl(SHADER_OPCODE_ARG* arg) {
case WINED3DSIO_EXP: instruction = "exp2"; break;
case WINED3DSIO_SGN: instruction = "sign"; break;
case WINED3DSIO_DSX: instruction = "dFdx"; break;
case WINED3DSIO_DSY: instruction = "dFdy"; break;
case WINED3DSIO_DSY: instruction = "ycorrection.y * dFdy"; break;
default: instruction = "";
FIXME("Opcode %s not yet handled in GLSL\n", curOpcode->name);
break;

View File

@ -599,6 +599,12 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader
goto recompile;
}
}
if(This->baseShader.reg_maps.usesdsy && !This->vpos_uniform) {
if(This->render_offscreen ? 0 : 1 != deviceImpl->render_offscreen ? 0 : 1) {
WARN("Recompiling shader because dsy is used, hard compiled and render_offscreen changed\n");
goto recompile;
}
}
return WINED3D_OK;

View File

@ -1653,7 +1653,7 @@ typedef struct shader_reg_maps {
* Use 0 as default (bit 31 is always 1 on a valid token) */
DWORD samplers[max(MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS)];
char bumpmat, luminanceparams;
char usesnrm, vpos;
char usesnrm, vpos, usesdsy;
/* Whether or not loops are used in this shader, and nesting depth */
unsigned loop_depth;