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
5b2203db
Commit
5b2203db
authored
Sep 19, 2018
by
Chao Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add-support-for-SPV_NV_shading_rate
parent
b50c02ef
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
94 additions
and
1 deletion
+94
-1
GLSL.ext.NV.h
SPIRV/GLSL.ext.NV.h
+4
-1
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+8
-0
doc.cpp
SPIRV/doc.cpp
+3
-0
spv.shadingRate.frag.out
Test/baseResults/spv.shadingRate.frag.out
+48
-0
spv.shadingRate.frag
Test/spv.shadingRate.frag
+12
-0
BaseTypes.h
glslang/Include/BaseTypes.h
+4
-0
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+11
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+2
-0
Versions.h
glslang/MachineIndependent/Versions.h
+1
-0
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
SPIRV/GLSL.ext.NV.h
View file @
5b2203db
...
...
@@ -33,7 +33,7 @@ enum Op;
enum
Capability
;
static
const
int
GLSLextNVVersion
=
100
;
static
const
int
GLSLextNVRevision
=
1
0
;
static
const
int
GLSLextNVRevision
=
1
1
;
//SPV_NV_sample_mask_override_coverage
const
char
*
const
E_SPV_NV_sample_mask_override_coverage
=
"SPV_NV_sample_mask_override_coverage"
;
...
...
@@ -69,4 +69,7 @@ const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader";
//SPV_NVX_raytracing
const
char
*
const
E_SPV_NVX_raytracing
=
"SPV_NVX_raytracing"
;
//SPV_NV_shading_rate
const
char
*
const
E_SPV_NV_shading_rate
=
"SPV_NV_shading_rate"
;
#endif // #ifndef GLSLextNV_H
SPIRV/GlslangToSpv.cpp
View file @
5b2203db
...
...
@@ -864,6 +864,14 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder
.
addExtension
(
spv
::
E_SPV_EXT_fragment_fully_covered
);
builder
.
addCapability
(
spv
::
CapabilityFragmentFullyCoveredEXT
);
return
spv
::
BuiltInFullyCoveredEXT
;
case
glslang
:
:
EbvFragmentSizeNV
:
builder
.
addExtension
(
spv
::
E_SPV_NV_shading_rate
);
builder
.
addCapability
(
spv
::
CapabilityShadingRateNV
);
return
spv
::
BuiltInFragmentSizeNV
;
case
glslang
:
:
EbvInvocationsPerPixelNV
:
builder
.
addExtension
(
spv
::
E_SPV_NV_shading_rate
);
builder
.
addCapability
(
spv
::
CapabilityShadingRateNV
);
return
spv
::
BuiltInInvocationsPerPixelNV
;
// raytracing
case
glslang
:
:
EbvLaunchIdNV
:
...
...
SPIRV/doc.cpp
View file @
5b2203db
...
...
@@ -385,6 +385,8 @@ const char* BuiltInString(int builtIn)
case
BuiltInSecondaryViewportMaskNV
:
return
"SecondaryViewportMaskNV"
;
case
BuiltInPositionPerViewNV
:
return
"PositionPerViewNV"
;
case
BuiltInViewportMaskPerViewNV
:
return
"ViewportMaskPerViewNV"
;
case
BuiltInFragmentSizeNV
:
return
"FragmentSizeNV"
;
case
BuiltInInvocationsPerPixelNV
:
return
"InvocationsPerPixelNV"
;
case
BuiltInBaryCoordNV
:
return
"BaryCoordNV"
;
case
BuiltInBaryCoordNoPerspNV
:
return
"BaryCoordNoPerspNV"
;
#endif
...
...
@@ -892,6 +894,7 @@ const char* CapabilityString(int info)
case
CapabilityComputeDerivativeGroupLinearNV
:
return
"ComputeDerivativeGroupLinearNV"
;
case
CapabilityFragmentBarycentricNV
:
return
"FragmentBarycentricNV"
;
case
CapabilityMeshShadingNV
:
return
"MeshShadingNV"
;
case
CapabilityShadingRateNV
:
return
"ShadingRateNV"
;
#endif
case
CapabilityFragmentFullyCoveredEXT
:
return
"FragmentFullyCoveredEXT"
;
...
...
Test/baseResults/spv.shadingRate.frag.out
0 → 100644
View file @
5b2203db
spv.shadingRate.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 21
Capability Shader
Capability ShadingRateNV
Extension "SPV_NV_shading_rate"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 13 17 19
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_NV_shading_rate_image"
Name 4 "main"
Name 9 "FragmentSize"
Name 13 "gl_FragmentSizeNV"
Name 17 "InvocationsPerPixel"
Name 19 "gl_InvocationsPerPixelNV"
Decorate 9(FragmentSize) Location 0
Decorate 13(gl_FragmentSizeNV) Flat
Decorate 13(gl_FragmentSizeNV) BuiltIn FragmentSizeNV
Decorate 17(InvocationsPerPixel) Location 2
Decorate 19(gl_InvocationsPerPixelNV) Flat
Decorate 19(gl_InvocationsPerPixelNV) BuiltIn InvocationsPerPixelNV
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 2
8: TypePointer Output 7(fvec2)
9(FragmentSize): 8(ptr) Variable Output
10: TypeInt 32 1
11: TypeVector 10(int) 2
12: TypePointer Input 11(ivec2)
13(gl_FragmentSizeNV): 12(ptr) Variable Input
16: TypePointer Output 10(int)
17(InvocationsPerPixel): 16(ptr) Variable Output
18: TypePointer Input 10(int)
19(gl_InvocationsPerPixelNV): 18(ptr) Variable Input
4(main): 2 Function None 3
5: Label
14: 11(ivec2) Load 13(gl_FragmentSizeNV)
15: 7(fvec2) ConvertSToF 14
Store 9(FragmentSize) 15
20: 10(int) Load 19(gl_InvocationsPerPixelNV)
Store 17(InvocationsPerPixel) 20
Return
FunctionEnd
Test/spv.shadingRate.frag
0 → 100644
View file @
5b2203db
#version 450
#extension GL_NV_shading_rate_image : require
layout
(
location
=
0
)
out
vec2
FragmentSize
;
layout
(
location
=
2
)
out
int
InvocationsPerPixel
;
void
main
()
{
FragmentSize
=
gl_FragmentSizeNV
;
InvocationsPerPixel
=
gl_InvocationsPerPixelNV
;
}
\ No newline at end of file
glslang/Include/BaseTypes.h
View file @
5b2203db
...
...
@@ -237,6 +237,8 @@ enum TBuiltInVariable {
EbvPositionPerViewNV
,
EbvViewportMaskPerViewNV
,
EbvFragFullyCoveredNV
,
EbvFragmentSizeNV
,
EbvInvocationsPerPixelNV
,
// raytracing
EbvLaunchIdNV
,
EbvLaunchSizeNV
,
...
...
@@ -404,6 +406,8 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case
EbvPositionPerViewNV
:
return
"PositionPerViewNV"
;
case
EbvViewportMaskPerViewNV
:
return
"ViewportMaskPerViewNV"
;
case
EbvFragFullyCoveredNV
:
return
"FragFullyCoveredNV"
;
case
EbvFragmentSizeNV
:
return
"FragmentSizeNV"
;
case
EbvInvocationsPerPixelNV
:
return
"InvocationsPerPixelNV"
;
case
EbvLaunchIdNV
:
return
"LaunchIdNVX"
;
case
EbvLaunchSizeNV
:
return
"LaunchSizeNVX"
;
case
EbvInstanceCustomIndexNV
:
return
"InstanceCustomIndexNVX"
;
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
5b2203db
...
...
@@ -5949,6 +5949,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
if
(
version
>=
450
)
stageBuiltins
[
EShLangFragment
].
append
(
"flat in ivec2 gl_FragmentSizeNV;"
"flat in int gl_InvocationsPerPixelNV;"
"in vec3 gl_BaryCoordNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
);
...
...
@@ -5995,6 +5997,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"highp float gl_FragDepthEXT;"
// GL_EXT_frag_depth
);
#ifdef NV_EXTENSIONS
if
(
version
>=
320
)
stageBuiltins
[
EShLangFragment
].
append
(
"flat in ivec2 gl_FragmentSizeNV;"
"flat in int gl_InvocationsPerPixelNV;"
);
if
(
version
>=
320
)
stageBuiltins
[
EShLangFragment
].
append
(
"in vec3 gl_BaryCoordNV;"
...
...
@@ -8286,6 +8293,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
if
((
profile
!=
EEsProfile
&&
version
>=
450
)
||
(
profile
==
EEsProfile
&&
version
>=
320
))
{
symbolTable
.
setVariableExtensions
(
"gl_FragmentSizeNV"
,
1
,
&
E_GL_NV_shading_rate_image
);
symbolTable
.
setVariableExtensions
(
"gl_InvocationsPerPixelNV"
,
1
,
&
E_GL_NV_shading_rate_image
);
BuiltInVariable
(
"gl_FragmentSizeNV"
,
EbvFragmentSizeNV
,
symbolTable
);
BuiltInVariable
(
"gl_InvocationsPerPixelNV"
,
EbvInvocationsPerPixelNV
,
symbolTable
);
symbolTable
.
setVariableExtensions
(
"gl_BaryCoordNV"
,
1
,
&
E_GL_NV_fragment_shader_barycentric
);
symbolTable
.
setVariableExtensions
(
"gl_BaryCoordNoPerspNV"
,
1
,
&
E_GL_NV_fragment_shader_barycentric
);
BuiltInVariable
(
"gl_BaryCoordNV"
,
EbvBaryCoordNV
,
symbolTable
);
...
...
glslang/MachineIndependent/Versions.cpp
View file @
5b2203db
...
...
@@ -235,6 +235,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_NV_conservative_raster_underestimation
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NV_shader_noperspective_interpolation
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NV_shader_subgroup_partitioned
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NV_shading_rate_image
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NVX_raytracing
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NV_fragment_shader_barycentric
]
=
EBhDisable
;
extensionBehavior
[
E_GL_NV_compute_shader_derivatives
]
=
EBhDisable
;
...
...
@@ -410,6 +411,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_NV_shader_atomic_int64 1
\n
"
"#define GL_NV_conservative_raster_underestimation 1
\n
"
"#define GL_NV_shader_subgroup_partitioned 1
\n
"
"#define GL_NV_shading_rate_image 1
\n
"
"#define GL_NVX_raytracing 1
\n
"
"#define GL_NV_fragment_shader_barycentric 1
\n
"
"#define GL_NV_compute_shader_derivatives 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
5b2203db
...
...
@@ -207,6 +207,7 @@ const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_
const
char
*
const
E_GL_NV_conservative_raster_underestimation
=
"GL_NV_conservative_raster_underestimation"
;
const
char
*
const
E_GL_NV_shader_noperspective_interpolation
=
"GL_NV_shader_noperspective_interpolation"
;
const
char
*
const
E_GL_NV_shader_subgroup_partitioned
=
"GL_NV_shader_subgroup_partitioned"
;
const
char
*
const
E_GL_NV_shading_rate_image
=
"GL_NV_shading_rate_image"
;
const
char
*
const
E_GL_NVX_raytracing
=
"GL_NVX_raytracing"
;
const
char
*
const
E_GL_NV_fragment_shader_barycentric
=
"GL_NV_fragment_shader_barycentric"
;
const
char
*
const
E_GL_NV_compute_shader_derivatives
=
"GL_NV_compute_shader_derivatives"
;
...
...
gtests/Spv.FromFile.cpp
View file @
5b2203db
...
...
@@ -501,6 +501,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.multiviewPerViewAttributes.vert"
,
"spv.multiviewPerViewAttributes.tesc"
,
"spv.atomicInt64.comp"
,
"spv.shadingRate.frag"
,
"spv.RayGenShader.rgen"
,
"spv.RayGenShader_Errors.rgen"
,
"spv.RayConstants.rgen"
,
...
...
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