avoid an implicit type conversion in a shader

renderprogs/interactionSM.pixel does not compile with the Mesa
shader compiler due to a an implicit type conversion.

This gives a console warning on a release build and fatally
asserts on an debug build:

0:135(19): error: could not implicitly convert operands to arithmetic operator

Avoid this by changing an int declaration to a float.
This commit is contained in:
Jonathan Gray 2014-07-20 21:25:24 +10:00
parent 485edfebc1
commit 79b8e04e95
2 changed files with 2 additions and 2 deletions

View file

@ -249,7 +249,7 @@ void main( PS_IN fragment, out PS_OUT result )
float shadow = 0.0;
// RB: casting a float to int and using it as index can really kill the performance ...
int numSamples = 12; //int(rpScreenCorrectionFactor.w);
float numSamples = 12.0; //int(rpScreenCorrectionFactor.w);
float stepSize = 1.0 / numSamples;
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;

View file

@ -4424,7 +4424,7 @@ static const cgShaderDef_t cg_renderprogs[] =
" float shadow = 0.0;\n"
" \n"
" // RB: casting a float to int and using it as index can really kill the performance ...\n"
" int numSamples = 12; //int(rpScreenCorrectionFactor.w);\n"
" float numSamples = 12.0; //int(rpScreenCorrectionFactor.w);\n"
" float stepSize = 1.0 / numSamples;\n"
" \n"
" float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;\n"