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
37cdceed
Commit
37cdceed
authored
Jun 29, 2017
by
Rex Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement extension GL_ARB_shader_stencil_export
parent
89f8d1e6
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
3 deletions
+55
-3
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+4
-0
spv.shaderStencilExport.frag.out
Test/baseResults/spv.shaderStencilExport.frag.out
+26
-0
spv.shaderStencilExport.frag
Test/spv.shaderStencilExport.frag
+8
-0
BaseTypes.h
glslang/Include/BaseTypes.h
+2
-1
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+9
-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
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+1
-1
hlslScanContext.cpp
hlsl/hlslScanContext.cpp
+1
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
37cdceed
...
@@ -520,6 +520,10 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -520,6 +520,10 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder
.
addCapability
(
spv
::
CapabilityGeometry
);
builder
.
addCapability
(
spv
::
CapabilityGeometry
);
return
spv
::
BuiltInPrimitiveId
;
return
spv
::
BuiltInPrimitiveId
;
case
glslang
:
:
EbvFragStencilRef
:
logger
->
missingFunctionality
(
"shader stencil export"
);
return
spv
::
BuiltInMax
;
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
;
...
...
Test/baseResults/spv.shaderStencilExport.frag.out
0 → 100644
View file @
37cdceed
spv.shaderStencilExport.frag
Missing functionality: shader stencil export
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 10
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_ARB_shader_stencil_export"
Name 4 "main"
Name 8 "gl_FragStencilRefARB"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(gl_FragStencilRefARB): 7(ptr) Variable Output
9: 6(int) Constant 100
4(main): 2 Function None 3
5: Label
Store 8(gl_FragStencilRefARB) 9
Return
FunctionEnd
Test/spv.shaderStencilExport.frag
0 → 100644
View file @
37cdceed
#version 450 core
#extension GL_ARB_shader_stencil_export: enable
void
main
()
{
gl_FragStencilRefARB
=
100
;
}
glslang/Include/BaseTypes.h
View file @
37cdceed
...
@@ -193,6 +193,7 @@ enum TBuiltInVariable {
...
@@ -193,6 +193,7 @@ enum TBuiltInVariable {
EbvFragColor
,
EbvFragColor
,
EbvFragData
,
EbvFragData
,
EbvFragDepth
,
EbvFragDepth
,
EbvFragStencilRef
,
EbvSampleId
,
EbvSampleId
,
EbvSamplePosition
,
EbvSamplePosition
,
EbvSampleMask
,
EbvSampleMask
,
...
@@ -222,7 +223,6 @@ enum TBuiltInVariable {
...
@@ -222,7 +223,6 @@ enum TBuiltInVariable {
// to one of the above.
// to one of the above.
EbvFragDepthGreater
,
EbvFragDepthGreater
,
EbvFragDepthLesser
,
EbvFragDepthLesser
,
EbvStencilRef
,
EbvGsOutputStream
,
EbvGsOutputStream
,
EbvOutputPatch
,
EbvOutputPatch
,
EbvInputPatch
,
EbvInputPatch
,
...
@@ -329,6 +329,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
...
@@ -329,6 +329,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case
EbvFragColor
:
return
"FragColor"
;
case
EbvFragColor
:
return
"FragColor"
;
case
EbvFragData
:
return
"FragData"
;
case
EbvFragData
:
return
"FragData"
;
case
EbvFragDepth
:
return
"FragDepth"
;
case
EbvFragDepth
:
return
"FragDepth"
;
case
EbvFragStencilRef
:
return
"FragStencilRef"
;
case
EbvSampleId
:
return
"SampleId"
;
case
EbvSampleId
:
return
"SampleId"
;
case
EbvSamplePosition
:
return
"SamplePosition"
;
case
EbvSamplePosition
:
return
"SamplePosition"
;
case
EbvSampleMask
:
return
"SampleMaskIn"
;
case
EbvSampleMask
:
return
"SampleMaskIn"
;
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
37cdceed
...
@@ -3753,6 +3753,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -3753,6 +3753,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec2 gl_PointCoord;"
// needs qualifier fixed later
"vec2 gl_PointCoord;"
// needs qualifier fixed later
);
);
if
(
version
>=
140
)
stageBuiltins
[
EShLangFragment
].
append
(
"out int gl_FragStencilRefARB;"
);
if
(
IncludeLegacy
(
version
,
profile
,
spvVersion
)
||
(
!
ForwardCompatibility
&&
version
<
420
))
if
(
IncludeLegacy
(
version
,
profile
,
spvVersion
)
||
(
!
ForwardCompatibility
&&
version
<
420
))
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec4 gl_FragColor;"
// needs qualifier fixed later
"vec4 gl_FragColor;"
// needs qualifier fixed later
...
@@ -5473,6 +5477,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -5473,6 +5477,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable
(
"gl_CullDistance"
,
EbvCullDistance
,
symbolTable
);
BuiltInVariable
(
"gl_CullDistance"
,
EbvCullDistance
,
symbolTable
);
BuiltInVariable
(
"gl_PrimitiveID"
,
EbvPrimitiveId
,
symbolTable
);
BuiltInVariable
(
"gl_PrimitiveID"
,
EbvPrimitiveId
,
symbolTable
);
if
(
profile
!=
EEsProfile
&&
version
>=
140
)
{
symbolTable
.
setVariableExtensions
(
"gl_FragStencilRefARB"
,
1
,
&
E_GL_ARB_shader_stencil_export
);
BuiltInVariable
(
"gl_FragStencilRefARB"
,
EbvFragStencilRef
,
symbolTable
);
}
if
((
profile
!=
EEsProfile
&&
version
>=
400
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
400
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
(
profile
==
EEsProfile
&&
version
>=
310
))
{
BuiltInVariable
(
"gl_SampleID"
,
EbvSampleId
,
symbolTable
);
BuiltInVariable
(
"gl_SampleID"
,
EbvSampleId
,
symbolTable
);
...
...
glslang/MachineIndependent/Versions.cpp
View file @
37cdceed
...
@@ -179,6 +179,7 @@ void TParseVersions::initializeExtensionBehavior()
...
@@ -179,6 +179,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_ARB_shader_ballot
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_ballot
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_sparse_texture2
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_sparse_texture2
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_sparse_texture_clamp
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_sparse_texture_clamp
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_stencil_export
]
=
EBhDisable
;
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
extensionBehavior
[
E_GL_EXT_shader_non_constant_global_initializers
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_shader_non_constant_global_initializers
]
=
EBhDisable
;
...
@@ -309,6 +310,7 @@ void TParseVersions::getPreamble(std::string& preamble)
...
@@ -309,6 +310,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_shader_ballot 1
\n
"
"#define GL_ARB_shader_ballot 1
\n
"
"#define GL_ARB_sparse_texture2 1
\n
"
"#define GL_ARB_sparse_texture2 1
\n
"
"#define GL_ARB_sparse_texture_clamp 1
\n
"
"#define GL_ARB_sparse_texture_clamp 1
\n
"
"#define GL_ARB_shader_stencil_export 1
\n
"
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
"#define GL_EXT_shader_non_constant_global_initializers 1
\n
"
"#define GL_EXT_shader_non_constant_global_initializers 1
\n
"
"#define GL_EXT_shader_image_load_formatted 1
\n
"
"#define GL_EXT_shader_image_load_formatted 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
37cdceed
...
@@ -133,6 +133,7 @@ const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int
...
@@ -133,6 +133,7 @@ const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int
const
char
*
const
E_GL_ARB_shader_ballot
=
"GL_ARB_shader_ballot"
;
const
char
*
const
E_GL_ARB_shader_ballot
=
"GL_ARB_shader_ballot"
;
const
char
*
const
E_GL_ARB_sparse_texture2
=
"GL_ARB_sparse_texture2"
;
const
char
*
const
E_GL_ARB_sparse_texture2
=
"GL_ARB_sparse_texture2"
;
const
char
*
const
E_GL_ARB_sparse_texture_clamp
=
"GL_ARB_sparse_texture_clamp"
;
const
char
*
const
E_GL_ARB_sparse_texture_clamp
=
"GL_ARB_sparse_texture_clamp"
;
const
char
*
const
E_GL_ARB_shader_stencil_export
=
"GL_ARB_shader_stencil_export"
;
// const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
// const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
const
char
*
const
E_GL_EXT_shader_non_constant_global_initializers
=
"GL_EXT_shader_non_constant_global_initializers"
;
const
char
*
const
E_GL_EXT_shader_non_constant_global_initializers
=
"GL_EXT_shader_non_constant_global_initializers"
;
...
...
gtests/Spv.FromFile.cpp
View file @
37cdceed
...
@@ -278,6 +278,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -278,6 +278,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.shaderBallot.comp"
,
"spv.shaderBallot.comp"
,
"spv.shaderDrawParams.vert"
,
"spv.shaderDrawParams.vert"
,
"spv.shaderGroupVote.comp"
,
"spv.shaderGroupVote.comp"
,
"spv.shaderStencilExport.frag"
,
"spv.shiftOps.frag"
,
"spv.shiftOps.frag"
,
"spv.simpleFunctionCall.frag"
,
"spv.simpleFunctionCall.frag"
,
"spv.simpleMat.vert"
,
"spv.simpleMat.vert"
,
...
...
hlsl/hlslParseHelper.cpp
View file @
37cdceed
...
@@ -5249,7 +5249,7 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu
...
@@ -5249,7 +5249,7 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu
if
(
language
==
EShLangFragment
)
if
(
language
==
EShLangFragment
)
builtIn
=
EbvFragCoord
;
builtIn
=
EbvFragCoord
;
break
;
break
;
case
EbvStencilRef
:
case
Ebv
Frag
StencilRef
:
error
(
loc
,
"unimplemented; need ARB_shader_stencil_export"
,
"SV_STENCILREF"
,
""
);
error
(
loc
,
"unimplemented; need ARB_shader_stencil_export"
,
"SV_STENCILREF"
,
""
);
break
;
break
;
case
EbvTessLevelInner
:
case
EbvTessLevelInner
:
...
...
hlsl/hlslScanContext.cpp
View file @
37cdceed
...
@@ -466,7 +466,7 @@ void HlslScanContext::fillInKeywordMap()
...
@@ -466,7 +466,7 @@ void HlslScanContext::fillInKeywordMap()
(
*
SemanticMap
)[
"SV_COVERAGE"
]
=
EbvSampleMask
;
(
*
SemanticMap
)[
"SV_COVERAGE"
]
=
EbvSampleMask
;
(
*
SemanticMap
)[
"SV_DEPTHGREATEREQUAL"
]
=
EbvFragDepthGreater
;
(
*
SemanticMap
)[
"SV_DEPTHGREATEREQUAL"
]
=
EbvFragDepthGreater
;
(
*
SemanticMap
)[
"SV_DEPTHLESSEQUAL"
]
=
EbvFragDepthLesser
;
(
*
SemanticMap
)[
"SV_DEPTHLESSEQUAL"
]
=
EbvFragDepthLesser
;
(
*
SemanticMap
)[
"SV_STENCILREF"
]
=
EbvStencilRef
;
(
*
SemanticMap
)[
"SV_STENCILREF"
]
=
Ebv
Frag
StencilRef
;
}
}
void
HlslScanContext
::
deleteKeywordMap
()
void
HlslScanContext
::
deleteKeywordMap
()
...
...
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