Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
7ea7ff4c
Commit
7ea7ff4c
authored
Jan 03, 2017
by
steve-lunarg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EOpD3DCOLORtoUBYTE4 decomposition
parent
affc2667
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
7 deletions
+174
-7
hlsl.intrinsics.d3dcolortoubyte4.frag.out
Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out
+111
-0
hlsl.intrinsics.negative.frag.out
Test/baseResults/hlsl.intrinsics.negative.frag.out
+32
-6
hlsl.intrinsics.d3dcolortoubyte4.frag
Test/hlsl.intrinsics.d3dcolortoubyte4.frag
+7
-0
intermediate.h
glslang/Include/intermediate.h
+1
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+21
-0
hlslParseables.cpp
hlsl/hlslParseables.cpp
+1
-1
No files found.
Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out
0 → 100644
View file @
7ea7ff4c
hlsl.intrinsics.d3dcolortoubyte4.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp 4-component vector of int)
0:5 Function Parameters:
0:? Sequence
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:6 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp 4-component vector of int)
0:5 Function Parameters:
0:? Sequence
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:6 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 24
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "@entryPointOutput"
Name 13 "$Global"
MemberName 13($Global) 0 "col4"
Name 15 ""
Decorate 9(@entryPointOutput) Location 0
MemberDecorate 13($Global) 0 Offset 0
Decorate 13($Global) Block
Decorate 15 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeVector 6(int) 4
8: TypePointer Output 7(ivec4)
9(@entryPointOutput): 8(ptr) Variable Output
10: TypeFloat 32
11: 10(float) Constant 1132396672
12: TypeVector 10(float) 4
13($Global): TypeStruct 12(fvec4)
14: TypePointer Uniform 13($Global)
15: 14(ptr) Variable Uniform
16: 6(int) Constant 0
17: TypePointer Uniform 12(fvec4)
4(main): 2 Function None 3
5: Label
18: 17(ptr) AccessChain 15 16
19: 12(fvec4) Load 18
20: 12(fvec4) VectorShuffle 19 19 2 1 0 3
21: 12(fvec4) VectorTimesScalar 20 11
22: 7(ivec4) ConvertFToS 21
Store 9(@entryPointOutput) 22
Return
FunctionEnd
Test/baseResults/hlsl.intrinsics.negative.frag.out
View file @
7ea7ff4c
...
@@ -89,9 +89,22 @@ ERROR: node is still EOpNull!
...
@@ -89,9 +89,22 @@ ERROR: node is still EOpNull!
0:8 'inF0' (in float)
0:8 'inF0' (in float)
0:8 Construct vec3 (in 3-component vector of float)
0:8 Construct vec3 (in 3-component vector of float)
0:8 'inF1' (in float)
0:8 'inF1' (in float)
0:9 Function Call: D3DCOLORtoUBYTE4(vf4; (temp 4-component vector of int)
0:9 Convert float to int (temp 4-component vector of int)
0:9 Construct vec4 (in 4-component vector of float)
0:9 vector-scale (temp 4-component vector of float)
0:9 'inF0' (in float)
0:9 Constant:
0:9 255.001953
0:9 vector swizzle (temp 4-component vector of float)
0:9 Construct vec4 (in 4-component vector of float)
0:9 'inF0' (in float)
0:9 Sequence
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 3 (const int)
0:10 Constant:
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:12 ERROR: Bad unary op
0:12 ERROR: Bad unary op
...
@@ -445,9 +458,22 @@ ERROR: node is still EOpNull!
...
@@ -445,9 +458,22 @@ ERROR: node is still EOpNull!
0:8 'inF0' (in float)
0:8 'inF0' (in float)
0:8 Construct vec3 (in 3-component vector of float)
0:8 Construct vec3 (in 3-component vector of float)
0:8 'inF1' (in float)
0:8 'inF1' (in float)
0:9 Function Call: D3DCOLORtoUBYTE4(vf4; (temp 4-component vector of int)
0:9 Convert float to int (temp 4-component vector of int)
0:9 Construct vec4 (in 4-component vector of float)
0:9 vector-scale (temp 4-component vector of float)
0:9 'inF0' (in float)
0:9 Constant:
0:9 255.001953
0:9 vector swizzle (temp 4-component vector of float)
0:9 Construct vec4 (in 4-component vector of float)
0:9 'inF0' (in float)
0:9 Sequence
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 3 (const int)
0:10 Constant:
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:12 ERROR: Bad unary op
0:12 ERROR: Bad unary op
...
...
Test/hlsl.intrinsics.d3dcolortoubyte4.frag
0 → 100644
View file @
7ea7ff4c
uniform
float4
col4
;
int4
main
()
:
SV_Target0
{
return
D3DCOLORtoUBYTE4
(
col4
);
}
glslang/Include/intermediate.h
View file @
7ea7ff4c
...
@@ -597,6 +597,7 @@ enum TOperator {
...
@@ -597,6 +597,7 @@ enum TOperator {
EOpLit
,
// HLSL lighting coefficient vector
EOpLit
,
// HLSL lighting coefficient vector
EOpTextureBias
,
// HLSL texture bias: will be lowered to EOpTexture
EOpTextureBias
,
// HLSL texture bias: will be lowered to EOpTexture
EOpAsDouble
,
// slightly different from EOpUint64BitsToDouble
EOpAsDouble
,
// slightly different from EOpUint64BitsToDouble
EOpD3DCOLORtoUBYTE4
,
// convert and swizzle 4-component color to UBYTE4 range
EOpMethodSample
,
// Texture object methods. These are translated to existing
EOpMethodSample
,
// Texture object methods. These are translated to existing
EOpMethodSampleBias
,
// AST methods, and exist to represent HLSL semantics until that
EOpMethodSampleBias
,
// AST methods, and exist to represent HLSL semantics until that
...
...
gtests/Hlsl.FromFile.cpp
View file @
7ea7ff4c
...
@@ -127,6 +127,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -127,6 +127,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.intrinsics.barriers.comp"
,
"ComputeShaderFunction"
},
{
"hlsl.intrinsics.barriers.comp"
,
"ComputeShaderFunction"
},
{
"hlsl.intrinsics.comp"
,
"ComputeShaderFunction"
},
{
"hlsl.intrinsics.comp"
,
"ComputeShaderFunction"
},
{
"hlsl.intrinsics.evalfns.frag"
,
"main"
},
{
"hlsl.intrinsics.evalfns.frag"
,
"main"
},
{
"hlsl.intrinsics.d3dcolortoubyte4.frag"
,
"main"
},
{
"hlsl.intrinsics.double.frag"
,
"PixelShaderFunction"
},
{
"hlsl.intrinsics.double.frag"
,
"PixelShaderFunction"
},
{
"hlsl.intrinsics.f1632.frag"
,
"PixelShaderFunction"
},
{
"hlsl.intrinsics.f1632.frag"
,
"PixelShaderFunction"
},
{
"hlsl.intrinsics.frag"
,
"main"
},
{
"hlsl.intrinsics.frag"
,
"main"
},
...
...
hlsl/hlslParseHelper.cpp
View file @
7ea7ff4c
...
@@ -2629,6 +2629,27 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -2629,6 +2629,27 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
break
;
break
;
}
}
case
EOpD3DCOLORtoUBYTE4
:
{
// ivec4 ( x.zyxw * 255.001953 );
TIntermTyped
*
arg0
=
node
->
getAsUnaryNode
()
->
getOperand
();
TVectorFields
fields
(
2
,
1
,
0
,
3
);
TIntermTyped
*
swizzleIdx
=
intermediate
.
addSwizzle
(
fields
,
loc
);
TIntermTyped
*
swizzled
=
intermediate
.
addIndex
(
EOpVectorSwizzle
,
arg0
,
swizzleIdx
,
loc
);
swizzled
->
setType
(
arg0
->
getType
());
swizzled
->
getWritableType
().
getQualifier
().
makeTemporary
();
TIntermTyped
*
conversion
=
intermediate
.
addConstantUnion
(
255.001953
f
,
EbtFloat
,
loc
,
true
);
TIntermTyped
*
rangeConverted
=
handleBinaryMath
(
loc
,
"mul"
,
EOpMul
,
conversion
,
swizzled
);
rangeConverted
->
setType
(
arg0
->
getType
());
rangeConverted
->
getWritableType
().
getQualifier
().
makeTemporary
();
node
=
intermediate
.
addConversion
(
EOpConstructInt
,
TType
(
EbtInt
,
EvqTemporary
,
4
),
rangeConverted
);
node
->
setLoc
(
loc
);
node
->
setType
(
TType
(
EbtInt
,
EvqTemporary
,
4
));
break
;
}
default
:
default
:
break
;
// most pass through unchanged
break
;
// most pass through unchanged
}
}
...
...
hlsl/hlslParseables.cpp
View file @
7ea7ff4c
...
@@ -1022,7 +1022,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
...
@@ -1022,7 +1022,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
symbolTable
.
relateToOperator
(
"cosh"
,
EOpCosh
);
symbolTable
.
relateToOperator
(
"cosh"
,
EOpCosh
);
symbolTable
.
relateToOperator
(
"countbits"
,
EOpBitCount
);
symbolTable
.
relateToOperator
(
"countbits"
,
EOpBitCount
);
symbolTable
.
relateToOperator
(
"cross"
,
EOpCross
);
symbolTable
.
relateToOperator
(
"cross"
,
EOpCross
);
//
symbolTable.relateToOperator("D3DCOLORtoUBYTE4", EOpD3DCOLORtoUBYTE4);
symbolTable
.
relateToOperator
(
"D3DCOLORtoUBYTE4"
,
EOpD3DCOLORtoUBYTE4
);
symbolTable
.
relateToOperator
(
"ddx"
,
EOpDPdx
);
symbolTable
.
relateToOperator
(
"ddx"
,
EOpDPdx
);
symbolTable
.
relateToOperator
(
"ddx_coarse"
,
EOpDPdxCoarse
);
symbolTable
.
relateToOperator
(
"ddx_coarse"
,
EOpDPdxCoarse
);
symbolTable
.
relateToOperator
(
"ddx_fine"
,
EOpDPdxFine
);
symbolTable
.
relateToOperator
(
"ddx_fine"
,
EOpDPdxFine
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment