HLSL: Fix #803: Add shape conversions to the constant-initializer path.
This commit is contained in:
parent
a8b217fd8b
commit
2051815bcc
@ -108,8 +108,14 @@ gl_FragCoord origin is upper left
|
|||||||
0:29 Construct vec3 ( temp 3-component vector of float)
|
0:29 Construct vec3 ( temp 3-component vector of float)
|
||||||
0:29 Construct float ( temp float)
|
0:29 Construct float ( temp float)
|
||||||
0:29 'f1' ( temp 1-component vector of float)
|
0:29 'f1' ( temp 1-component vector of float)
|
||||||
0:31 Branch: Return with expression
|
0:33 Branch: Return with expression
|
||||||
0:31 'input' ( in 4-component vector of float)
|
0:33 component-wise multiply ( temp 4-component vector of float)
|
||||||
|
0:33 'input' ( in 4-component vector of float)
|
||||||
|
0:33 Constant:
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
0:? Linker Objects
|
0:? Linker Objects
|
||||||
|
|
||||||
|
|
||||||
@ -226,13 +232,19 @@ gl_FragCoord origin is upper left
|
|||||||
0:29 Construct vec3 ( temp 3-component vector of float)
|
0:29 Construct vec3 ( temp 3-component vector of float)
|
||||||
0:29 Construct float ( temp float)
|
0:29 Construct float ( temp float)
|
||||||
0:29 'f1' ( temp 1-component vector of float)
|
0:29 'f1' ( temp 1-component vector of float)
|
||||||
0:31 Branch: Return with expression
|
0:33 Branch: Return with expression
|
||||||
0:31 'input' ( in 4-component vector of float)
|
0:33 component-wise multiply ( temp 4-component vector of float)
|
||||||
|
0:33 'input' ( in 4-component vector of float)
|
||||||
|
0:33 Constant:
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
|
0:33 3.000000
|
||||||
0:? Linker Objects
|
0:? Linker Objects
|
||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 85
|
// Id's are bound by 88
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
@ -282,6 +294,8 @@ gl_FragCoord origin is upper left
|
|||||||
56: TypeInt 32 0
|
56: TypeInt 32 0
|
||||||
57: 56(int) Constant 0
|
57: 56(int) Constant 0
|
||||||
62: TypeVector 41(bool) 4
|
62: TypeVector 41(bool) 4
|
||||||
|
83: 6(float) Constant 1077936128
|
||||||
|
84: 7(fvec4) ConstantComposite 83 83 83 83
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
Return
|
Return
|
||||||
@ -343,5 +357,6 @@ gl_FragCoord origin is upper left
|
|||||||
80: 6(float) Load 70(f1)
|
80: 6(float) Load 70(f1)
|
||||||
81: 22(fvec3) CompositeConstruct 80 80 80
|
81: 22(fvec3) CompositeConstruct 80 80 80
|
||||||
82: 7(fvec4) Load 11(input)
|
82: 7(fvec4) Load 11(input)
|
||||||
ReturnValue 82
|
85: 7(fvec4) FMul 82 84
|
||||||
|
ReturnValue 85
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -28,5 +28,7 @@ float4 PixelShaderFunction(float4 input, float f) : COLOR0
|
|||||||
f1.x;
|
f1.x;
|
||||||
f1.xxx;
|
f1.xxx;
|
||||||
|
|
||||||
return input;
|
const float4 f4 = 3.0;
|
||||||
|
|
||||||
|
return input * f4;
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// For the version, it uses the latest git tag followed by the number of commits.
|
||||||
// For the date, it uses the current date (when then script is run).
|
// For the date, it uses the current date (when then script is run).
|
||||||
|
|
||||||
#define GLSLANG_REVISION "Overload400-PrecQual.1995"
|
#define GLSLANG_REVISION "Overload400-PrecQual.1996"
|
||||||
#define GLSLANG_DATE "12-Apr-2017"
|
#define GLSLANG_DATE "12-Apr-2017"
|
||||||
|
@ -6438,7 +6438,10 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm
|
|||||||
// Compile-time tagging of the variable with its constant value...
|
// Compile-time tagging of the variable with its constant value...
|
||||||
|
|
||||||
initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer);
|
initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer);
|
||||||
if (! initializer || ! initializer->getAsConstantUnion() || variable->getType() != initializer->getType()) {
|
if (initializer != nullptr && variable->getType() != initializer->getType())
|
||||||
|
initializer = intermediate.addShapeConversion(EOpAssign, variable->getType(), initializer);
|
||||||
|
if (initializer == nullptr || !initializer->getAsConstantUnion() ||
|
||||||
|
variable->getType() != initializer->getType()) {
|
||||||
error(loc, "non-matching or non-convertible constant type for const initializer",
|
error(loc, "non-matching or non-convertible constant type for const initializer",
|
||||||
variable->getType().getStorageQualifierString(), "");
|
variable->getType().getStorageQualifierString(), "");
|
||||||
variable->getWritableType().getQualifier().storage = EvqTemporary;
|
variable->getWritableType().getQualifier().storage = EvqTemporary;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user