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
b0f3d794
Commit
b0f3d794
authored
Mar 20, 2018
by
Neil Roberts
Committed by
Alejandro Piñeiro
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to set the base uniform location
This will be used to generate uniform locations with --aml
parent
16f53474
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
2 deletions
+22
-2
StandAlone.cpp
StandAlone/StandAlone.cpp
+10
-0
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+4
-0
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+1
-1
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+6
-1
ShaderLang.h
glslang/Public/ShaderLang.h
+1
-0
No files found.
StandAlone/StandAlone.cpp
View file @
b0f3d794
...
@@ -174,6 +174,7 @@ std::vector<std::string> Processes; // what should be record
...
@@ -174,6 +174,7 @@ std::vector<std::string> Processes; // what should be record
typedef
std
::
map
<
unsigned
int
,
unsigned
int
>
TPerSetBaseBinding
;
typedef
std
::
map
<
unsigned
int
,
unsigned
int
>
TPerSetBaseBinding
;
std
::
vector
<
std
::
pair
<
std
::
string
,
int
>>
uniformLocationOverrides
;
std
::
vector
<
std
::
pair
<
std
::
string
,
int
>>
uniformLocationOverrides
;
int
uniformBase
=
0
;
std
::
array
<
std
::
array
<
unsigned
int
,
EShLangCount
>
,
glslang
::
EResCount
>
baseBinding
;
std
::
array
<
std
::
array
<
unsigned
int
,
EShLangCount
>
,
glslang
::
EResCount
>
baseBinding
;
std
::
array
<
std
::
array
<
TPerSetBaseBinding
,
EShLangCount
>
,
glslang
::
EResCount
>
baseBindingForSet
;
std
::
array
<
std
::
array
<
TPerSetBaseBinding
,
EShLangCount
>
,
glslang
::
EResCount
>
baseBindingForSet
;
...
@@ -465,6 +466,12 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -465,6 +466,12 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
}
else
if
(
lowerword
==
"auto-map-locations"
||
// synonyms
}
else
if
(
lowerword
==
"auto-map-locations"
||
// synonyms
lowerword
==
"aml"
)
{
lowerword
==
"aml"
)
{
Options
|=
EOptionAutoMapLocations
;
Options
|=
EOptionAutoMapLocations
;
}
else
if
(
lowerword
==
"uniform-base"
)
{
if
(
argc
<=
1
)
Error
(
"no <base> provided for --uniform-base"
);
uniformBase
=
::
strtol
(
argv
[
1
],
NULL
,
10
);
bumpArg
();
break
;
}
else
if
(
lowerword
==
"client"
)
{
}
else
if
(
lowerword
==
"client"
)
{
if
(
argc
>
1
)
{
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"vulkan100"
)
==
0
)
if
(
strcmp
(
argv
[
1
],
"vulkan100"
)
==
0
)
...
@@ -924,6 +931,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
...
@@ -924,6 +931,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
uniOverride
.
second
);
uniOverride
.
second
);
}
}
shader
->
setUniformLocationBase
(
uniformBase
);
// Set up the environment, some subsettings take precedence over earlier
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
// ways of setting things.
if
(
Options
&
EOptionSpv
)
{
if
(
Options
&
EOptionSpv
)
{
...
@@ -1444,6 +1453,7 @@ void usage()
...
@@ -1444,6 +1453,7 @@ void usage()
" suppress GLSL warnings, except as required by
\"
#extension : warn
\"\n
"
" suppress GLSL warnings, except as required by
\"
#extension : warn
\"\n
"
" -x save binary output as text-based 32-bit hexadecimal numbers
\n
"
" -x save binary output as text-based 32-bit hexadecimal numbers
\n
"
" -u<name>:<loc> specify a uniform location override for --aml
\n
"
" -u<name>:<loc> specify a uniform location override for --aml
\n
"
" --uniform-base <base> set a base to use for generated uniform locations
\n
"
" --auto-map-bindings | --amb automatically bind uniform variables
\n
"
" --auto-map-bindings | --amb automatically bind uniform variables
\n
"
" without explicit bindings
\n
"
" without explicit bindings
\n
"
" --auto-map-locations | --aml automatically locate input/output lacking
\n
"
" --auto-map-locations | --aml automatically locate input/output lacking
\n
"
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
b0f3d794
...
@@ -1763,6 +1763,10 @@ void TShader::addUniformLocationOverride(const char* name, int loc)
...
@@ -1763,6 +1763,10 @@ void TShader::addUniformLocationOverride(const char* name, int loc)
{
{
intermediate
->
addUniformLocationOverride
(
name
,
loc
);
intermediate
->
addUniformLocationOverride
(
name
,
loc
);
}
}
void
TShader
::
setUniformLocationBase
(
int
base
)
{
intermediate
->
setUniformLocationBase
(
base
);
}
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
void
TShader
::
setHlslIoMapping
(
bool
hlslIoMap
)
{
intermediate
->
setHlslIoMapping
(
hlslIoMap
);
}
void
TShader
::
setHlslIoMapping
(
bool
hlslIoMap
)
{
intermediate
->
setHlslIoMapping
(
hlslIoMap
);
}
void
TShader
::
setFlattenUniformArrays
(
bool
flatten
)
{
intermediate
->
setFlattenUniformArrays
(
flatten
);
}
void
TShader
::
setFlattenUniformArrays
(
bool
flatten
)
{
intermediate
->
setFlattenUniformArrays
(
flatten
);
}
...
...
glslang/MachineIndependent/iomapper.cpp
View file @
b0f3d794
...
@@ -359,7 +359,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
...
@@ -359,7 +359,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
{
{
TDefaultIoResolverBase
(
const
TIntermediate
&
intermediate
)
:
TDefaultIoResolverBase
(
const
TIntermediate
&
intermediate
)
:
intermediate
(
intermediate
),
intermediate
(
intermediate
),
nextUniformLocation
(
0
),
nextUniformLocation
(
intermediate
.
getUniformLocationBase
()
),
nextInputLocation
(
0
),
nextInputLocation
(
0
),
nextOutputLocation
(
0
)
nextOutputLocation
(
0
)
{
}
{
}
...
...
glslang/MachineIndependent/localintermediate.h
View file @
b0f3d794
...
@@ -252,7 +252,8 @@ public:
...
@@ -252,7 +252,8 @@ public:
hlslIoMapping
(
false
),
hlslIoMapping
(
false
),
textureSamplerTransformMode
(
EShTexSampTransKeep
),
textureSamplerTransformMode
(
EShTexSampTransKeep
),
needToLegalize
(
false
),
needToLegalize
(
false
),
binaryDoubleOutput
(
false
)
binaryDoubleOutput
(
false
),
uniformLocationBase
(
0
)
{
{
localSize
[
0
]
=
1
;
localSize
[
0
]
=
1
;
localSize
[
1
]
=
1
;
localSize
[
1
]
=
1
;
...
@@ -685,6 +686,9 @@ public:
...
@@ -685,6 +686,9 @@ public:
return
pos
->
second
;
return
pos
->
second
;
}
}
void
setUniformLocationBase
(
int
base
)
{
uniformLocationBase
=
base
;
}
int
getUniformLocationBase
()
const
{
return
uniformLocationBase
;
}
void
setNeedsLegalization
()
{
needToLegalize
=
true
;
}
void
setNeedsLegalization
()
{
needToLegalize
=
true
;
}
bool
needsLegalization
()
const
{
return
needToLegalize
;
}
bool
needsLegalization
()
const
{
return
needToLegalize
;
}
...
@@ -811,6 +815,7 @@ protected:
...
@@ -811,6 +815,7 @@ protected:
bool
binaryDoubleOutput
;
bool
binaryDoubleOutput
;
std
::
unordered_map
<
TString
,
int
>
uniformLocationOverrides
;
std
::
unordered_map
<
TString
,
int
>
uniformLocationOverrides
;
int
uniformLocationBase
;
private
:
private
:
void
operator
=
(
TIntermediate
&
);
// prevent assignments
void
operator
=
(
TIntermediate
&
);
// prevent assignments
...
...
glslang/Public/ShaderLang.h
View file @
b0f3d794
...
@@ -414,6 +414,7 @@ public:
...
@@ -414,6 +414,7 @@ public:
void
setAutoMapBindings
(
bool
map
);
void
setAutoMapBindings
(
bool
map
);
void
setAutoMapLocations
(
bool
map
);
void
setAutoMapLocations
(
bool
map
);
void
addUniformLocationOverride
(
const
char
*
name
,
int
loc
);
void
addUniformLocationOverride
(
const
char
*
name
,
int
loc
);
void
setUniformLocationBase
(
int
base
);
void
setInvertY
(
bool
invert
);
void
setInvertY
(
bool
invert
);
void
setHlslIoMapping
(
bool
hlslIoMap
);
void
setHlslIoMapping
(
bool
hlslIoMap
);
void
setFlattenUniformArrays
(
bool
flatten
);
void
setFlattenUniformArrays
(
bool
flatten
);
...
...
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