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
b56a26ab
Commit
b56a26ab
authored
Sep 16, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Generate the LocalSize Execution Mode for compute shaders.
parent
56bab048
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
5 deletions
+15
-5
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+3
-0
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+8
-4
SpvBuilder.h
SPIRV/SpvBuilder.h
+1
-1
spv.310.comp.out
Test/baseResults/spv.310.comp.out
+1
-0
spv.atomic.comp.out
Test/baseResults/spv.atomic.comp.out
+1
-0
spv.double.comp.out
Test/baseResults/spv.double.comp.out
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
b56a26ab
...
@@ -493,6 +493,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
...
@@ -493,6 +493,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
case
EShLangCompute
:
case
EShLangCompute
:
builder
.
addCapability
(
spv
::
CapabilityShader
);
builder
.
addCapability
(
spv
::
CapabilityShader
);
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeLocalSize
,
glslangIntermediate
->
getLocalSize
(
0
),
glslangIntermediate
->
getLocalSize
(
1
),
glslangIntermediate
->
getLocalSize
(
2
));
break
;
break
;
default
:
default
:
...
...
SPIRV/SpvBuilder.cpp
View file @
b56a26ab
...
@@ -648,14 +648,18 @@ void Builder::addEntryPoint(ExecutionModel model, Function* function, const char
...
@@ -648,14 +648,18 @@ void Builder::addEntryPoint(ExecutionModel model, Function* function, const char
entryPoints
.
push_back
(
entryPoint
);
entryPoints
.
push_back
(
entryPoint
);
}
}
void
Builder
::
addExecutionMode
(
Function
*
entryPoint
,
ExecutionMode
mode
,
int
value
)
// Currently relying on the fact that all 'value' of interest are small non-negative values.
void
Builder
::
addExecutionMode
(
Function
*
entryPoint
,
ExecutionMode
mode
,
int
value1
,
int
value2
,
int
value3
)
{
{
// TODO: handle multiple optional arguments
Instruction
*
instr
=
new
Instruction
(
OpExecutionMode
);
Instruction
*
instr
=
new
Instruction
(
OpExecutionMode
);
instr
->
addIdOperand
(
entryPoint
->
getId
());
instr
->
addIdOperand
(
entryPoint
->
getId
());
instr
->
addImmediateOperand
(
mode
);
instr
->
addImmediateOperand
(
mode
);
if
(
value
>=
0
)
if
(
value1
>=
0
)
instr
->
addImmediateOperand
(
value
);
instr
->
addImmediateOperand
(
value1
);
if
(
value2
>=
0
)
instr
->
addImmediateOperand
(
value2
);
if
(
value3
>=
0
)
instr
->
addImmediateOperand
(
value3
);
executionModes
.
push_back
(
instr
);
executionModes
.
push_back
(
instr
);
}
}
...
...
SPIRV/SpvBuilder.h
View file @
b56a26ab
...
@@ -182,7 +182,7 @@ public:
...
@@ -182,7 +182,7 @@ public:
// Methods for adding information outside the CFG.
// Methods for adding information outside the CFG.
void
addEntryPoint
(
ExecutionModel
,
Function
*
,
const
char
*
name
);
void
addEntryPoint
(
ExecutionModel
,
Function
*
,
const
char
*
name
);
void
addExecutionMode
(
Function
*
,
ExecutionMode
mode
,
int
value
=
-
1
);
void
addExecutionMode
(
Function
*
,
ExecutionMode
mode
,
int
value
1
=
-
1
,
int
value2
=
-
1
,
int
value3
=
-
1
);
void
addName
(
Id
,
const
char
*
name
);
void
addName
(
Id
,
const
char
*
name
);
void
addMemberName
(
Id
,
int
member
,
const
char
*
name
);
void
addMemberName
(
Id
,
int
member
,
const
char
*
name
);
void
addLine
(
Id
target
,
Id
fileName
,
int
line
,
int
column
);
void
addLine
(
Id
target
,
Id
fileName
,
int
line
,
int
column
);
...
...
Test/baseResults/spv.310.comp.out
View file @
b56a26ab
...
@@ -14,6 +14,7 @@ Linked compute stage:
...
@@ -14,6 +14,7 @@ Linked compute stage:
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 16 32 4
Name 4 "main"
Name 4 "main"
Name 13 "outb"
Name 13 "outb"
MemberName 13(outb) 0 "f"
MemberName 13(outb) 0 "f"
...
...
Test/baseResults/spv.atomic.comp.out
View file @
b56a26ab
...
@@ -15,6 +15,7 @@ TBD functionality: Is atomic_uint an opaque handle in the uniform storage class,
...
@@ -15,6 +15,7 @@ TBD functionality: Is atomic_uint an opaque handle in the uniform storage class,
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Name 4 "main"
Name 4 "main"
Name 10 "func(au1;"
Name 10 "func(au1;"
Name 9 "c"
Name 9 "c"
...
...
Test/baseResults/spv.double.comp.out
View file @
b56a26ab
...
@@ -14,6 +14,7 @@ Linked compute stage:
...
@@ -14,6 +14,7 @@ Linked compute stage:
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Name 4 "main"
Name 4 "main"
Name 8 "bufName"
Name 8 "bufName"
MemberName 8(bufName) 0 "f"
MemberName 8(bufName) 0 "f"
...
...
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