Skip to content
Browse files

allow non-type-explicit constant initializers.

e.g. where your hlsl could do:
	uniform float3 my_constants = float3(1, 2, 3);
now also allow this, which (afaik) is valid hlsl:
	uniform float3 my_constants = { 1, 2, 3 };
  • Loading branch information...
1 parent bbc3aa4 commit 1c4d326f5399fd7b62fad380e22752e3afa66183 @anchsm anchsm committed Feb 27, 2013
Showing with 15 additions and 10 deletions.
  1. +15 −10 hlslang/MachineIndependent/ParseHelper.cpp
View
25 hlslang/MachineIndependent/ParseHelper.cpp
@@ -1346,16 +1346,21 @@ bool TParseContext::executeInitializer(TSourceLoc line, TString& identifier, con
variable->constValue = initializer->getAsConstant();
}
-
- if (qualifier == EvqUniform)
- {
- if (!isConst)
- {
- error(line, " Attempting to initialize uniform with a non-constant initializer", "", "");
- variable->getType().changeQualifier(EvqTemporary);
- return true;
- }
- }
+//ACS: this was stopping non-type-explicit constant initializers from working (was that by design?)
+// e.g. it allowed this:
+// uniform float3 my_constants = float3(1, 2, 3);
+// but not this, which afaik is legal hlsl:
+// uniform float3 my_constants = { 1, 2, 3 };
+//
+// if (qualifier == EvqUniform)
+// {
+// if (!isConst)
+// {
+// error(line, " Attempting to initialize uniform with a non-constant initializer", "", "");
+// variable->getType().changeQualifier(EvqTemporary);
+// return true;
+// }
+// }
TIntermSymbol* intermSymbol = ir_add_symbol(variable, line);
intermNode = intermSymbol;

0 comments on commit 1c4d326

Please sign in to comment.
Something went wrong with that request. Please try again.