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
a315b563
Commit
a315b563
authored
Jul 02, 2020
by
Chow
Committed by
Tobias Hector
Oct 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GL_EXT_fragment_shading_rate
parent
f4f1d8a3
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
266 additions
and
2 deletions
+266
-2
GLSL.ext.KHR.h
SPIRV/GLSL.ext.KHR.h
+1
-0
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+10
-0
doc.cpp
SPIRV/doc.cpp
+4
-0
spirv.hpp
SPIRV/spirv.hpp
+22
-0
spv.builtin.PrimitiveShadingRateEXT.vert.out
.../baseResults/spv.builtin.PrimitiveShadingRateEXT.vert.out
+53
-0
spv.builtin.ShadingRateEXT.frag.out
Test/baseResults/spv.builtin.ShadingRateEXT.frag.out
+36
-0
spv.builtin.PrimitiveShadingRateEXT.vert
Test/spv.builtin.PrimitiveShadingRateEXT.vert
+29
-0
spv.builtin.ShadingRateEXT.frag
Test/spv.builtin.ShadingRateEXT.frag
+8
-0
BaseTypes.h
glslang/Include/BaseTypes.h
+6
-0
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+87
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+2
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+3
-0
Versions.h
glslang/MachineIndependent/Versions.h
+1
-0
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+2
-0
known_good.json
known_good.json
+2
-2
No files found.
SPIRV/GLSL.ext.KHR.h
View file @
a315b563
...
@@ -48,4 +48,5 @@ static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shade
...
@@ -48,4 +48,5 @@ static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shade
static
const
char
*
const
E_SPV_KHR_non_semantic_info
=
"SPV_KHR_non_semantic_info"
;
static
const
char
*
const
E_SPV_KHR_non_semantic_info
=
"SPV_KHR_non_semantic_info"
;
static
const
char
*
const
E_SPV_KHR_ray_tracing
=
"SPV_KHR_ray_tracing"
;
static
const
char
*
const
E_SPV_KHR_ray_tracing
=
"SPV_KHR_ray_tracing"
;
static
const
char
*
const
E_SPV_KHR_ray_query
=
"SPV_KHR_ray_query"
;
static
const
char
*
const
E_SPV_KHR_ray_query
=
"SPV_KHR_ray_query"
;
static
const
char
*
const
E_SPV_KHR_fragment_shading_rate
=
"SPV_KHR_fragment_shading_rate"
;
#endif // #ifndef GLSLextKHR_H
#endif // #ifndef GLSLextKHR_H
SPIRV/GlslangToSpv.cpp
View file @
a315b563
...
@@ -769,6 +769,16 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -769,6 +769,16 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder
.
addCapability
(
spv
::
CapabilityStencilExportEXT
);
builder
.
addCapability
(
spv
::
CapabilityStencilExportEXT
);
return
spv
::
BuiltInFragStencilRefEXT
;
return
spv
::
BuiltInFragStencilRefEXT
;
case
glslang
:
:
EbvShadingRateKHR
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_fragment_shading_rate
);
builder
.
addCapability
(
spv
::
CapabilityFragmentShadingRateKHR
);
return
spv
::
BuiltInShadingRateKHR
;
case
glslang
:
:
EbvPrimitiveShadingRateKHR
:
builder
.
addExtension
(
spv
::
E_SPV_KHR_fragment_shading_rate
);
builder
.
addCapability
(
spv
::
CapabilityFragmentShadingRateKHR
);
return
spv
::
BuiltInPrimitiveShadingRateKHR
;
case
glslang
:
:
EbvInvocationId
:
return
spv
::
BuiltInInvocationId
;
case
glslang
:
:
EbvInvocationId
:
return
spv
::
BuiltInInvocationId
;
case
glslang
:
:
EbvTessLevelInner
:
return
spv
::
BuiltInTessLevelInner
;
case
glslang
:
:
EbvTessLevelInner
:
return
spv
::
BuiltInTessLevelInner
;
case
glslang
:
:
EbvTessLevelOuter
:
return
spv
::
BuiltInTessLevelOuter
;
case
glslang
:
:
EbvTessLevelOuter
:
return
spv
::
BuiltInTessLevelOuter
;
...
...
SPIRV/doc.cpp
View file @
a315b563
...
@@ -372,6 +372,8 @@ const char* BuiltInString(int builtIn)
...
@@ -372,6 +372,8 @@ const char* BuiltInString(int builtIn)
case
4424
:
return
"BaseVertex"
;
case
4424
:
return
"BaseVertex"
;
case
4425
:
return
"BaseInstance"
;
case
4425
:
return
"BaseInstance"
;
case
4426
:
return
"DrawIndex"
;
case
4426
:
return
"DrawIndex"
;
case
4432
:
return
"PrimitiveShadingRateKHR"
;
case
4444
:
return
"ShadingRateKHR"
;
case
5014
:
return
"FragStencilRefEXT"
;
case
5014
:
return
"FragStencilRefEXT"
;
case
4992
:
return
"BaryCoordNoPerspAMD"
;
case
4992
:
return
"BaryCoordNoPerspAMD"
;
...
@@ -952,6 +954,8 @@ const char* CapabilityString(int info)
...
@@ -952,6 +954,8 @@ const char* CapabilityString(int info)
case
CapabilityFragmentShaderPixelInterlockEXT
:
return
"CapabilityFragmentShaderPixelInterlockEXT"
;
case
CapabilityFragmentShaderPixelInterlockEXT
:
return
"CapabilityFragmentShaderPixelInterlockEXT"
;
case
CapabilityFragmentShaderShadingRateInterlockEXT
:
return
"CapabilityFragmentShaderShadingRateInterlockEXT"
;
case
CapabilityFragmentShaderShadingRateInterlockEXT
:
return
"CapabilityFragmentShaderShadingRateInterlockEXT"
;
case
CapabilityFragmentShadingRateKHR
:
return
"FragmentShadingRateKHR"
;
case
CapabilityDemoteToHelperInvocationEXT
:
return
"DemoteToHelperInvocationEXT"
;
case
CapabilityDemoteToHelperInvocationEXT
:
return
"DemoteToHelperInvocationEXT"
;
case
CapabilityShaderClockKHR
:
return
"ShaderClockKHR"
;
case
CapabilityShaderClockKHR
:
return
"ShaderClockKHR"
;
...
...
SPIRV/spirv.hpp
View file @
a315b563
...
@@ -558,8 +558,10 @@ enum BuiltIn {
...
@@ -558,8 +558,10 @@ enum BuiltIn {
BuiltInBaseVertex
=
4424
,
BuiltInBaseVertex
=
4424
,
BuiltInBaseInstance
=
4425
,
BuiltInBaseInstance
=
4425
,
BuiltInDrawIndex
=
4426
,
BuiltInDrawIndex
=
4426
,
BuiltInPrimitiveShadingRateKHR
=
4432
,
BuiltInDeviceIndex
=
4438
,
BuiltInDeviceIndex
=
4438
,
BuiltInViewIndex
=
4440
,
BuiltInViewIndex
=
4440
,
BuiltInShadingRateKHR
=
4444
,
BuiltInBaryCoordNoPerspAMD
=
4992
,
BuiltInBaryCoordNoPerspAMD
=
4992
,
BuiltInBaryCoordNoPerspCentroidAMD
=
4993
,
BuiltInBaryCoordNoPerspCentroidAMD
=
4993
,
BuiltInBaryCoordNoPerspSampleAMD
=
4994
,
BuiltInBaryCoordNoPerspSampleAMD
=
4994
,
...
@@ -870,6 +872,7 @@ enum Capability {
...
@@ -870,6 +872,7 @@ enum Capability {
CapabilityGroupNonUniformQuad
=
68
,
CapabilityGroupNonUniformQuad
=
68
,
CapabilityShaderLayer
=
69
,
CapabilityShaderLayer
=
69
,
CapabilityShaderViewportIndex
=
70
,
CapabilityShaderViewportIndex
=
70
,
CapabilityFragmentShadingRateKHR
=
4422
,
CapabilitySubgroupBallotKHR
=
4423
,
CapabilitySubgroupBallotKHR
=
4423
,
CapabilityDrawParameters
=
4427
,
CapabilityDrawParameters
=
4427
,
CapabilitySubgroupVoteKHR
=
4431
,
CapabilitySubgroupVoteKHR
=
4431
,
...
@@ -1024,6 +1027,22 @@ enum RayQueryCandidateIntersectionType {
...
@@ -1024,6 +1027,22 @@ enum RayQueryCandidateIntersectionType {
RayQueryCandidateIntersectionTypeMax
=
0x7fffffff
,
RayQueryCandidateIntersectionTypeMax
=
0x7fffffff
,
};
};
enum
FragmentShadingRateShift
{
FragmentShadingRateVertical2PixelsShift
=
0
,
FragmentShadingRateVertical4PixelsShift
=
1
,
FragmentShadingRateHorizontal2PixelsShift
=
2
,
FragmentShadingRateHorizontal4PixelsShift
=
3
,
FragmentShadingRateMax
=
0x7fffffff
,
};
enum
FragmentShadingRateMask
{
FragmentShadingRateMaskNone
=
0
,
FragmentShadingRateVertical2PixelsMask
=
0x00000001
,
FragmentShadingRateVertical4PixelsMask
=
0x00000002
,
FragmentShadingRateHorizontal2PixelsMask
=
0x00000004
,
FragmentShadingRateHorizontal4PixelsMask
=
0x00000008
,
};
enum
Op
{
enum
Op
{
OpNop
=
0
,
OpNop
=
0
,
OpUndef
=
1
,
OpUndef
=
1
,
...
@@ -1369,6 +1388,7 @@ enum Op {
...
@@ -1369,6 +1388,7 @@ enum Op {
OpPtrEqual
=
401
,
OpPtrEqual
=
401
,
OpPtrNotEqual
=
402
,
OpPtrNotEqual
=
402
,
OpPtrDiff
=
403
,
OpPtrDiff
=
403
,
OpTerminateInvocation
=
4416
,
OpSubgroupBallotKHR
=
4421
,
OpSubgroupBallotKHR
=
4421
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupFirstInvocationKHR
=
4422
,
OpSubgroupAllKHR
=
4428
,
OpSubgroupAllKHR
=
4428
,
...
@@ -1939,6 +1959,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
...
@@ -1939,6 +1959,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case
OpPtrEqual
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpPtrEqual
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpPtrNotEqual
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpPtrNotEqual
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpPtrDiff
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpPtrDiff
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpTerminateInvocation
:
*
hasResult
=
false
;
*
hasResultType
=
false
;
break
;
case
OpSubgroupBallotKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpSubgroupBallotKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpSubgroupFirstInvocationKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpSubgroupFirstInvocationKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpSubgroupAllKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
case
OpSubgroupAllKHR
:
*
hasResult
=
true
;
*
hasResultType
=
true
;
break
;
...
@@ -2164,6 +2185,7 @@ inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask
...
@@ -2164,6 +2185,7 @@ inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask
inline
MemoryAccessMask
operator
|
(
MemoryAccessMask
a
,
MemoryAccessMask
b
)
{
return
MemoryAccessMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
MemoryAccessMask
operator
|
(
MemoryAccessMask
a
,
MemoryAccessMask
b
)
{
return
MemoryAccessMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
KernelProfilingInfoMask
operator
|
(
KernelProfilingInfoMask
a
,
KernelProfilingInfoMask
b
)
{
return
KernelProfilingInfoMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
KernelProfilingInfoMask
operator
|
(
KernelProfilingInfoMask
a
,
KernelProfilingInfoMask
b
)
{
return
KernelProfilingInfoMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
RayFlagsMask
operator
|
(
RayFlagsMask
a
,
RayFlagsMask
b
)
{
return
RayFlagsMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
RayFlagsMask
operator
|
(
RayFlagsMask
a
,
RayFlagsMask
b
)
{
return
RayFlagsMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
inline
FragmentShadingRateMask
operator
|
(
FragmentShadingRateMask
a
,
FragmentShadingRateMask
b
)
{
return
FragmentShadingRateMask
(
unsigned
(
a
)
|
unsigned
(
b
));
}
}
// end namespace spv
}
// end namespace spv
...
...
Test/baseResults/spv.builtin.PrimitiveShadingRateEXT.vert.out
0 → 100644
View file @
a315b563
spv.builtin.PrimitiveShadingRateEXT.vert
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 26
Capability Shader
Capability FragmentShadingRateKHR
Extension "SPV_KHR_fragment_shading_rate"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 8 16
Source GLSL 450
SourceExtension "GL_EXT_fragment_shading_rate"
Name 4 "main"
Name 8 "id"
Name 16 "gl_PrimitiveShadingRateEXT"
Decorate 8(id) Location 0
Decorate 16(gl_PrimitiveShadingRateEXT) BuiltIn PrimitiveShadingRateKHR
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Input 6(int)
8(id): 7(ptr) Variable Input
15: TypePointer Output 6(int)
16(gl_PrimitiveShadingRateEXT): 15(ptr) Variable Output
17: 6(int) Constant 5
19: 6(int) Constant 9
21: 6(int) Constant 6
23: 6(int) Constant 10
4(main): 2 Function None 3
5: Label
9: 6(int) Load 8(id)
SelectionMerge 14 None
Switch 9 14
case 0: 10
case 1: 11
case 2: 12
case 3: 13
10: Label
Store 16(gl_PrimitiveShadingRateEXT) 17
Branch 14
11: Label
Store 16(gl_PrimitiveShadingRateEXT) 19
Branch 14
12: Label
Store 16(gl_PrimitiveShadingRateEXT) 21
Branch 14
13: Label
Store 16(gl_PrimitiveShadingRateEXT) 23
Branch 14
14: Label
Return
FunctionEnd
Test/baseResults/spv.builtin.ShadingRateEXT.frag.out
0 → 100644
View file @
a315b563
spv.builtin.ShadingRateEXT.frag
WARNING: 0:5: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 12
Capability Shader
Capability FragmentShadingRateKHR
Extension "SPV_KHR_fragment_shading_rate"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 10
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_fragment_shading_rate"
Name 4 "main"
Name 8 "val"
Name 10 "gl_ShadingRateEXT"
Decorate 8(val) Location 0
Decorate 10(gl_ShadingRateEXT) Flat
Decorate 10(gl_ShadingRateEXT) BuiltIn ShadingRateKHR
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(val): 7(ptr) Variable Output
9: TypePointer Input 6(int)
10(gl_ShadingRateEXT): 9(ptr) Variable Input
4(main): 2 Function None 3
5: Label
11: 6(int) Load 10(gl_ShadingRateEXT)
Store 8(val) 11
Return
FunctionEnd
Test/spv.builtin.PrimitiveShadingRateEXT.vert
0 → 100644
View file @
a315b563
#version 450
#extension GL_EXT_fragment_shading_rate : enable
layout
(
location
=
0
)
in
int
id
;
void
main
()
{
switch
(
id
)
{
case
0
:
// V2 | H2 => 5
gl_PrimitiveShadingRateEXT
=
gl_ShadingRateFlag2VerticalPixelsEXT
|
gl_ShadingRateFlag2HorizontalPixelsEXT
;
break
;
case
1
:
// V2 | H4 => 9
gl_PrimitiveShadingRateEXT
=
gl_ShadingRateFlag2VerticalPixelsEXT
|
gl_ShadingRateFlag4HorizontalPixelsEXT
;
break
;
case
2
:
// V4 | H2 => 6
gl_PrimitiveShadingRateEXT
=
gl_ShadingRateFlag4VerticalPixelsEXT
|
gl_ShadingRateFlag2HorizontalPixelsEXT
;
break
;
case
3
:
// V4 | H4 => 10
gl_PrimitiveShadingRateEXT
=
gl_ShadingRateFlag4VerticalPixelsEXT
|
gl_ShadingRateFlag4HorizontalPixelsEXT
;
break
;
}
}
\ No newline at end of file
Test/spv.builtin.ShadingRateEXT.frag
0 → 100644
View file @
a315b563
#version 450
#extension GL_EXT_fragment_shading_rate : enable
out
highp
int
val
;
void
main
()
{
val
=
gl_ShadingRateEXT
;
}
glslang/Include/BaseTypes.h
View file @
a315b563
...
@@ -228,6 +228,9 @@ enum TBuiltInVariable {
...
@@ -228,6 +228,9 @@ enum TBuiltInVariable {
EbvViewIndex
,
EbvViewIndex
,
EbvDeviceIndex
,
EbvDeviceIndex
,
EbvShadingRateKHR
,
EbvPrimitiveShadingRateKHR
,
EbvFragSizeEXT
,
EbvFragSizeEXT
,
EbvFragInvocationCountEXT
,
EbvFragInvocationCountEXT
,
...
@@ -480,6 +483,9 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
...
@@ -480,6 +483,9 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case
EbvWarpID
:
return
"WarpIDNV"
;
case
EbvWarpID
:
return
"WarpIDNV"
;
case
EbvSMID
:
return
"SMIDNV"
;
case
EbvSMID
:
return
"SMIDNV"
;
case
EbvShadingRateKHR
:
return
"ShadingRateKHR"
;
case
EbvPrimitiveShadingRateKHR
:
return
"PrimitiveShadingRateKHR"
;
default:
return
"unknown built-in variable"
;
default:
return
"unknown built-in variable"
;
}
}
}
}
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
a315b563
...
@@ -4928,6 +4928,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -4928,6 +4928,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"
\n
"
);
"
\n
"
);
}
}
if
((
profile
!=
EEsProfile
&&
version
>=
450
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
stageBuiltins
[
EShLangVertex
].
append
(
"out highp int gl_PrimitiveShadingRateEXT;"
// GL_EXT_fragment_shading_rate
"
\n
"
);
}
//============================================================================
//============================================================================
//
//
...
@@ -5041,6 +5046,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -5041,6 +5046,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"
\n
"
);
"
\n
"
);
}
}
if
((
profile
!=
EEsProfile
&&
version
>=
450
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
stageBuiltins
[
EShLangGeometry
].
append
(
"out highp int gl_PrimitiveShadingRateEXT;"
// GL_EXT_fragment_shading_rate
"
\n
"
);
}
//============================================================================
//============================================================================
//
//
// Define the interface to the tessellation control shader.
// Define the interface to the tessellation control shader.
...
@@ -5338,6 +5349,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -5338,6 +5349,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in vec3 gl_BaryCoordNoPerspNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
);
);
if
(
version
>=
450
)
stageBuiltins
[
EShLangFragment
].
append
(
"flat in int gl_ShadingRateEXT;"
// GL_EXT_fragment_shading_rate
);
}
else
{
}
else
{
// ES profile
// ES profile
...
@@ -5396,6 +5412,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -5396,6 +5412,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in vec3 gl_BaryCoordNV;"
"in vec3 gl_BaryCoordNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
);
);
if
(
version
>=
310
)
stageBuiltins
[
EShLangFragment
].
append
(
"flat in highp int gl_ShadingRateEXT;"
// GL_EXT_fragment_shading_rate
);
}
}
#endif
#endif
...
@@ -5692,6 +5712,18 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -5692,6 +5712,18 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in highp uint gl_ViewID_OVR;"
// GL_OVR_multiview, GL_OVR_multiview2
"flat in highp uint gl_ViewID_OVR;"
// GL_OVR_multiview, GL_OVR_multiview2
"
\n
"
);
"
\n
"
);
}
}
// Adding these to common built-ins triggers an assert due to a memory corruption in related code when testing
// So instead add to each stage individually, avoiding the GLSLang bug
if
((
profile
!=
EEsProfile
&&
version
>=
450
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
for
(
int
stage
=
EShLangVertex
;
stage
<
EShLangCount
;
stage
++
)
{
stageBuiltins
[
static_cast
<
EShLanguage
>
(
stage
)].
append
(
"const highp int gl_ShadingRateFlag2VerticalPixelsEXT = 1;
\n
"
);
stageBuiltins
[
static_cast
<
EShLanguage
>
(
stage
)].
append
(
"const highp int gl_ShadingRateFlag4VerticalPixelsEXT = 2;
\n
"
);
stageBuiltins
[
static_cast
<
EShLanguage
>
(
stage
)].
append
(
"const highp int gl_ShadingRateFlag2HorizontalPixelsEXT = 4;
\n
"
);
stageBuiltins
[
static_cast
<
EShLanguage
>
(
stage
)].
append
(
"const highp int gl_ShadingRateFlag4HorizontalPixelsEXT = 8;
\n
"
);
}
}
#endif // !GLSLANG_WEB
#endif // !GLSLANG_WEB
// printf("%s\n", commonBuiltins.c_str());
// printf("%s\n", commonBuiltins.c_str());
...
@@ -7650,6 +7682,20 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -7650,6 +7682,20 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
}
}
if
(
language
==
EShLangGeometry
||
language
==
EShLangVertex
)
{
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_PrimitiveShadingRateEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
BuiltInVariable
(
"gl_PrimitiveShadingRateEXT"
,
EbvPrimitiveShadingRateKHR
,
symbolTable
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
}
#endif // !GLSLANG_WEB
#endif // !GLSLANG_WEB
break
;
break
;
...
@@ -8156,6 +8202,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -8156,6 +8202,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
}
symbolTable
.
setFunctionExtensions
(
"helperInvocationEXT"
,
1
,
&
E_GL_EXT_demote_to_helper_invocation
);
symbolTable
.
setFunctionExtensions
(
"helperInvocationEXT"
,
1
,
&
E_GL_EXT_demote_to_helper_invocation
);
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
BuiltInVariable
(
"gl_ShadingRateEXT"
,
EbvShadingRateKHR
,
symbolTable
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
#endif // !GLSLANG_WEB
#endif // !GLSLANG_WEB
break
;
break
;
...
@@ -8288,6 +8345,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -8288,6 +8345,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setFunctionExtensions
(
"dFdyCoarse"
,
1
,
&
E_GL_NV_compute_shader_derivatives
);
symbolTable
.
setFunctionExtensions
(
"dFdyCoarse"
,
1
,
&
E_GL_NV_compute_shader_derivatives
);
symbolTable
.
setFunctionExtensions
(
"fwidthCoarse"
,
1
,
&
E_GL_NV_compute_shader_derivatives
);
symbolTable
.
setFunctionExtensions
(
"fwidthCoarse"
,
1
,
&
E_GL_NV_compute_shader_derivatives
);
}
}
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
#endif // !GLSLANG_WEB
#endif // !GLSLANG_WEB
break
;
break
;
...
@@ -8437,6 +8502,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -8437,6 +8502,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
}
}
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
break
;
break
;
case
EShLangMeshNV
:
case
EShLangMeshNV
:
...
@@ -8581,6 +8653,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -8581,6 +8653,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
}
}
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
break
;
break
;
case
EShLangTaskNV
:
case
EShLangTaskNV
:
...
@@ -8681,6 +8761,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -8681,6 +8761,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_WarpIDNV"
,
EbvWarpID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
BuiltInVariable
(
"gl_SMIDNV"
,
EbvSMID
,
symbolTable
);
}
}
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
450
))
{
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4VerticalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag2HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
symbolTable
.
setVariableExtensions
(
"gl_ShadingRateFlag4HorizontalPixelsEXT"
,
1
,
&
E_GL_EXT_fragment_shading_rate
);
}
break
;
break
;
#endif
#endif
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
a315b563
...
@@ -4226,6 +4226,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
...
@@ -4226,6 +4226,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
(
identifier
==
"gl_FragCoord"
&&
((
nonEsRedecls
&&
version
>=
150
)
||
esRedecls
))
||
(
identifier
==
"gl_FragCoord"
&&
((
nonEsRedecls
&&
version
>=
150
)
||
esRedecls
))
||
identifier
==
"gl_ClipDistance"
||
identifier
==
"gl_ClipDistance"
||
identifier
==
"gl_CullDistance"
||
identifier
==
"gl_CullDistance"
||
identifier
==
"gl_ShadingRateEXT"
||
identifier
==
"gl_PrimitiveShadingRateEXT"
||
identifier
==
"gl_FrontColor"
||
identifier
==
"gl_FrontColor"
||
identifier
==
"gl_BackColor"
||
identifier
==
"gl_BackColor"
||
identifier
==
"gl_FrontSecondaryColor"
||
identifier
==
"gl_FrontSecondaryColor"
||
...
...
glslang/MachineIndependent/Versions.cpp
View file @
a315b563
...
@@ -327,6 +327,7 @@ void TParseVersions::initializeExtensionBehavior()
...
@@ -327,6 +327,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_EXT_ray_flags_primitive_culling
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_flags_primitive_culling
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_blend_func_extended
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_blend_func_extended
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_shader_implicit_conversions
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_shader_implicit_conversions
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_fragment_shading_rate
]
=
EBhDisable
;
// OVR extensions
// OVR extensions
extensionBehavior
[
E_GL_OVR_multiview
]
=
EBhDisable
;
extensionBehavior
[
E_GL_OVR_multiview
]
=
EBhDisable
;
...
@@ -371,6 +372,7 @@ void TParseVersions::getPreamble(std::string& preamble)
...
@@ -371,6 +372,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_YUV_target 1
\n
"
"#define GL_EXT_YUV_target 1
\n
"
"#define GL_EXT_shader_texture_lod 1
\n
"
"#define GL_EXT_shader_texture_lod 1
\n
"
"#define GL_EXT_shadow_samplers 1
\n
"
"#define GL_EXT_shadow_samplers 1
\n
"
"#define GL_EXT_fragment_shading_rate 1
\n
"
// AEP
// AEP
"#define GL_ANDROID_extension_pack_es31a 1
\n
"
"#define GL_ANDROID_extension_pack_es31a 1
\n
"
...
@@ -463,6 +465,7 @@ void TParseVersions::getPreamble(std::string& preamble)
...
@@ -463,6 +465,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_buffer_reference_uvec2 1
\n
"
"#define GL_EXT_buffer_reference_uvec2 1
\n
"
"#define GL_EXT_demote_to_helper_invocation 1
\n
"
"#define GL_EXT_demote_to_helper_invocation 1
\n
"
"#define GL_EXT_debug_printf 1
\n
"
"#define GL_EXT_debug_printf 1
\n
"
"#define GL_EXT_fragment_shading_rate 1
\n
"
// GL_KHR_shader_subgroup
// GL_KHR_shader_subgroup
"#define GL_KHR_shader_subgroup_basic 1
\n
"
"#define GL_KHR_shader_subgroup_basic 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
a315b563
...
@@ -199,6 +199,7 @@ const char* const E_GL_EXT_ray_query = "GL_EXT_ray_query"
...
@@ -199,6 +199,7 @@ const char* const E_GL_EXT_ray_query = "GL_EXT_ray_query"
const
char
*
const
E_GL_EXT_ray_flags_primitive_culling
=
"GL_EXT_ray_flags_primitive_culling"
;
const
char
*
const
E_GL_EXT_ray_flags_primitive_culling
=
"GL_EXT_ray_flags_primitive_culling"
;
const
char
*
const
E_GL_EXT_blend_func_extended
=
"GL_EXT_blend_func_extended"
;
const
char
*
const
E_GL_EXT_blend_func_extended
=
"GL_EXT_blend_func_extended"
;
const
char
*
const
E_GL_EXT_shader_implicit_conversions
=
"GL_EXT_shader_implicit_conversions"
;
const
char
*
const
E_GL_EXT_shader_implicit_conversions
=
"GL_EXT_shader_implicit_conversions"
;
const
char
*
const
E_GL_EXT_fragment_shading_rate
=
"GL_EXT_fragment_shading_rate"
;
// Arrays of extensions for the above viewportEXTs duplications
// Arrays of extensions for the above viewportEXTs duplications
...
...
gtests/Spv.FromFile.cpp
View file @
a315b563
...
@@ -446,6 +446,8 @@ INSTANTIATE_TEST_SUITE_P(
...
@@ -446,6 +446,8 @@ INSTANTIATE_TEST_SUITE_P(
"spv.samplerlessTextureFunctions.frag"
,
"spv.samplerlessTextureFunctions.frag"
,
"spv.smBuiltins.vert"
,
"spv.smBuiltins.vert"
,
"spv.smBuiltins.frag"
,
"spv.smBuiltins.frag"
,
"spv.builtin.PrimitiveShadingRateEXT.vert"
,
"spv.builtin.ShadingRateEXT.frag"
,
})),
})),
FileNameAsCustomTestSuffix
FileNameAsCustomTestSuffix
);
);
...
...
known_good.json
View file @
a315b563
...
@@ -5,14 +5,14 @@
...
@@ -5,14 +5,14 @@
"site"
:
"github"
,
"site"
:
"github"
,
"subrepo"
:
"KhronosGroup/SPIRV-Tools"
,
"subrepo"
:
"KhronosGroup/SPIRV-Tools"
,
"subdir"
:
"External/spirv-tools"
,
"subdir"
:
"External/spirv-tools"
,
"commit"
:
"
0a1fb588cd365f7737cb121fdd64553923e0cef6
"
"commit"
:
"
a1d38174b1f7d2651c718ae661886d606cb50a32
"
},
},
{
{
"name"
:
"spirv-tools/external/spirv-headers"
,
"name"
:
"spirv-tools/external/spirv-headers"
,
"site"
:
"github"
,
"site"
:
"github"
,
"subrepo"
:
"KhronosGroup/SPIRV-Headers"
,
"subrepo"
:
"KhronosGroup/SPIRV-Headers"
,
"subdir"
:
"External/spirv-tools/external/spirv-headers"
,
"subdir"
:
"External/spirv-tools/external/spirv-headers"
,
"commit"
:
"0
60627f0b0d2fa8581b5acb939f46e3b9e500593
"
"commit"
:
"0
5836bdba63e7debce9fa9feaed42f20cd43af9d
"
}
}
]
]
}
}
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