wined3d: Use the native constant limit for fitting private constants.

This commit is contained in:
Stefan Dösinger 2009-10-24 18:17:22 -07:00 committed by Alexandre Julliard
parent 9ee6508132
commit 0c72464abf

View File

@ -629,13 +629,13 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
*/
if (pshader)
{
max_constantsF = gl_info->max_ps_arb_constantsF;
max_constantsF = gl_info->max_ps_arb_native_constants;
}
else
{
if(This->baseShader.reg_maps.usesrelconstF) {
DWORD highest_constf = 0, clip_limit;
max_constantsF = gl_info->max_vs_arb_constantsF - reserved_vs_const(iface, gl_info);
max_constantsF = gl_info->max_vs_arb_native_constants - reserved_vs_const(iface, gl_info);
max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants);
for(i = 0; i < This->baseShader.limits.constant_float; i++)
@ -665,7 +665,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
{
if (ctx->target_version >= NV2) *num_clipplanes = gl_info->max_clipplanes;
else *num_clipplanes = min(gl_info->max_clipplanes, 4);
max_constantsF = gl_info->max_vs_arb_constantsF;
max_constantsF = gl_info->max_vs_arb_native_constants;
}
}
@ -698,6 +698,21 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
}
}
/* After subtracting privately used constants from the hardware limit(they are loaded as
* local constants), make sure the shader doesn't violate the env constant limit
*/
if(pshader)
{
max_constantsF = min(max_constantsF, gl_info->max_ps_arb_constantsF);
}
else
{
max_constantsF = min(max_constantsF, gl_info->max_vs_arb_constantsF);
}
/* Avoid declaring more constants than needed */
max_constantsF = min(max_constantsF, This->baseShader.limits.constant_float);
/* we use the array-based constants array if the local constants are marked for loading,
* because then we use indirect addressing, or when the local constant list is empty,
* because then we don't know if we're using indirect addressing or not. If we're hardcoding