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
da581a2b
Commit
da581a2b
authored
Oct 14, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GL_ARB_shader_draw_parameters: From @amdrexu, implement extension.
parent
b5c046e5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
8 deletions
+131
-8
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+6
-0
440.vert
Test/440.vert
+16
-0
440.vert.out
Test/baseResults/440.vert.out
+72
-1
BaseTypes.h
glslang/Include/BaseTypes.h
+15
-5
revision.h
glslang/Include/revision.h
+2
-2
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+17
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+2
-0
Versions.h
glslang/MachineIndependent/Versions.h
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
da581a2b
...
...
@@ -321,6 +321,12 @@ spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn)
case
glslang
:
:
EbvCullDistance
:
return
spv
::
BuiltInCullDistance
;
case
glslang
:
:
EbvVertexId
:
return
spv
::
BuiltInVertexId
;
case
glslang
:
:
EbvInstanceId
:
return
spv
::
BuiltInInstanceId
;
case
glslang
:
:
EbvBaseVertex
:
case
glslang
:
:
EbvBaseInstance
:
case
glslang
:
:
EbvDrawId
:
// TODO: Add SPIR-V builtin ID.
spv
::
MissingFunctionality
(
"Draw parameters"
);
return
(
spv
::
BuiltIn
)
spv
::
BadValue
;
case
glslang
:
:
EbvPrimitiveId
:
return
spv
::
BuiltInPrimitiveId
;
case
glslang
:
:
EbvInvocationId
:
return
spv
::
BuiltInInvocationId
;
case
glslang
:
:
EbvLayer
:
return
spv
::
BuiltInLayer
;
...
...
Test/440.vert
View file @
da581a2b
...
...
@@ -159,3 +159,19 @@ out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride
dmat4x4
m2
;
float
f
;
}
bbinst10
;
int
drawParamsBad
()
{
return
gl_BaseVertexARB
+
gl_BaseInstanceARB
+
gl_DrawIDARB
;
// ERROR, extension not requested
}
#extension GL_ARB_shader_draw_parameters: enable
int
drawParams
()
{
return
gl_BaseVertexARB
+
gl_BaseInstanceARB
+
gl_DrawIDARB
;
gl_BaseVertexARB
=
3
;
// ERROR, can't write to shader 'in'
gl_BaseInstanceARB
=
3
;
// ERROR, can't write to shader 'in'
gl_DrawIDARB
=
3
;
// ERROR, can't write to shader 'in'
glBaseInstanceARB
;
// ERROR, not defined
}
Test/baseResults/440.vert.out
View file @
da581a2b
...
...
@@ -42,12 +42,51 @@ ERROR: 0:152: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers
ERROR: 0:155: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 0:155: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64
ERROR: 0:157: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4
ERROR: 42 compilation errors. No code generated.
ERROR: 0:165: 'gl_BaseVertexARB' : required extension not requested: GL_ARB_shader_draw_parameters
ERROR: 0:165: 'gl_BaseInstanceARB' : required extension not requested: GL_ARB_shader_draw_parameters
ERROR: 0:165: 'gl_DrawIDARB' : required extension not requested: GL_ARB_shader_draw_parameters
ERROR: 0:173: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shader input)
ERROR: 0:174: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input)
ERROR: 0:175: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input)
ERROR: 0:176: 'glBaseInstanceARB' : undeclared identifier
ERROR: 49 compilation errors. No code generated.
Shader version: 440
Requested GL_ARB_shader_draw_parameters
in xfb mode
ERROR: node is still EOpNull!
0:163 Function Definition: drawParamsBad( (global int)
0:163 Function Parameters:
0:165 Sequence
0:165 Branch: Return with expression
0:165 add (temp int)
0:165 add (temp int)
0:165 'gl_BaseVertexARB' (in int BaseVertex)
0:165 'gl_BaseInstanceARB' (in int BaseInstance)
0:165 'gl_DrawIDARB' (in int DrawId)
0:170 Function Definition: drawParams( (global int)
0:170 Function Parameters:
0:172 Sequence
0:172 Branch: Return with expression
0:172 add (temp int)
0:172 add (temp int)
0:172 'gl_BaseVertexARB' (in int BaseVertex)
0:172 'gl_BaseInstanceARB' (in int BaseInstance)
0:172 'gl_DrawIDARB' (in int DrawId)
0:173 move second child to first child (temp int)
0:173 'gl_BaseVertexARB' (in int BaseVertex)
0:173 Constant:
0:173 3 (const int)
0:174 move second child to first child (temp int)
0:174 'gl_BaseInstanceARB' (in int BaseInstance)
0:174 Constant:
0:174 3 (const int)
0:175 move second child to first child (temp int)
0:175 'gl_DrawIDARB' (in int DrawId)
0:175 Constant:
0:175 3 (const int)
0:176 'glBaseInstanceARB' (temp float)
0:? Linker Objects
0:? 'a' (layout(location=2 component=2 ) in 2-component vector of float)
0:? 'b' (layout(location=2 component=1 ) in float)
...
...
@@ -114,8 +153,40 @@ ERROR: Linking vertex stage: xfb_stride is too large:
ERROR: xfb_buffer 7, components (1/4 stride) needed are 66, gl_MaxTransformFeedbackInterleavedComponents is 64
Shader version: 440
Requested GL_ARB_shader_draw_parameters
in xfb mode
ERROR: node is still EOpNull!
0:163 Function Definition: drawParamsBad( (global int)
0:163 Function Parameters:
0:165 Sequence
0:165 Branch: Return with expression
0:165 add (temp int)
0:165 add (temp int)
0:165 'gl_BaseVertexARB' (in int BaseVertex)
0:165 'gl_BaseInstanceARB' (in int BaseInstance)
0:165 'gl_DrawIDARB' (in int DrawId)
0:170 Function Definition: drawParams( (global int)
0:170 Function Parameters:
0:172 Sequence
0:172 Branch: Return with expression
0:172 add (temp int)
0:172 add (temp int)
0:172 'gl_BaseVertexARB' (in int BaseVertex)
0:172 'gl_BaseInstanceARB' (in int BaseInstance)
0:172 'gl_DrawIDARB' (in int DrawId)
0:173 move second child to first child (temp int)
0:173 'gl_BaseVertexARB' (in int BaseVertex)
0:173 Constant:
0:173 3 (const int)
0:174 move second child to first child (temp int)
0:174 'gl_BaseInstanceARB' (in int BaseInstance)
0:174 Constant:
0:174 3 (const int)
0:175 move second child to first child (temp int)
0:175 'gl_DrawIDARB' (in int DrawId)
0:175 Constant:
0:175 3 (const int)
0:176 'glBaseInstanceARB' (temp float)
0:? Linker Objects
0:? 'a' (layout(location=2 component=2 ) in 2-component vector of float)
0:? 'b' (layout(location=2 component=1 ) in float)
...
...
glslang/Include/BaseTypes.h
View file @
da581a2b
...
...
@@ -57,10 +57,14 @@ enum TBasicType {
};
//
// Qualifiers and built-ins. These are mainly used to see what can be read
// or written, and by the machine dependent translator to know which registers
// to allocate variables in. Since built-ins tend to go to different registers
// than varying or uniform, it makes sense they are peers, not sub-classes.
// Storage qualifiers. Should align with different kinds of storage or
// resource or GLSL storage qualifier. Expansion is deprecated.
//
// N.B.: You probably DON'T want to add anything here, but rather just add it
// to the built-in variables. See the comment above TBuiltInVariable.
//
// A new built-in variable will normally be an existing qualifier, like 'in', 'out', etc.
// DO NOT follow the design pattern of, say EvqInstanceId, etc.
//
enum
TStorageQualifier
{
EvqTemporary
,
// For temporaries (within a function), read/write
...
...
@@ -105,7 +109,7 @@ enum TStorageQualifier {
// between built-in variable names and an numerical value (the enum).
//
// For backward compatibility, there is some redundancy between the
// TStorageQualifier and these.
Both should
be maintained accurately.
// TStorageQualifier and these.
Existing members should both
be maintained accurately.
// However, any new built-in variable (and any existing non-redundant one)
// must follow the pattern that the specific built-in is here, and only its
// general qualifier is in TStorageQualifier.
...
...
@@ -126,6 +130,9 @@ enum TBuiltInVariable {
EbvLocalInvocationIndex
,
EbvVertexId
,
EbvInstanceId
,
EbvBaseVertex
,
EbvBaseInstance
,
EbvDrawId
,
EbvPosition
,
EbvPointSize
,
EbvClipVertex
,
...
...
@@ -214,6 +221,9 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case
EbvLocalInvocationIndex
:
return
"LocalInvocationIndex"
;
case
EbvVertexId
:
return
"VertexId"
;
case
EbvInstanceId
:
return
"InstanceId"
;
case
EbvBaseVertex
:
return
"BaseVertex"
;
case
EbvBaseInstance
:
return
"BaseInstance"
;
case
EbvDrawId
:
return
"DrawId"
;
case
EbvPosition
:
return
"Position"
;
case
EbvPointSize
:
return
"PointSize"
;
case
EbvClipVertex
:
return
"ClipVertex"
;
...
...
glslang/Include/revision.h
View file @
da581a2b
...
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "3.0.78
7
"
#define GLSLANG_DATE "1
3
-Oct-2015"
#define GLSLANG_REVISION "3.0.78
8
"
#define GLSLANG_DATE "1
4
-Oct-2015"
glslang/MachineIndependent/Initialize.cpp
View file @
da581a2b
...
...
@@ -1483,6 +1483,13 @@ void TBuiltIns::initialize(int version, EProfile profile)
stageBuiltins
[
EShLangVertex
].
append
(
"int gl_InstanceID;"
// needs qualifier fixed later
);
if
(
version
>=
440
)
{
stageBuiltins
[
EShLangVertex
].
append
(
"in int gl_BaseVertexARB;"
"in int gl_BaseInstanceARB;"
"in int gl_DrawIDARB;"
);
}
}
else
{
// ES profile
if
(
version
==
100
)
{
...
...
@@ -2890,6 +2897,16 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
switch
(
language
)
{
case
EShLangVertex
:
if
(
profile
!=
EEsProfile
&&
version
>=
440
)
{
symbolTable
.
setVariableExtensions
(
"gl_BaseVertexARB"
,
1
,
&
E_GL_ARB_shader_draw_parameters
);
symbolTable
.
setVariableExtensions
(
"gl_BaseInstanceARB"
,
1
,
&
E_GL_ARB_shader_draw_parameters
);
symbolTable
.
setVariableExtensions
(
"gl_DrawIDARB"
,
1
,
&
E_GL_ARB_shader_draw_parameters
);
BuiltInVariable
(
"gl_BaseVertexARB"
,
EbvBaseVertex
,
symbolTable
);
BuiltInVariable
(
"gl_BaseInstanceARB"
,
EbvBaseInstance
,
symbolTable
);
BuiltInVariable
(
"gl_DrawIDARB"
,
EbvDrawId
,
symbolTable
);
}
// Compatibility variables, vertex only
BuiltInVariable
(
"gl_Color"
,
EbvColor
,
symbolTable
);
BuiltInVariable
(
"gl_SecondaryColor"
,
EbvSecondaryColor
,
symbolTable
);
...
...
glslang/MachineIndependent/Versions.cpp
View file @
da581a2b
...
...
@@ -169,6 +169,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior
[
E_GL_ARB_explicit_attrib_location
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_image_load_store
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_atomic_counters
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_draw_parameters
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_derivative_control
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_texture_image_samples
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_viewport_array
]
=
EBhDisable
;
...
...
@@ -269,6 +270,7 @@ const char* TParseContext::getPreamble()
"#define GL_ARB_explicit_attrib_location 1
\n
"
"#define GL_ARB_shader_image_load_store 1
\n
"
"#define GL_ARB_shader_atomic_counters 1
\n
"
"#define GL_ARB_shader_draw_parameters 1
\n
"
"#define GL_ARB_derivative_control 1
\n
"
"#define GL_ARB_shader_texture_image_samples 1
\n
"
"#define GL_ARB_viewport_array 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
da581a2b
...
...
@@ -107,6 +107,7 @@ const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture
const
char
*
const
E_GL_ARB_explicit_attrib_location
=
"GL_ARB_explicit_attrib_location"
;
const
char
*
const
E_GL_ARB_shader_image_load_store
=
"GL_ARB_shader_image_load_store"
;
const
char
*
const
E_GL_ARB_shader_atomic_counters
=
"GL_ARB_shader_atomic_counters"
;
const
char
*
const
E_GL_ARB_shader_draw_parameters
=
"GL_ARB_shader_draw_parameters"
;
const
char
*
const
E_GL_ARB_derivative_control
=
"GL_ARB_derivative_control"
;
const
char
*
const
E_GL_ARB_shader_texture_image_samples
=
"GL_ARB_shader_texture_image_samples"
;
const
char
*
const
E_GL_ARB_viewport_array
=
"GL_ARB_viewport_array"
;
...
...
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