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
d4ed5158
Commit
d4ed5158
authored
Jul 27, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web: Remove a few additional HLSL constructs with ENABLE_HLSL.
Saves about 3K.
parent
13761069
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
16 deletions
+39
-16
StandAlone.cpp
StandAlone/StandAlone.cpp
+4
-0
size
Test/baseResults/size
+1
-1
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+6
-1
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+20
-14
PpScanner.cpp
glslang/MachineIndependent/preprocessor/PpScanner.cpp
+2
-0
ShaderLang.h
glslang/Public/ShaderLang.h
+6
-0
No files found.
StandAlone/StandAlone.cpp
View file @
d4ed5158
...
@@ -996,8 +996,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
...
@@ -996,8 +996,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader
->
setNanMinMaxClamp
(
NaNClamp
);
shader
->
setNanMinMaxClamp
(
NaNClamp
);
shader
->
setResourceSetBinding
(
baseResourceSetBinding
[
compUnit
.
stage
]);
shader
->
setResourceSetBinding
(
baseResourceSetBinding
[
compUnit
.
stage
]);
#ifdef ENABLE_HLSL
if
(
Options
&
EOptionHlslIoMapping
)
if
(
Options
&
EOptionHlslIoMapping
)
shader
->
setHlslIoMapping
(
true
);
shader
->
setHlslIoMapping
(
true
);
#endif
if
(
Options
&
EOptionAutoMapBindings
)
if
(
Options
&
EOptionAutoMapBindings
)
shader
->
setAutoMapBindings
(
true
);
shader
->
setAutoMapBindings
(
true
);
...
@@ -1023,8 +1025,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
...
@@ -1023,8 +1025,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
compUnit
.
stage
,
Client
,
ClientInputSemanticsVersion
);
compUnit
.
stage
,
Client
,
ClientInputSemanticsVersion
);
shader
->
setEnvClient
(
Client
,
ClientVersion
);
shader
->
setEnvClient
(
Client
,
ClientVersion
);
shader
->
setEnvTarget
(
TargetLanguage
,
TargetVersion
);
shader
->
setEnvTarget
(
TargetLanguage
,
TargetVersion
);
#ifdef ENABLE_HLSL
if
(
targetHlslFunctionality1
)
if
(
targetHlslFunctionality1
)
shader
->
setEnvTargetHlslFunctionality1
();
shader
->
setEnvTargetHlslFunctionality1
();
#endif
}
}
shaders
.
push_back
(
shader
);
shaders
.
push_back
(
shader
);
...
...
Test/baseResults/size
View file @
d4ed5158
121
3440
../build/install/bin/glslangValidator.exe
121
0368
../build/install/bin/glslangValidator.exe
glslang/MachineIndependent/ShaderLang.cpp
View file @
d4ed5158
...
@@ -837,9 +837,10 @@ bool ProcessDeferred(
...
@@ -837,9 +837,10 @@ bool ProcessDeferred(
SpvVersion
spvVersion
;
SpvVersion
spvVersion
;
EShLanguage
stage
=
compiler
->
getLanguage
();
EShLanguage
stage
=
compiler
->
getLanguage
();
TranslateEnvironment
(
environment
,
messages
,
source
,
stage
,
spvVersion
);
TranslateEnvironment
(
environment
,
messages
,
source
,
stage
,
spvVersion
);
#ifdef ENABLE_HLSL
if
(
environment
!=
nullptr
&&
environment
->
target
.
hlslFunctionality1
)
if
(
environment
!=
nullptr
&&
environment
->
target
.
hlslFunctionality1
)
intermediate
.
setHlslFunctionality1
();
intermediate
.
setHlslFunctionality1
();
#endif
// First, without using the preprocessor or parser, find the #version, so we know what
// First, without using the preprocessor or parser, find the #version, so we know what
// symbol tables, processing rules, etc. to set up. This does not need the extra strings
// symbol tables, processing rules, etc. to set up. This does not need the extra strings
// outlined above, just the user shader, after the system and user preambles.
// outlined above, just the user shader, after the system and user preambles.
...
@@ -887,8 +888,10 @@ bool ProcessDeferred(
...
@@ -887,8 +888,10 @@ bool ProcessDeferred(
RecordProcesses
(
intermediate
,
messages
,
sourceEntryPointName
);
RecordProcesses
(
intermediate
,
messages
,
sourceEntryPointName
);
if
(
spvVersion
.
vulkan
>
0
)
if
(
spvVersion
.
vulkan
>
0
)
intermediate
.
setOriginUpperLeft
();
intermediate
.
setOriginUpperLeft
();
#ifdef ENABLE_HLSL
if
((
messages
&
EShMsgHlslOffsets
)
||
source
==
EShSourceHlsl
)
if
((
messages
&
EShMsgHlslOffsets
)
||
source
==
EShSourceHlsl
)
intermediate
.
setHlslOffsets
();
intermediate
.
setHlslOffsets
();
#endif
if
(
messages
&
EShMsgDebugInfo
)
{
if
(
messages
&
EShMsgDebugInfo
)
{
intermediate
.
setSourceFile
(
names
[
numPre
]);
intermediate
.
setSourceFile
(
names
[
numPre
]);
for
(
int
s
=
0
;
s
<
numStrings
;
++
s
)
{
for
(
int
s
=
0
;
s
<
numStrings
;
++
s
)
{
...
@@ -1788,7 +1791,9 @@ void TShader::setUniformLocationBase(int base)
...
@@ -1788,7 +1791,9 @@ void TShader::setUniformLocationBase(int base)
intermediate
->
setUniformLocationBase
(
base
);
intermediate
->
setUniformLocationBase
(
base
);
}
}
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
#ifdef ENABLE_HLSL
void
TShader
::
setHlslIoMapping
(
bool
hlslIoMap
)
{
intermediate
->
setHlslIoMapping
(
hlslIoMap
);
}
void
TShader
::
setHlslIoMapping
(
bool
hlslIoMap
)
{
intermediate
->
setHlslIoMapping
(
hlslIoMap
);
}
#endif
void
TShader
::
setFlattenUniformArrays
(
bool
flatten
)
{
intermediate
->
setFlattenUniformArrays
(
flatten
);
}
void
TShader
::
setFlattenUniformArrays
(
bool
flatten
)
{
intermediate
->
setFlattenUniformArrays
(
flatten
);
}
void
TShader
::
setNoStorageFormat
(
bool
useUnknownFormat
)
{
intermediate
->
setNoStorageFormat
(
useUnknownFormat
);
}
void
TShader
::
setNoStorageFormat
(
bool
useUnknownFormat
)
{
intermediate
->
setNoStorageFormat
(
useUnknownFormat
);
}
void
TShader
::
setNanMinMaxClamp
(
bool
useNonNan
)
{
intermediate
->
setNanMinMaxClamp
(
useNonNan
);
}
void
TShader
::
setNanMinMaxClamp
(
bool
useNonNan
)
{
intermediate
->
setNanMinMaxClamp
(
useNonNan
);
}
...
...
glslang/MachineIndependent/localintermediate.h
View file @
d4ed5158
...
@@ -376,26 +376,12 @@ public:
...
@@ -376,26 +376,12 @@ public:
processes
.
addProcess
(
"no-storage-format"
);
processes
.
addProcess
(
"no-storage-format"
);
}
}
bool
getNoStorageFormat
()
const
{
return
useUnknownFormat
;
}
bool
getNoStorageFormat
()
const
{
return
useUnknownFormat
;
}
void
setHlslOffsets
()
{
hlslOffsets
=
true
;
if
(
hlslOffsets
)
processes
.
addProcess
(
"hlsl-offsets"
);
}
bool
usingHlslOffsets
()
const
{
return
hlslOffsets
;
}
void
setUseStorageBuffer
()
void
setUseStorageBuffer
()
{
{
useStorageBuffer
=
true
;
useStorageBuffer
=
true
;
processes
.
addProcess
(
"use-storage-buffer"
);
processes
.
addProcess
(
"use-storage-buffer"
);
}
}
bool
usingStorageBuffer
()
const
{
return
useStorageBuffer
;
}
bool
usingStorageBuffer
()
const
{
return
useStorageBuffer
;
}
void
setHlslIoMapping
(
bool
b
)
{
hlslIoMapping
=
b
;
if
(
hlslIoMapping
)
processes
.
addProcess
(
"hlsl-iomap"
);
}
bool
usingHlslIoMapping
()
{
return
hlslIoMapping
;
}
void
setUseVulkanMemoryModel
()
void
setUseVulkanMemoryModel
()
{
{
useVulkanMemoryModel
=
true
;
useVulkanMemoryModel
=
true
;
...
@@ -667,8 +653,28 @@ public:
...
@@ -667,8 +653,28 @@ public:
void
setDepthReplacing
()
{
depthReplacing
=
true
;
}
void
setDepthReplacing
()
{
depthReplacing
=
true
;
}
bool
isDepthReplacing
()
const
{
return
depthReplacing
;
}
bool
isDepthReplacing
()
const
{
return
depthReplacing
;
}
#ifdef ENABLE_HLSL
void
setHlslFunctionality1
()
{
hlslFunctionality1
=
true
;
}
void
setHlslFunctionality1
()
{
hlslFunctionality1
=
true
;
}
bool
getHlslFunctionality1
()
const
{
return
hlslFunctionality1
;
}
bool
getHlslFunctionality1
()
const
{
return
hlslFunctionality1
;
}
void
setHlslOffsets
()
{
hlslOffsets
=
true
;
if
(
hlslOffsets
)
processes
.
addProcess
(
"hlsl-offsets"
);
}
bool
usingHlslOffsets
()
const
{
return
hlslOffsets
;
}
void
setHlslIoMapping
(
bool
b
)
{
hlslIoMapping
=
b
;
if
(
hlslIoMapping
)
processes
.
addProcess
(
"hlsl-iomap"
);
}
bool
usingHlslIoMapping
()
{
return
hlslIoMapping
;
}
#else
bool
getHlslFunctionality1
()
const
{
return
false
;
}
bool
usingHlslOffsets
()
const
{
return
false
;
}
bool
usingHlslIoMapping
()
{
return
false
;
}
#endif
void
addBlendEquation
(
TBlendEquationShift
b
)
{
blendEquations
|=
(
1
<<
b
);
}
void
addBlendEquation
(
TBlendEquationShift
b
)
{
blendEquations
|=
(
1
<<
b
);
}
unsigned
int
getBlendEquations
()
const
{
return
blendEquations
;
}
unsigned
int
getBlendEquations
()
const
{
return
blendEquations
;
}
...
...
glslang/MachineIndependent/preprocessor/PpScanner.cpp
View file @
d4ed5158
...
@@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
...
@@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
ch
=
getChar
();
ch
=
getChar
();
int
firstDecimal
=
len
;
int
firstDecimal
=
len
;
#ifdef ENABLE_HLSL
// 1.#INF or -1.#INF
// 1.#INF or -1.#INF
if
(
ch
==
'#'
&&
(
ifdepth
>
0
||
parseContext
.
intermediate
.
getSource
()
==
EShSourceHlsl
))
{
if
(
ch
==
'#'
&&
(
ifdepth
>
0
||
parseContext
.
intermediate
.
getSource
()
==
EShSourceHlsl
))
{
if
((
len
<
2
)
||
if
((
len
<
2
)
||
...
@@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
...
@@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
}
}
}
}
}
}
#endif
// Consume leading-zero digits after the decimal point
// Consume leading-zero digits after the decimal point
while
(
ch
==
'0'
)
{
while
(
ch
==
'0'
)
{
...
...
glslang/Public/ShaderLang.h
View file @
d4ed5158
...
@@ -432,7 +432,9 @@ public:
...
@@ -432,7 +432,9 @@ public:
void
addUniformLocationOverride
(
const
char
*
name
,
int
loc
);
void
addUniformLocationOverride
(
const
char
*
name
,
int
loc
);
void
setUniformLocationBase
(
int
base
);
void
setUniformLocationBase
(
int
base
);
void
setInvertY
(
bool
invert
);
void
setInvertY
(
bool
invert
);
#ifdef ENABLE_HLSL
void
setHlslIoMapping
(
bool
hlslIoMap
);
void
setHlslIoMapping
(
bool
hlslIoMap
);
#endif
void
setFlattenUniformArrays
(
bool
flatten
);
void
setFlattenUniformArrays
(
bool
flatten
);
void
setNoStorageFormat
(
bool
useUnknownFormat
);
void
setNoStorageFormat
(
bool
useUnknownFormat
);
void
setNanMinMaxClamp
(
bool
nanMinMaxClamp
);
void
setNanMinMaxClamp
(
bool
nanMinMaxClamp
);
...
@@ -459,8 +461,12 @@ public:
...
@@ -459,8 +461,12 @@ public:
environment
.
target
.
language
=
lang
;
environment
.
target
.
language
=
lang
;
environment
.
target
.
version
=
version
;
environment
.
target
.
version
=
version
;
}
}
#ifdef ENABLE_HLSL
void
setEnvTargetHlslFunctionality1
()
{
environment
.
target
.
hlslFunctionality1
=
true
;
}
void
setEnvTargetHlslFunctionality1
()
{
environment
.
target
.
hlslFunctionality1
=
true
;
}
bool
getEnvTargetHlslFunctionality1
()
const
{
return
environment
.
target
.
hlslFunctionality1
;
}
bool
getEnvTargetHlslFunctionality1
()
const
{
return
environment
.
target
.
hlslFunctionality1
;
}
#else
bool
getEnvTargetHlslFunctionality1
()
const
{
return
false
;
}
#endif
// Interface to #include handlers.
// Interface to #include handlers.
//
//
...
...
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