Commit 0c72464a authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

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

parent 9ee65081
......@@ -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
......
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