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
7355eebb
Commit
7355eebb
authored
Sep 14, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV legacy texturing: Smear result of Op*Dref* up to a vector to match
the expectations of old GLSL shadow*() lookups.
parent
e770b3e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
46 deletions
+74
-46
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+25
-1
spv.texture.frag.out
Test/baseResults/spv.texture.frag.out
+0
-0
spv.texture.vert.out
Test/baseResults/spv.texture.vert.out
+49
-45
No files found.
SPIRV/SpvBuilder.cpp
View file @
7355eebb
...
@@ -1214,6 +1214,23 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
...
@@ -1214,6 +1214,23 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
}
}
}
}
// See if the result type is expecting a smeared result.
// This happens when a legacy shadow*() call is made, which
// gets a vec4 back instead of a float.
Id
smearedType
=
resultType
;
if
(
!
isScalarType
(
resultType
))
{
switch
(
opCode
)
{
case
OpImageSampleDrefImplicitLod
:
case
OpImageSampleDrefExplicitLod
:
case
OpImageSampleProjDrefImplicitLod
:
case
OpImageSampleProjDrefExplicitLod
:
resultType
=
getScalarTypeId
(
resultType
);
break
;
default
:
break
;
}
}
Instruction
*
textureInst
=
new
Instruction
(
getUniqueId
(),
resultType
,
opCode
);
Instruction
*
textureInst
=
new
Instruction
(
getUniqueId
(),
resultType
,
opCode
);
for
(
int
op
=
0
;
op
<
optArgNum
;
++
op
)
for
(
int
op
=
0
;
op
<
optArgNum
;
++
op
)
textureInst
->
addIdOperand
(
texArgs
[
op
]);
textureInst
->
addIdOperand
(
texArgs
[
op
]);
...
@@ -1224,7 +1241,14 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
...
@@ -1224,7 +1241,14 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
setPrecision
(
textureInst
->
getResultId
(),
precision
);
setPrecision
(
textureInst
->
getResultId
(),
precision
);
buildPoint
->
addInstruction
(
textureInst
);
buildPoint
->
addInstruction
(
textureInst
);
return
textureInst
->
getResultId
();
Id
resultId
=
textureInst
->
getResultId
();
// When a smear is needed, do it, as per what was computed
// above when resultType was changed to a scalar type.
if
(
resultType
!=
smearedType
)
resultId
=
smearScalar
(
precision
,
resultId
,
smearedType
);
return
resultId
;
}
}
// Comments in header
// Comments in header
...
...
Test/baseResults/spv.texture.frag.out
View file @
7355eebb
This diff is collapsed.
Click to expand it.
Test/baseResults/spv.texture.vert.out
View file @
7355eebb
...
@@ -5,7 +5,7 @@ Linked vertex stage:
...
@@ -5,7 +5,7 @@ Linked vertex stage:
// Module Version 99
// Module Version 99
// Generated by (magic number): 51a00bb
// Generated by (magic number): 51a00bb
// Id's are bound by 14
1
// Id's are bound by 14
5
Source GLSL 130
Source GLSL 130
Capability Shader
Capability Shader
...
@@ -24,12 +24,12 @@ Linked vertex stage:
...
@@ -24,12 +24,12 @@ Linked vertex stage:
Name 76 "texSampler3D"
Name 76 "texSampler3D"
Name 92 "texSamplerCube"
Name 92 "texSamplerCube"
Name 102 "shadowSampler1D"
Name 102 "shadowSampler1D"
Name 11
3
"shadowSampler2D"
Name 11
4
"shadowSampler2D"
Name 1
36
"gl_Position"
Name 1
40
"gl_Position"
Name 14
0
"gl_VertexID"
Name 14
4
"gl_VertexID"
Decorate 1
36
(gl_Position) BuiltIn Position
Decorate 1
40
(gl_Position) BuiltIn Position
Decorate 14
0
(gl_VertexID) BuiltIn VertexId
Decorate 14
4
(gl_VertexID) BuiltIn VertexId
Decorate 14
0
(gl_VertexID) NoStaticUse
Decorate 14
4
(gl_VertexID) NoStaticUse
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeFloat 32
6: TypeFloat 32
...
@@ -70,15 +70,15 @@ Linked vertex stage:
...
@@ -70,15 +70,15 @@ Linked vertex stage:
100: TypeSampledImage 99
100: TypeSampledImage 99
101: TypePointer UniformConstant 100
101: TypePointer UniformConstant 100
102(shadowSampler1D): 101(ptr) Variable UniformConstant
102(shadowSampler1D): 101(ptr) Variable UniformConstant
11
0
: TypeImage 6(float) 2D depth sampled format:Unknown
11
1
: TypeImage 6(float) 2D depth sampled format:Unknown
11
1: TypeSampledImage 110
11
2: TypeSampledImage 111
11
2: TypePointer UniformConstant 111
11
3: TypePointer UniformConstant 112
11
3(shadowSampler2D): 112
(ptr) Variable UniformConstant
11
4(shadowSampler2D): 113
(ptr) Variable UniformConstant
13
5
: TypePointer Output 18(fvec4)
13
9
: TypePointer Output 18(fvec4)
1
36(gl_Position): 135
(ptr) Variable Output
1
40(gl_Position): 139
(ptr) Variable Output
1
38
: TypeInt 32 1
1
42
: TypeInt 32 1
1
39: TypePointer Input 138
(int)
1
43: TypePointer Input 142
(int)
14
0(gl_VertexID): 139
(ptr) Variable Input
14
4(gl_VertexID): 143
(ptr) Variable Input
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
8(lod): 7(ptr) Variable Function
8(lod): 7(ptr) Variable Function
...
@@ -158,35 +158,39 @@ Linked vertex stage:
...
@@ -158,35 +158,39 @@ Linked vertex stage:
104: 12(fvec3) Load 14(coords3D)
104: 12(fvec3) Load 14(coords3D)
105: 6(float) Load 8(lod)
105: 6(float) Load 8(lod)
106: 6(float) CompositeExtract 104 2
106: 6(float) CompositeExtract 104 2
107: 18(fvec4) ImageSampleDrefExplicitLod 103 104 106 105
107: 6(float) ImageSampleDrefExplicitLod 103 104 106 105
108: 18(fvec4) Load 23(color)
108: 18(fvec4) CompositeConstruct 107 107 107 107
109: 18(fvec4) FAdd 108 107
109: 18(fvec4) Load 23(color)
Store 23(color) 109
110: 18(fvec4) FAdd 109 108
114: 111 Load 113(shadowSampler2D)
Store 23(color) 110
115: 12(fvec3) Load 14(coords3D)
115: 112 Load 114(shadowSampler2D)
116: 6(float) Load 8(lod)
116: 12(fvec3) Load 14(coords3D)
117: 6(float) CompositeExtract 115 2
117: 6(float) Load 8(lod)
118: 18(fvec4) ImageSampleDrefExplicitLod 114 115 117 116
118: 6(float) CompositeExtract 116 2
119: 18(fvec4) Load 23(color)
119: 6(float) ImageSampleDrefExplicitLod 115 116 118 117
120: 18(fvec4) FAdd 119 118
120: 18(fvec4) CompositeConstruct 119 119 119 119
Store 23(color) 120
121: 18(fvec4) Load 23(color)
121: 100 Load 102(shadowSampler1D)
122: 18(fvec4) FAdd 121 120
122: 18(fvec4) Load 20(coords4D)
Store 23(color) 122
123: 6(float) Load 8(lod)
123: 100 Load 102(shadowSampler1D)
124: 6(float) CompositeExtract 122 3
124: 18(fvec4) Load 20(coords4D)
125: 18(fvec4) ImageSampleProjDrefExplicitLod 121 122 124 123
125: 6(float) Load 8(lod)
126: 18(fvec4) Load 23(color)
126: 6(float) CompositeExtract 124 3
127: 18(fvec4) FAdd 126 125
127: 6(float) ImageSampleProjDrefExplicitLod 123 124 126 125
Store 23(color) 127
128: 18(fvec4) CompositeConstruct 127 127 127 127
128: 111 Load 113(shadowSampler2D)
129: 18(fvec4) Load 23(color)
129: 18(fvec4) Load 20(coords4D)
130: 18(fvec4) FAdd 129 128
130: 6(float) Load 8(lod)
Store 23(color) 130
131: 6(float) CompositeExtract 129 3
131: 112 Load 114(shadowSampler2D)
132: 18(fvec4) ImageSampleProjDrefExplicitLod 128 129 131 130
132: 18(fvec4) Load 20(coords4D)
133: 18(fvec4) Load 23(color)
133: 6(float) Load 8(lod)
134: 18(fvec4) FAdd 133 132
134: 6(float) CompositeExtract 132 3
Store 23(color) 134
135: 6(float) ImageSampleProjDrefExplicitLod 131 132 134 133
136: 18(fvec4) CompositeConstruct 135 135 135 135
137: 18(fvec4) Load 23(color)
137: 18(fvec4) Load 23(color)
Store 136(gl_Position) 137
138: 18(fvec4) FAdd 137 136
Store 23(color) 138
141: 18(fvec4) Load 23(color)
Store 140(gl_Position) 141
Return
Return
FunctionEnd
FunctionEnd
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