wined3d: Implement clipplanes in the ARB backend.
Using GL_NV_vertex_program2_option so far. If we're really desparate we can handle some cases without the extension by using a custom varying and texkill in the fragment program.
This commit is contained in:
parent
1276b090b4
commit
2afcb794f2
|
@ -389,6 +389,7 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh
|
||||||
} else {
|
} else {
|
||||||
if(This->baseShader.reg_maps.usesrelconstF) {
|
if(This->baseShader.reg_maps.usesrelconstF) {
|
||||||
max_constantsF = GL_LIMITS(vshader_constantsF) - reserved_vs_const(iface, gl_info);
|
max_constantsF = GL_LIMITS(vshader_constantsF) - reserved_vs_const(iface, gl_info);
|
||||||
|
if(GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION)) max_constantsF -= GL_LIMITS(clipplanes);
|
||||||
} else {
|
} else {
|
||||||
max_constantsF = GL_LIMITS(vshader_constantsF) - 1;
|
max_constantsF = GL_LIMITS(vshader_constantsF) - 1;
|
||||||
}
|
}
|
||||||
|
@ -2294,6 +2295,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
|
||||||
GLuint ret;
|
GLuint ret;
|
||||||
DWORD *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This);
|
DWORD *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This);
|
||||||
struct shader_arb_ctx_priv priv_ctx;
|
struct shader_arb_ctx_priv priv_ctx;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
memset(&priv_ctx, 0, sizeof(priv_ctx));
|
||||||
priv_ctx.cur_vs_args = args;
|
priv_ctx.cur_vs_args = args;
|
||||||
|
@ -2380,6 +2382,14 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
|
||||||
shader_addline(buffer, "ADD TMP_OUT.x, TMP_OUT.x, TA.z;\n");
|
shader_addline(buffer, "ADD TMP_OUT.x, TMP_OUT.x, TA.z;\n");
|
||||||
shader_addline(buffer, "MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;\n");
|
shader_addline(buffer, "MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;\n");
|
||||||
|
|
||||||
|
if(priv_ctx.target_version >= NV2)
|
||||||
|
{
|
||||||
|
for(i = 0; i < GL_LIMITS(clipplanes); i++)
|
||||||
|
{
|
||||||
|
shader_addline(buffer, "DP4 result.clip[%u].x, TMP_OUT, state.clip[%u].plane;\n", i, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
|
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
|
||||||
* and the glsl equivalent
|
* and the glsl equivalent
|
||||||
*/
|
*/
|
||||||
|
@ -2776,7 +2786,7 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *g
|
||||||
pCaps->MaxPixelShaderConst = GL_LIMITS(pshader_constantsF);
|
pCaps->MaxPixelShaderConst = GL_LIMITS(pshader_constantsF);
|
||||||
}
|
}
|
||||||
|
|
||||||
pCaps->VSClipping = FALSE; /* TODO: GL_NV_vertex_program2_option provides this */
|
pCaps->VSClipping = GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup)
|
static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup)
|
||||||
|
|
Loading…
Reference in New Issue