From 79b8e04e95b9523e636f6cac449a5491eb9bc21c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 20 Jul 2014 21:25:24 +1000 Subject: [PATCH] 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. --- base/renderprogs/interactionSM.pixel | 2 +- neo/renderer/RenderProgs_embedded.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/renderprogs/interactionSM.pixel b/base/renderprogs/interactionSM.pixel index 9b1e1537..db40f3ac 100644 --- a/base/renderprogs/interactionSM.pixel +++ b/base/renderprogs/interactionSM.pixel @@ -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; diff --git a/neo/renderer/RenderProgs_embedded.h b/neo/renderer/RenderProgs_embedded.h index 025d74ff..3c7a375a 100644 --- a/neo/renderer/RenderProgs_embedded.h +++ b/neo/renderer/RenderProgs_embedded.h @@ -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"