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
a2b71902
Commit
a2b71902
authored
Jul 20, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reflection: Fix #977: Expose getBinding(), use in new getUniformBinding().
parent
0e392aa9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+1
-0
reflection.h
glslang/MachineIndependent/reflection.h
+10
-11
ShaderLang.h
glslang/Public/ShaderLang.h
+1
-0
No files found.
glslang/MachineIndependent/ShaderLang.cpp
View file @
a2b71902
...
...
@@ -1836,6 +1836,7 @@ const char* TProgram::getUniformName(int index) const { return reflection
const
char
*
TProgram
::
getUniformBlockName
(
int
index
)
const
{
return
reflection
->
getUniformBlock
(
index
).
name
.
c_str
();
}
int
TProgram
::
getUniformBlockSize
(
int
index
)
const
{
return
reflection
->
getUniformBlock
(
index
).
size
;
}
int
TProgram
::
getUniformIndex
(
const
char
*
name
)
const
{
return
reflection
->
getIndex
(
name
);
}
int
TProgram
::
getUniformBinding
(
int
index
)
const
{
return
reflection
->
getUniform
(
index
).
getBinding
();
}
int
TProgram
::
getUniformBlockIndex
(
int
index
)
const
{
return
reflection
->
getUniform
(
index
).
index
;
}
int
TProgram
::
getUniformBlockCounterIndex
(
int
index
)
const
{
return
reflection
->
getUniformBlock
(
index
).
counterIndex
;
}
int
TProgram
::
getUniformType
(
int
index
)
const
{
return
reflection
->
getUniform
(
index
).
glDefineType
;
}
...
...
glslang/MachineIndependent/reflection.h
View file @
a2b71902
...
...
@@ -59,7 +59,15 @@ public:
name
(
pName
),
offset
(
pOffset
),
glDefineType
(
pGLDefineType
),
size
(
pSize
),
index
(
pIndex
),
counterIndex
(
-
1
),
type
(
pType
.
clone
())
{
}
void
dump
()
const
{
const
TType
*
const
getType
()
const
{
return
type
;
}
int
getBinding
()
const
{
if
(
type
==
nullptr
||
!
type
->
getQualifier
().
hasBinding
())
return
-
1
;
return
type
->
getQualifier
().
layoutBinding
;
}
void
dump
()
const
{
printf
(
"%s: offset %d, type %x, size %d, index %d, binding %d"
,
name
.
c_str
(),
offset
,
glDefineType
,
size
,
index
,
getBinding
()
);
...
...
@@ -68,8 +76,7 @@ public:
printf
(
"
\n
"
);
}
const
TType
*
const
getType
()
const
{
return
type
;
}
static
TObjectReflection
badReflection
()
{
return
TObjectReflection
();
}
TString
name
;
int
offset
;
...
...
@@ -78,15 +85,7 @@ public:
int
index
;
int
counterIndex
;
static
TObjectReflection
badReflection
()
{
return
TObjectReflection
();
}
protected
:
int
getBinding
()
const
{
if
(
type
==
nullptr
||
type
->
getQualifier
().
layoutBinding
==
TQualifier
::
layoutBindingEnd
)
return
-
1
;
return
type
->
getQualifier
().
layoutBinding
;
}
TObjectReflection
()
:
offset
(
-
1
),
glDefineType
(
-
1
),
size
(
-
1
),
index
(
-
1
),
type
(
nullptr
)
{
}
const
TType
*
type
;
...
...
glslang/Public/ShaderLang.h
View file @
a2b71902
...
...
@@ -619,6 +619,7 @@ public:
const
char
*
getUniformBlockName
(
int
blockIndex
)
const
;
// can be used for glGetActiveUniformBlockName()
int
getUniformBlockSize
(
int
blockIndex
)
const
;
// can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE)
int
getUniformIndex
(
const
char
*
name
)
const
;
// can be used for glGetUniformIndices()
int
getUniformBinding
(
int
index
)
const
;
// returns the binding number
int
getUniformBlockIndex
(
int
index
)
const
;
// can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX)
int
getUniformBlockCounterIndex
(
int
index
)
const
;
// returns block index of associated counter.
int
getUniformType
(
int
index
)
const
;
// can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE)
...
...
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