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
d94c003f
Commit
d94c003f
authored
May 30, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front-end: Complete GL_ARB_compute_shader implementation.
Core compute shaders were working, but the extension wasn't implemented.
parent
0f5e3ad2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
117 additions
and
17 deletions
+117
-17
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+1
-1
420.comp
Test/420.comp
+17
-1
420.comp.out
Test/baseResults/420.comp.out
+85
-9
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+9
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+2
-2
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+1
-1
glslang.y
glslang/MachineIndependent/glslang.y
+1
-1
glslang_tab.cpp
glslang/MachineIndependent/glslang_tab.cpp
+1
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
d94c003f
...
@@ -4042,7 +4042,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
...
@@ -4042,7 +4042,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
// We now know we have a specialization constant to build
// We now know we have a specialization constant to build
// gl_Work
g
roupSize is a special case until the front-end handles hierarchical specialization constants,
// gl_Work
G
roupSize is a special case until the front-end handles hierarchical specialization constants,
// even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ...
// even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ...
if
(
node
.
getType
().
getQualifier
().
builtIn
==
glslang
::
EbvWorkGroupSize
)
{
if
(
node
.
getType
().
getQualifier
().
builtIn
==
glslang
::
EbvWorkGroupSize
)
{
std
::
vector
<
spv
::
Id
>
dimConstId
;
std
::
vector
<
spv
::
Id
>
dimConstId
;
...
...
Test/420.comp
View file @
d94c003f
...
@@ -4,4 +4,19 @@ layout(local_size_x = 2) in; // ERROR, no compute
...
@@ -4,4 +4,19 @@ layout(local_size_x = 2) in; // ERROR, no compute
#extension GL_ARB_compute_shader : enable
#extension GL_ARB_compute_shader : enable
layout(local_size_x = 2) in;
layout(local_size_x = 2, local_size_y = 4, local_size_z = 6) in;
shared vec3 sfoo;
void main()
{
sfoo = vec3(gl_WorkGroupSize.x, gl_WorkGroupSize.y, gl_WorkGroupSize.z);
sfoo += gl_WorkGroupSize + gl_NumWorkGroups + gl_WorkGroupID + gl_LocalInvocationID + gl_GlobalInvocationID;
sfoo *= gl_LocalInvocationIndex;
sfoo += gl_MaxComputeWorkGroupCount + gl_MaxComputeWorkGroupSize;
sfoo *= gl_MaxComputeUniformComponents +
gl_MaxComputeTextureImageUnits +
gl_MaxComputeImageUniforms +
gl_MaxComputeAtomicCounters +
gl_MaxComputeAtomicCounterBuffers;
}
\ No newline at end of file
Test/baseResults/420.comp.out
View file @
d94c003f
420.comp
420.comp
Warning, version 420 is not yet complete; most version-specific features are present, but some are missing.
Warning, version 420 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:3: 'gl_WorkgroupSize' : not supported for this version or the enabled extensions
ERROR: 0:3: 'gl_WorkGroupSize' : not supported for this version or the enabled extensions
WARNING: 0:5: '#extension' : extension is only partially supported: GL_ARB_compute_shader
ERROR: 1 compilation errors. No code generated.
ERROR: 1 compilation errors. No code generated.
Shader version: 420
Shader version: 420
Requested GL_ARB_compute_shader
Requested GL_ARB_compute_shader
local_size = (2,
1, 1
)
local_size = (2,
4, 6
)
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:11 Function Definition: main( (global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child (temp 3-component vector of float)
0:13 'sfoo' (shared 3-component vector of float)
0:13 Constant:
0:13 2.000000
0:13 4.000000
0:13 6.000000
0:14 add second child into first child (temp 3-component vector of float)
0:14 'sfoo' (shared 3-component vector of float)
0:14 Convert uint to float (temp 3-component vector of float)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 Constant:
0:14 2 (const uint)
0:14 4 (const uint)
0:14 6 (const uint)
0:14 'gl_NumWorkGroups' (in 3-component vector of uint NumWorkGroups)
0:14 'gl_WorkGroupID' (in 3-component vector of uint WorkGroupID)
0:14 'gl_LocalInvocationID' (in 3-component vector of uint LocalInvocationID)
0:14 'gl_GlobalInvocationID' (in 3-component vector of uint GlobalInvocationID)
0:15 vector scale second child into first child (temp 3-component vector of float)
0:15 'sfoo' (shared 3-component vector of float)
0:15 Convert uint to float (temp float)
0:15 'gl_LocalInvocationIndex' (in uint LocalInvocationIndex)
0:16 add second child into first child (temp 3-component vector of float)
0:16 'sfoo' (shared 3-component vector of float)
0:16 Constant:
0:16 66559.000000
0:16 66559.000000
0:16 65599.000000
0:17 vector scale second child into first child (temp 3-component vector of float)
0:17 'sfoo' (shared 3-component vector of float)
0:17 Constant:
0:17 1057.000000
0:? Linker Objects
0:? Linker Objects
0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize)
0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize)
0:? 2 (const uint)
0:? 2 (const uint)
0:? 1 (const uint)
0:? 4 (const uint)
0:? 1 (const uint)
0:? 6 (const uint)
0:? 'sfoo' (shared 3-component vector of float)
Linked compute stage:
Linked compute stage:
ERROR: Linking compute stage: Missing entry point: Each stage requires one "void main()" entry point
Shader version: 420
Shader version: 420
Requested GL_ARB_compute_shader
Requested GL_ARB_compute_shader
local_size = (2,
1, 1
)
local_size = (2,
4, 6
)
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:11 Function Definition: main( (global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child (temp 3-component vector of float)
0:13 'sfoo' (shared 3-component vector of float)
0:13 Constant:
0:13 2.000000
0:13 4.000000
0:13 6.000000
0:14 add second child into first child (temp 3-component vector of float)
0:14 'sfoo' (shared 3-component vector of float)
0:14 Convert uint to float (temp 3-component vector of float)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 add (temp 3-component vector of uint)
0:14 Constant:
0:14 2 (const uint)
0:14 4 (const uint)
0:14 6 (const uint)
0:14 'gl_NumWorkGroups' (in 3-component vector of uint NumWorkGroups)
0:14 'gl_WorkGroupID' (in 3-component vector of uint WorkGroupID)
0:14 'gl_LocalInvocationID' (in 3-component vector of uint LocalInvocationID)
0:14 'gl_GlobalInvocationID' (in 3-component vector of uint GlobalInvocationID)
0:15 vector scale second child into first child (temp 3-component vector of float)
0:15 'sfoo' (shared 3-component vector of float)
0:15 Convert uint to float (temp float)
0:15 'gl_LocalInvocationIndex' (in uint LocalInvocationIndex)
0:16 add second child into first child (temp 3-component vector of float)
0:16 'sfoo' (shared 3-component vector of float)
0:16 Constant:
0:16 66559.000000
0:16 66559.000000
0:16 65599.000000
0:17 vector scale second child into first child (temp 3-component vector of float)
0:17 'sfoo' (shared 3-component vector of float)
0:17 Constant:
0:17 1057.000000
0:? Linker Objects
0:? Linker Objects
0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize)
0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize)
0:? 2 (const uint)
0:? 2 (const uint)
0:? 1 (const uint)
0:? 4 (const uint)
0:? 1 (const uint)
0:? 6 (const uint)
0:? 'sfoo' (shared 3-component vector of float)
glslang/MachineIndependent/Initialize.cpp
View file @
d94c003f
...
@@ -3421,7 +3421,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
...
@@ -3421,7 +3421,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
// compute
// compute
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
4
3
0
))
{
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
4
2
0
))
{
snprintf
(
builtInConstant
,
maxSize
,
"const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);"
,
resources
.
maxComputeWorkGroupCountX
,
snprintf
(
builtInConstant
,
maxSize
,
"const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);"
,
resources
.
maxComputeWorkGroupCountX
,
resources
.
maxComputeWorkGroupCountY
,
resources
.
maxComputeWorkGroupCountY
,
resources
.
maxComputeWorkGroupCountZ
);
resources
.
maxComputeWorkGroupCountZ
);
...
@@ -3904,6 +3904,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3904,6 +3904,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
symbolTable
.
setVariableExtensions
(
"gl_LocalInvocationID"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_LocalInvocationID"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_GlobalInvocationID"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_GlobalInvocationID"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_LocalInvocationIndex"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_LocalInvocationIndex"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeWorkGroupCount"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeWorkGroupSize"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeUniformComponents"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeTextureImageUnits"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeImageUniforms"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeAtomicCounters"
,
1
,
&
E_GL_ARB_compute_shader
);
symbolTable
.
setVariableExtensions
(
"gl_MaxComputeAtomicCounterBuffers"
,
1
,
&
E_GL_ARB_compute_shader
);
}
}
break
;
break
;
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
d94c003f
...
@@ -4232,8 +4232,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
...
@@ -4232,8 +4232,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case
EShLangCompute
:
case
EShLangCompute
:
if
(
id
.
compare
(
0
,
11
,
"local_size_"
)
==
0
)
{
if
(
id
.
compare
(
0
,
11
,
"local_size_"
)
==
0
)
{
profileRequires
(
loc
,
EEsProfile
,
310
,
0
,
"gl_Work
g
roupSize"
);
profileRequires
(
loc
,
EEsProfile
,
310
,
0
,
"gl_Work
G
roupSize"
);
profileRequires
(
loc
,
~
EEsProfile
,
430
,
E_GL_ARB_compute_shader
,
"gl_Work
g
roupSize"
);
profileRequires
(
loc
,
~
EEsProfile
,
430
,
E_GL_ARB_compute_shader
,
"gl_Work
G
roupSize"
);
if
(
id
==
"local_size_x"
)
{
if
(
id
==
"local_size_x"
)
{
publicType
.
shaderQualifiers
.
localSize
[
0
]
=
value
;
publicType
.
shaderQualifiers
.
localSize
[
0
]
=
value
;
return
;
return
;
...
...
glslang/MachineIndependent/Versions.cpp
View file @
d94c003f
...
@@ -162,7 +162,7 @@ void TParseVersions::initializeExtensionBehavior()
...
@@ -162,7 +162,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_ARB_texture_gather
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_texture_gather
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_gpu_shader5
]
=
EBhDisablePartial
;
extensionBehavior
[
E_GL_ARB_gpu_shader5
]
=
EBhDisablePartial
;
extensionBehavior
[
E_GL_ARB_separate_shader_objects
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_separate_shader_objects
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_compute_shader
]
=
EBhDisable
Partial
;
extensionBehavior
[
E_GL_ARB_compute_shader
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_tessellation_shader
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_tessellation_shader
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_enhanced_layouts
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_enhanced_layouts
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_texture_cube_map_array
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_texture_cube_map_array
]
=
EBhDisable
;
...
...
glslang/MachineIndependent/glslang.y
View file @
d94c003f
...
@@ -1208,7 +1208,7 @@ storage_qualifier
...
@@ -1208,7 +1208,7 @@ storage_qualifier
$$.qualifier.storage = EvqBuffer;
$$.qualifier.storage = EvqBuffer;
}
}
| SHARED {
| SHARED {
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430,
0
, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430,
E_GL_ARB_compute_shader
, "shared");
parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
parseContext.requireStage($1.loc, EShLangCompute, "shared");
parseContext.requireStage($1.loc, EShLangCompute, "shared");
$$.init($1.loc);
$$.init($1.loc);
...
...
glslang/MachineIndependent/glslang_tab.cpp
View file @
d94c003f
...
@@ -4737,7 +4737,7 @@ yyreduce:
...
@@ -4737,7 +4737,7 @@ yyreduce:
case
155
:
case
155
:
#line 1210 "MachineIndependent/glslang.y"
/* yacc.c:1646 */
#line 1210 "MachineIndependent/glslang.y"
/* yacc.c:1646 */
{
{
parseContext
.
profileRequires
((
yyvsp
[
0
].
lex
).
loc
,
ECoreProfile
|
ECompatibilityProfile
,
430
,
0
,
"shared"
);
parseContext
.
profileRequires
((
yyvsp
[
0
].
lex
).
loc
,
ECoreProfile
|
ECompatibilityProfile
,
430
,
E_GL_ARB_compute_shader
,
"shared"
);
parseContext
.
profileRequires
((
yyvsp
[
0
].
lex
).
loc
,
EEsProfile
,
310
,
0
,
"shared"
);
parseContext
.
profileRequires
((
yyvsp
[
0
].
lex
).
loc
,
EEsProfile
,
310
,
0
,
"shared"
);
parseContext
.
requireStage
((
yyvsp
[
0
].
lex
).
loc
,
EShLangCompute
,
"shared"
);
parseContext
.
requireStage
((
yyvsp
[
0
].
lex
).
loc
,
EShLangCompute
,
"shared"
);
(
yyval
.
interm
.
type
).
init
((
yyvsp
[
0
].
lex
).
loc
);
(
yyval
.
interm
.
type
).
init
((
yyvsp
[
0
].
lex
).
loc
);
...
...
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