Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
glslang
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
deqp-deps
glslang
Commits
a2b71902
Commit
a2b71902
authored
7 years ago
by
John Kessenich
Browse files
Options
Downloads
Patches
Plain Diff
Reflection: Fix #977: Expose getBinding(), use in new getUniformBinding().
parent
0e392aa9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
glslang/MachineIndependent/ShaderLang.cpp
+1
-0
1 addition, 0 deletions
glslang/MachineIndependent/ShaderLang.cpp
glslang/MachineIndependent/reflection.h
+10
-11
10 additions, 11 deletions
glslang/MachineIndependent/reflection.h
glslang/Public/ShaderLang.h
+1
-0
1 addition, 0 deletions
glslang/Public/ShaderLang.h
with
12 additions
and
11 deletions
glslang/MachineIndependent/ShaderLang.cpp
+
1
−
0
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
;
}
...
...
This diff is collapsed.
Click to expand it.
glslang/MachineIndependent/reflection.h
+
10
−
11
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
;
...
...
This diff is collapsed.
Click to expand it.
glslang/Public/ShaderLang.h
+
1
−
0
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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment