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
46572440
Commit
46572440
authored
Apr 12, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2178: Allow specialization constants for texel offsets.
parent
fd593d5f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
4 deletions
+61
-4
spv.specTexture.frag.out
Test/baseResults/spv.specTexture.frag.out
+43
-0
spv.specTexture.frag
Test/spv.specTexture.frag
+11
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+6
-4
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
Test/baseResults/spv.specTexture.frag.out
0 → 100755
View file @
46572440
spv.specTexture.frag
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 23
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
ExecutionMode 4 OriginLowerLeft
Source GLSL 450
Name 4 "main"
Name 9 "color_out"
Name 13 "tex"
Name 19 "offs"
Decorate 9(color_out) Location 0
Decorate 13(tex) DescriptorSet 0
Decorate 13(tex) Binding 0
Decorate 19(offs) SpecId 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(color_out): 8(ptr) Variable Output
10: TypeImage 6(float) 2D sampled format:Unknown
11: TypeSampledImage 10
12: TypePointer UniformConstant 11
13(tex): 12(ptr) Variable UniformConstant
15: TypeVector 6(float) 2
16: 6(float) Constant 0
17: 15(fvec2) ConstantComposite 16 16
18: TypeInt 32 1
19(offs): 18(int) SpecConstant 0
20: TypeVector 18(int) 2
21: 20(ivec2) SpecConstantComposite 19(offs) 19(offs)
4(main): 2 Function None 3
5: Label
14: 11 Load 13(tex)
22: 7(fvec4) ImageSampleExplicitLod 14 17 Lod ConstOffset 16 21
Store 9(color_out) 22
Return
FunctionEnd
Test/spv.specTexture.frag
0 → 100644
View file @
46572440
#version 450
layout
(
constant_id
=
1
)
const
int
offs
=
0
;
layout
(
binding
=
0
)
uniform
sampler2D
tex
;
layout
(
location
=
0
)
out
vec4
color_out
;
void
main
(
void
)
{
color_out
=
textureLodOffset
(
tex
,
vec2
(
0
.
0
,
0
.
0
),
0
.
0
,
ivec2
(
offs
,
offs
));
}
\ No newline at end of file
glslang/MachineIndependent/ParseHelper.cpp
View file @
46572440
...
@@ -2013,18 +2013,20 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
...
@@ -2013,18 +2013,20 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if
(
arg
>
0
)
{
if
(
arg
>
0
)
{
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
bool
f16ShadowCompare
=
(
*
argp
)[
1
]
->
getAsTyped
()
->
getBasicType
()
==
EbtFloat16
&&
arg0
->
getType
().
getSampler
().
shadow
;
bool
f16ShadowCompare
=
(
*
argp
)[
1
]
->
getAsTyped
()
->
getBasicType
()
==
EbtFloat16
&&
arg0
->
getType
().
getSampler
().
shadow
;
if
(
f16ShadowCompare
)
if
(
f16ShadowCompare
)
++
arg
;
++
arg
;
#endif
#endif
if
(
!
(
*
argp
)[
arg
]
->
getAs
ConstantUnion
())
if
(
!
(
*
argp
)[
arg
]
->
getAs
Typed
()
->
getQualifier
().
isConstant
())
error
(
loc
,
"argument must be compile-time constant"
,
"texel offset"
,
""
);
error
(
loc
,
"argument must be compile-time constant"
,
"texel offset"
,
""
);
else
{
else
if
((
*
argp
)[
arg
]
->
getAsConstantUnion
())
{
const
TType
&
type
=
(
*
argp
)[
arg
]
->
getAsTyped
()
->
getType
();
const
TType
&
type
=
(
*
argp
)[
arg
]
->
getAsTyped
()
->
getType
();
for
(
int
c
=
0
;
c
<
type
.
getVectorSize
();
++
c
)
{
for
(
int
c
=
0
;
c
<
type
.
getVectorSize
();
++
c
)
{
int
offset
=
(
*
argp
)[
arg
]
->
getAsConstantUnion
()
->
getConstArray
()[
c
].
getIConst
();
int
offset
=
(
*
argp
)[
arg
]
->
getAsConstantUnion
()
->
getConstArray
()[
c
].
getIConst
();
if
(
offset
>
resources
.
maxProgramTexelOffset
||
offset
<
resources
.
minProgramTexelOffset
)
if
(
offset
>
resources
.
maxProgramTexelOffset
||
offset
<
resources
.
minProgramTexelOffset
)
error
(
loc
,
"value is out of range:"
,
"texel offset"
,
"[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"
);
error
(
loc
,
"value is out of range:"
,
"texel offset"
,
"[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"
);
}
}
}
}
}
}
...
...
gtests/Spv.FromFile.cpp
View file @
46572440
...
@@ -598,6 +598,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -598,6 +598,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.glFragColor.frag"
,
"spv.glFragColor.frag"
,
"spv.rankShift.comp"
,
"spv.rankShift.comp"
,
"spv.specConst.vert"
,
"spv.specConst.vert"
,
"spv.specTexture.frag"
,
"spv.OVR_multiview.vert"
,
"spv.OVR_multiview.vert"
,
"spv.xfbOffsetOnBlockMembersAssignment.vert"
,
"spv.xfbOffsetOnBlockMembersAssignment.vert"
,
"spv.xfbOffsetOnStructMembersAssignment.vert"
,
"spv.xfbOffsetOnStructMembersAssignment.vert"
,
...
...
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