@@ -335,13 +335,18 @@ std::string GpuShaderText::constKeyword() const
335335 case GPU_LANGUAGE_GLSL_4_0:
336336 case GPU_LANGUAGE_GLSL_ES_1_0:
337337 case GPU_LANGUAGE_GLSL_ES_3_0:
338- case GPU_LANGUAGE_HLSL_DX11:
339338 case GPU_LANGUAGE_MSL_2_0:
340339 {
341340 str += " const" ;
342341 str += " " ;
343342 break ;
344343 }
344+ case GPU_LANGUAGE_HLSL_DX11:
345+ {
346+ str += " static const" ;
347+ str += " " ;
348+ break ;
349+ }
345350 case LANGUAGE_OSL_1:
346351 case GPU_LANGUAGE_CG:
347352 break ;
@@ -380,6 +385,16 @@ std::string GpuShaderText::intKeyword() const
380385 return " int" ;
381386}
382387
388+ std::string GpuShaderText::intKeywordConst () const
389+ {
390+ std::string str;
391+
392+ str += constKeyword ();
393+ str += intKeyword ();
394+
395+ return str;
396+ }
397+
383398std::string GpuShaderText::colorDecl (const std::string & name) const
384399{
385400 if (name.empty ())
@@ -547,7 +562,7 @@ void GpuShaderText::declareIntArrayConst(const std::string & name, int size, con
547562 case GPU_LANGUAGE_GLSL_ES_1_0:
548563 case GPU_LANGUAGE_GLSL_ES_3_0:
549564 {
550- nl << " const " << intKeyword () << " " << name << " [" << size << " ] = "
565+ nl << intKeywordConst () << " " << name << " [" << size << " ] = "
551566 << intKeyword () << " [" << size << " ](" ;
552567 for (int i = 0 ; i < size; ++i)
553568 {
@@ -563,7 +578,7 @@ void GpuShaderText::declareIntArrayConst(const std::string & name, int size, con
563578 case GPU_LANGUAGE_HLSL_DX11:
564579 case GPU_LANGUAGE_MSL_2_0:
565580 {
566- nl << " const " << intKeyword () << " " << name << " [" << size << " ] = {" ;
581+ nl << intKeywordConst () << " " << name << " [" << size << " ] = {" ;
567582 for (int i = 0 ; i < size; ++i)
568583 {
569584 nl << v[i];
0 commit comments