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
33661450
Commit
33661450
authored
Dec 08, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Implement OpImage functionality (emit before query).
parent
45457bcd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
140 deletions
+147
-140
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+3
-0
SpvBuilder.h
SPIRV/SpvBuilder.h
+18
-17
spv.130.frag.out
Test/baseResults/spv.130.frag.out
+0
-0
spv.140.frag.out
Test/baseResults/spv.140.frag.out
+78
-76
spv.newTexture.frag.out
Test/baseResults/spv.newTexture.frag.out
+46
-45
spv.queryL.frag.out
Test/baseResults/spv.queryL.frag.out
+0
-0
revision.h
glslang/Include/revision.h
+2
-2
No files found.
SPIRV/GlslangToSpv.cpp
View file @
33661450
...
...
@@ -1855,6 +1855,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
// Check for queries
if
(
cracked
.
query
)
{
// a sampled image needs to have the image extracted first
if
(
builder
.
isSampledImage
(
params
.
sampler
))
params
.
sampler
=
builder
.
createUnaryOp
(
spv
::
OpImage
,
builder
.
getImageType
(
params
.
sampler
),
params
.
sampler
);
switch
(
node
->
getOp
())
{
case
glslang
:
:
EOpImageQuerySize
:
case
glslang
:
:
EOpTextureQuerySize
:
...
...
SPIRV/SpvBuilder.h
View file @
33661450
...
...
@@ -122,23 +122,24 @@ public:
Id
getContainedTypeId
(
Id
typeId
,
int
)
const
;
StorageClass
getTypeStorageClass
(
Id
typeId
)
const
{
return
module
.
getStorageClass
(
typeId
);
}
bool
isPointer
(
Id
resultId
)
const
{
return
isPointerType
(
getTypeId
(
resultId
));
}
bool
isScalar
(
Id
resultId
)
const
{
return
isScalarType
(
getTypeId
(
resultId
));
}
bool
isVector
(
Id
resultId
)
const
{
return
isVectorType
(
getTypeId
(
resultId
));
}
bool
isMatrix
(
Id
resultId
)
const
{
return
isMatrixType
(
getTypeId
(
resultId
));
}
bool
isAggregate
(
Id
resultId
)
const
{
return
isAggregateType
(
getTypeId
(
resultId
));
}
bool
isBoolType
(
Id
typeId
)
const
{
return
groupedTypes
[
OpTypeBool
].
size
()
>
0
&&
typeId
==
groupedTypes
[
OpTypeBool
].
back
()
->
getResultId
();
}
bool
isPointerType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypePointer
;
}
bool
isScalarType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeFloat
||
getTypeClass
(
typeId
)
==
OpTypeInt
||
getTypeClass
(
typeId
)
==
OpTypeBool
;
}
bool
isVectorType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeVector
;
}
bool
isMatrixType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeMatrix
;
}
bool
isStructType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeStruct
;
}
bool
isArrayType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeArray
;
}
bool
isAggregateType
(
Id
typeId
)
const
{
return
isArrayType
(
typeId
)
||
isStructType
(
typeId
);
}
bool
isImageType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeImage
;
}
bool
isSamplerType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeSampler
;
}
bool
isSampledImageType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeSampledImage
;
}
bool
isPointer
(
Id
resultId
)
const
{
return
isPointerType
(
getTypeId
(
resultId
));
}
bool
isScalar
(
Id
resultId
)
const
{
return
isScalarType
(
getTypeId
(
resultId
));
}
bool
isVector
(
Id
resultId
)
const
{
return
isVectorType
(
getTypeId
(
resultId
));
}
bool
isMatrix
(
Id
resultId
)
const
{
return
isMatrixType
(
getTypeId
(
resultId
));
}
bool
isAggregate
(
Id
resultId
)
const
{
return
isAggregateType
(
getTypeId
(
resultId
));
}
bool
isSampledImage
(
Id
resultId
)
const
{
return
isSampledImageType
(
getTypeId
(
resultId
));
}
bool
isBoolType
(
Id
typeId
)
const
{
return
groupedTypes
[
OpTypeBool
].
size
()
>
0
&&
typeId
==
groupedTypes
[
OpTypeBool
].
back
()
->
getResultId
();
}
bool
isPointerType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypePointer
;
}
bool
isScalarType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeFloat
||
getTypeClass
(
typeId
)
==
OpTypeInt
||
getTypeClass
(
typeId
)
==
OpTypeBool
;
}
bool
isVectorType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeVector
;
}
bool
isMatrixType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeMatrix
;
}
bool
isStructType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeStruct
;
}
bool
isArrayType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeArray
;
}
bool
isAggregateType
(
Id
typeId
)
const
{
return
isArrayType
(
typeId
)
||
isStructType
(
typeId
);
}
bool
isImageType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeImage
;
}
bool
isSamplerType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeSampler
;
}
bool
isSampledImageType
(
Id
typeId
)
const
{
return
getTypeClass
(
typeId
)
==
OpTypeSampledImage
;
}
bool
isConstantOpCode
(
Op
opcode
)
const
;
bool
isConstant
(
Id
resultId
)
const
{
return
isConstantOpCode
(
getOpCode
(
resultId
));
}
...
...
Test/baseResults/spv.130.frag.out
View file @
33661450
This diff is collapsed.
Click to expand it.
Test/baseResults/spv.140.frag.out
View file @
33661450
...
...
@@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 9
7
// Id's are bound by 9
9
Capability Shader
1: ExtInstImport "GLSL.std.450"
...
...
@@ -22,41 +22,41 @@ Linked fragment stage:
Name 33 "gl_ClipDistance"
Name 43 "k"
Name 55 "sampR"
Name 6
2
"sampB"
Name 8
4
"samp2Da"
Name
88
"bn"
MemberName
88
(bn) 0 "matra"
MemberName
88
(bn) 1 "matca"
MemberName
88
(bn) 2 "matr"
MemberName
88
(bn) 3 "matc"
MemberName
88
(bn) 4 "matrdef"
Name 9
0
""
Name 9
3
"bi"
MemberName 9
3
(bi) 0 "v"
Name 9
6
"bname"
Name 6
3
"sampB"
Name 8
6
"samp2Da"
Name
90
"bn"
MemberName
90
(bn) 0 "matra"
MemberName
90
(bn) 1 "matca"
MemberName
90
(bn) 2 "matr"
MemberName
90
(bn) 3 "matc"
MemberName
90
(bn) 4 "matrdef"
Name 9
2
""
Name 9
5
"bi"
MemberName 9
5
(bi) 0 "v"
Name 9
8
"bname"
Decorate 16(gl_FrontFacing) BuiltIn FrontFacing
Decorate 33(gl_ClipDistance) BuiltIn ClipDistance
Decorate 8
7
ArrayStride 64
Decorate 8
7
ArrayStride 64
MemberDecorate
88
(bn) 0 RowMajor
MemberDecorate
88
(bn) 0 Offset 0
MemberDecorate
88
(bn) 0 MatrixStride 16
MemberDecorate
88
(bn) 1 ColMajor
MemberDecorate
88
(bn) 1 Offset 256
MemberDecorate
88
(bn) 1 MatrixStride 16
MemberDecorate
88
(bn) 2 RowMajor
MemberDecorate
88
(bn) 2 Offset 512
MemberDecorate
88
(bn) 2 MatrixStride 16
MemberDecorate
88
(bn) 3 ColMajor
MemberDecorate
88
(bn) 3 Offset 576
MemberDecorate
88
(bn) 3 MatrixStride 16
MemberDecorate
88
(bn) 4 RowMajor
MemberDecorate
88
(bn) 4 Offset 640
MemberDecorate
88
(bn) 4 MatrixStride 16
Decorate
88
(bn) Block
Decorate 9
2
ArrayStride 16
MemberDecorate 9
3
(bi) 0 Offset 0
Decorate 9
3
(bi) Block
Decorate 8
9
ArrayStride 64
Decorate 8
9
ArrayStride 64
MemberDecorate
90
(bn) 0 RowMajor
MemberDecorate
90
(bn) 0 Offset 0
MemberDecorate
90
(bn) 0 MatrixStride 16
MemberDecorate
90
(bn) 1 ColMajor
MemberDecorate
90
(bn) 1 Offset 256
MemberDecorate
90
(bn) 1 MatrixStride 16
MemberDecorate
90
(bn) 2 RowMajor
MemberDecorate
90
(bn) 2 Offset 512
MemberDecorate
90
(bn) 2 MatrixStride 16
MemberDecorate
90
(bn) 3 ColMajor
MemberDecorate
90
(bn) 3 Offset 576
MemberDecorate
90
(bn) 3 MatrixStride 16
MemberDecorate
90
(bn) 4 RowMajor
MemberDecorate
90
(bn) 4 Offset 640
MemberDecorate
90
(bn) 4 MatrixStride 16
Decorate
90
(bn) Block
Decorate 9
4
ArrayStride 16
MemberDecorate 9
5
(bi) 0 Offset 0
Decorate 9
5
(bi) Block
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
@@ -92,31 +92,31 @@ Linked fragment stage:
53: TypeSampledImage 52
54: TypePointer UniformConstant 53
55(sampR): 54(ptr) Variable UniformConstant
5
7
: TypeVector 34(int) 2
59
: TypeImage 34(int) Buffer sampled format:Unknown
6
0: TypeSampledImage 59
6
1: TypePointer UniformConstant 60
6
2(sampB): 61
(ptr) Variable UniformConstant
6
7
: TypeVector 6(float) 2
7
0
: 6(float) Constant 1120403456
7
2
: 29(int) Constant 3
8
0
: TypeImage 6(float) 2D sampled format:Unknown
8
1: TypeSampledImage 80
8
2: TypeArray 81 72
8
3: TypePointer UniformConstant 82
8
4(samp2Da): 83
(ptr) Variable UniformConstant
8
5
: TypeMatrix 26(fvec4) 4
8
6
: 29(int) Constant 4
8
7: TypeArray 85 86
88(bn): TypeStruct 87 87 85 85 85
89: TypePointer Uniform 88
(bn)
9
0: 89
(ptr) Variable Uniform
9
1
: TypeVector 6(float) 3
9
2: TypeArray 91
(fvec3) 50
9
3(bi): TypeStruct 92
9
4: TypeArray 93(bi) 86
9
5: TypePointer Uniform 94
9
6(bname): 95
(ptr) Variable Uniform
5
8
: TypeVector 34(int) 2
60
: TypeImage 34(int) Buffer sampled format:Unknown
6
1: TypeSampledImage 60
6
2: TypePointer UniformConstant 61
6
3(sampB): 62
(ptr) Variable UniformConstant
6
9
: TypeVector 6(float) 2
7
2
: 6(float) Constant 1120403456
7
4
: 29(int) Constant 3
8
2
: TypeImage 6(float) 2D sampled format:Unknown
8
3: TypeSampledImage 82
8
4: TypeArray 83 74
8
5: TypePointer UniformConstant 84
8
6(samp2Da): 85
(ptr) Variable UniformConstant
8
7
: TypeMatrix 26(fvec4) 4
8
8
: 29(int) Constant 4
8
9: TypeArray 87 88
90(bn): TypeStruct 89 89 87 87 87
91: TypePointer Uniform 90
(bn)
9
2: 91
(ptr) Variable Uniform
9
3
: TypeVector 6(float) 3
9
4: TypeArray 93
(fvec3) 50
9
5(bi): TypeStruct 94
9
6: TypeArray 95(bi) 88
9
7: TypePointer Uniform 96
9
8(bname): 97
(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
13: 12(ptr) Variable Function
...
...
@@ -145,25 +145,27 @@ Linked fragment stage:
51: 40(ptr) AccessChain 28(o) 50
Store 51 49
56: 53 Load 55(sampR)
58: 57(ivec2) ImageQuerySize 56
63: 60 Load 62(sampB)
64: 34(int) ImageQuerySize 63
65: 57(ivec2) CompositeConstruct 64 64
66: 57(ivec2) IAdd 58 65
68: 67(fvec2) ConvertSToF 66
69: 6(float) CompositeExtract 68 0
71: 6(float) FDiv 69 70
73: 40(ptr) AccessChain 28(o) 72
Store 73 71
74: 6(float) FunctionCall 8(foo()
75: 40(ptr) AccessChain 28(o) 50
Store 75 74
57: 52 Image 56
59: 58(ivec2) ImageQuerySize 57
64: 61 Load 63(sampB)
65: 60 Image 64
66: 34(int) ImageQuerySize 65
67: 58(ivec2) CompositeConstruct 66 66
68: 58(ivec2) IAdd 59 67
70: 69(fvec2) ConvertSToF 68
71: 6(float) CompositeExtract 70 0
73: 6(float) FDiv 71 72
75: 40(ptr) AccessChain 28(o) 74
Store 75 73
76: 6(float) FunctionCall 8(foo()
77: 40(ptr) AccessChain 28(o) 50
Store 77 76
Return
FunctionEnd
8(foo(): 6(float) Function None 7
9: Label
7
6
: 6(float) Load 11(i1)
7
7
: 6(float) Load 24(i2)
78: 6(float) FAdd 76 77
ReturnValue
78
7
8
: 6(float) Load 11(i1)
7
9
: 6(float) Load 24(i2)
80: 6(float) FAdd 78 79
ReturnValue
80
FunctionEnd
Test/baseResults/spv.newTexture.frag.out
View file @
33661450
...
...
@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 27
7
// Id's are bound by 27
8
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 29 17 55 26 84 91 81 27
6 246
EntryPoint Fragment 4 "main" 29 17 55 26 84 91 81 27
7 247
ExecutionMode 4 OriginLowerLeft
Source GLSL 430
Name 4 "main"
...
...
@@ -39,17 +39,17 @@ Linked fragment stage:
Name 227 "is2DArray"
Name 237 "iv2"
Name 241 "sCubeShadow"
Name 24
6
"FragData"
Name 25
8
"is2Dms"
Name 26
2
"us2D"
Name 26
6
"us3D"
Name 27
0
"usCube"
Name 27
4
"us2DArray"
Name 27
6
"ic4D"
Name 24
7
"FragData"
Name 25
9
"is2Dms"
Name 26
3
"us2D"
Name 26
7
"us3D"
Name 27
1
"usCube"
Name 27
5
"us2DArray"
Name 27
7
"ic4D"
Decorate 81(ic3D) Flat
Decorate 84(ic1D) Flat
Decorate 91(ic2D) Flat
Decorate 27
6
(ic4D) Flat
Decorate 27
7
(ic4D) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
@@ -140,31 +140,31 @@ Linked fragment stage:
240: TypePointer UniformConstant 239
241(sCubeShadow): 240(ptr) Variable UniformConstant
243: 67(int) Constant 2
24
5
: TypePointer Output 7(fvec4)
24
6(FragData): 245
(ptr) Variable Output
25
0
: 6(float) Constant 0
25
5
: TypeImage 67(int) 2D multi-sampled sampled format:Unknown
25
6: TypeSampledImage 255
25
7: TypePointer UniformConstant 256
25
8(is2Dms): 257
(ptr) Variable UniformConstant
2
59
: TypeImage 32(int) 2D sampled format:Unknown
26
0: TypeSampledImage 259
26
1: TypePointer UniformConstant 260
26
2(us2D): 261
(ptr) Variable UniformConstant
26
3
: TypeImage 32(int) 3D sampled format:Unknown
26
4: TypeSampledImage 263
26
5: TypePointer UniformConstant 264
26
6(us3D): 265
(ptr) Variable UniformConstant
26
7
: TypeImage 32(int) Cube sampled format:Unknown
26
8: TypeSampledImage 267
2
69: TypePointer UniformConstant 268
27
0(usCube): 269
(ptr) Variable UniformConstant
27
1
: TypeImage 32(int) 2D array sampled format:Unknown
27
2: TypeSampledImage 271
27
3: TypePointer UniformConstant 272
27
4(us2DArray): 273
(ptr) Variable UniformConstant
27
5
: TypePointer Input 162(ivec4)
27
6(ic4D): 275
(ptr) Variable Input
24
6
: TypePointer Output 7(fvec4)
24
7(FragData): 246
(ptr) Variable Output
25
1
: 6(float) Constant 0
25
6
: TypeImage 67(int) 2D multi-sampled sampled format:Unknown
25
7: TypeSampledImage 256
25
8: TypePointer UniformConstant 257
25
9(is2Dms): 258
(ptr) Variable UniformConstant
2
60
: TypeImage 32(int) 2D sampled format:Unknown
26
1: TypeSampledImage 260
26
2: TypePointer UniformConstant 261
26
3(us2D): 262
(ptr) Variable UniformConstant
26
4
: TypeImage 32(int) 3D sampled format:Unknown
26
5: TypeSampledImage 264
26
6: TypePointer UniformConstant 265
26
7(us3D): 266
(ptr) Variable UniformConstant
26
8
: TypeImage 32(int) Cube sampled format:Unknown
26
9: TypeSampledImage 268
2
70: TypePointer UniformConstant 269
27
1(usCube): 270
(ptr) Variable UniformConstant
27
2
: TypeImage 32(int) 2D array sampled format:Unknown
27
3: TypeSampledImage 272
27
4: TypePointer UniformConstant 273
27
5(us2DArray): 274
(ptr) Variable UniformConstant
27
6
: TypePointer Input 162(ivec4)
27
7(ic4D): 276
(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
...
...
@@ -345,15 +345,16 @@ Linked fragment stage:
235: 7(fvec4) FAdd 234 233
Store 9(v) 235
242: 239 Load 241(sCubeShadow)
244: 68(ivec2) ImageQuerySizeLod 242 243
Store 237(iv2) 244
247: 7(fvec4) Load 9(v)
248: 68(ivec2) Load 237(iv2)
249: 15(fvec2) ConvertSToF 248
251: 6(float) CompositeExtract 249 0
252: 6(float) CompositeExtract 249 1
253: 7(fvec4) CompositeConstruct 251 252 250 250
254: 7(fvec4) FAdd 247 253
Store 246(FragData) 254
244: 238 Image 242
245: 68(ivec2) ImageQuerySizeLod 244 243
Store 237(iv2) 245
248: 7(fvec4) Load 9(v)
249: 68(ivec2) Load 237(iv2)
250: 15(fvec2) ConvertSToF 249
252: 6(float) CompositeExtract 250 0
253: 6(float) CompositeExtract 250 1
254: 7(fvec4) CompositeConstruct 252 253 251 251
255: 7(fvec4) FAdd 248 254
Store 247(FragData) 255
Return
FunctionEnd
Test/baseResults/spv.queryL.frag.out
View file @
33661450
This diff is collapsed.
Click to expand it.
glslang/Include/revision.h
View file @
33661450
...
...
@@ -2,5 +2,5 @@
// 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).
#define GLSLANG_REVISION "SPIRV99.8
24
"
#define GLSLANG_DATE "0
6
-Dec-2015"
#define GLSLANG_REVISION "SPIRV99.8
30
"
#define GLSLANG_DATE "0
8
-Dec-2015"
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