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
cce8d48b
Commit
cce8d48b
authored
Oct 14, 2016
by
steve-lunarg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: phase 3c: add option to use Unknown storage format
This uses the Unknown storage format, instead of deducing the format from the texture declaration type.
parent
8b0227ce
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
23 deletions
+25
-23
StandAlone.cpp
StandAlone/StandAlone.cpp
+8
-0
hlsl.sample.sub-vec4.dx10.frag.out
Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out
+4
-4
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+1
-0
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+6
-2
ShaderLang.h
glslang/Public/ShaderLang.h
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+5
-17
No files found.
StandAlone/StandAlone.cpp
View file @
cce8d48b
...
...
@@ -82,6 +82,7 @@ enum TOptions {
EOptionCascadingErrors
=
(
1
<<
18
),
EOptionAutoMapBindings
=
(
1
<<
19
),
EOptionFlattenUniformArrays
=
(
1
<<
20
),
EOptionNoStorageFormat
=
(
1
<<
21
),
};
//
...
...
@@ -290,6 +291,9 @@ void ProcessArguments(int argc, char* argv[])
lowerword
==
"flatten-uniform-array"
||
lowerword
==
"fua"
)
{
Options
|=
EOptionFlattenUniformArrays
;
}
else
if
(
lowerword
==
"no-storage-format"
||
// synonyms
lowerword
==
"nsf"
)
{
Options
|=
EOptionNoStorageFormat
;
}
else
{
usage
();
}
...
...
@@ -542,6 +546,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader
->
setShiftTextureBinding
(
baseTextureBinding
[
compUnit
.
stage
]);
shader
->
setShiftUboBinding
(
baseUboBinding
[
compUnit
.
stage
]);
shader
->
setFlattenUniformArrays
((
Options
&
EOptionFlattenUniformArrays
)
!=
0
);
shader
->
setNoStorageFormat
((
Options
&
EOptionNoStorageFormat
)
!=
0
);
if
(
Options
&
EOptionAutoMapBindings
)
shader
->
setAutoMapBindings
(
true
);
...
...
@@ -945,6 +950,9 @@ void usage()
"
\n
"
" --flatten-uniform-arrays flatten uniform texture & sampler arrays to scalars
\n
"
" --fua synonym for --flatten-uniform-arrays
\n
"
"
\n
"
" --no-storage-format use Unknown image format
\n
"
" --nsf synonym for --no-storage-format
\n
"
);
exit
(
EFailUsage
);
...
...
Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out
View file @
cce8d48b
...
...
@@ -18,7 +18,7 @@ gl_FragCoord origin is upper left
0:18 Sequence
0:18 move second child to first child (temp 2-component vector of float)
0:18 'txval11' (temp 2-component vector of float)
0:18 Construct
float
(temp 2-component vector of float)
0:18 Construct
vec2
(temp 2-component vector of float)
0:? texture (temp 4-component vector of float)
0:18 Construct combined texture-sampler (temp sampler1D)
0:18 'g_tTex1df2' (uniform texture1D)
...
...
@@ -28,7 +28,7 @@ gl_FragCoord origin is upper left
0:19 Sequence
0:19 move second child to first child (temp 3-component vector of float)
0:19 'txval12' (temp 3-component vector of float)
0:19 Construct
float
(temp 3-component vector of float)
0:19 Construct
vec3
(temp 3-component vector of float)
0:? texture (temp 4-component vector of float)
0:19 Construct combined texture-sampler (temp sampler1D)
0:19 'g_tTex1df3' (uniform texture1D)
...
...
@@ -94,7 +94,7 @@ gl_FragCoord origin is upper left
0:18 Sequence
0:18 move second child to first child (temp 2-component vector of float)
0:18 'txval11' (temp 2-component vector of float)
0:18 Construct
float
(temp 2-component vector of float)
0:18 Construct
vec2
(temp 2-component vector of float)
0:? texture (temp 4-component vector of float)
0:18 Construct combined texture-sampler (temp sampler1D)
0:18 'g_tTex1df2' (uniform texture1D)
...
...
@@ -104,7 +104,7 @@ gl_FragCoord origin is upper left
0:19 Sequence
0:19 move second child to first child (temp 3-component vector of float)
0:19 'txval12' (temp 3-component vector of float)
0:19 Construct
float
(temp 3-component vector of float)
0:19 Construct
vec3
(temp 3-component vector of float)
0:? texture (temp 4-component vector of float)
0:19 Construct combined texture-sampler (temp sampler1D)
0:19 'g_tTex1df3' (uniform texture1D)
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
cce8d48b
...
...
@@ -1497,6 +1497,7 @@ void TShader::setShiftTextureBinding(unsigned int base) { intermediate->setShift
void
TShader
::
setShiftUboBinding
(
unsigned
int
base
)
{
intermediate
->
setShiftUboBinding
(
base
);
}
void
TShader
::
setAutoMapBindings
(
bool
map
)
{
intermediate
->
setAutoMapBindings
(
map
);
}
void
TShader
::
setFlattenUniformArrays
(
bool
flatten
)
{
intermediate
->
setFlattenUniformArrays
(
flatten
);
}
void
TShader
::
setNoStorageFormat
(
bool
useUnknownFormat
)
{
intermediate
->
setNoStorageFormat
(
useUnknownFormat
);
}
//
// Turn the shader strings into a parse tree in the TIntermediate.
...
...
glslang/MachineIndependent/localintermediate.h
View file @
cce8d48b
...
...
@@ -146,7 +146,8 @@ public:
shiftTextureBinding
(
0
),
shiftUboBinding
(
0
),
autoMapBindings
(
false
),
flattenUniformArrays
(
false
)
flattenUniformArrays
(
false
),
useUnknownFormat
(
false
)
{
localSize
[
0
]
=
1
;
localSize
[
1
]
=
1
;
...
...
@@ -179,7 +180,9 @@ public:
bool
getAutoMapBindings
()
const
{
return
autoMapBindings
;
}
void
setFlattenUniformArrays
(
bool
flatten
)
{
flattenUniformArrays
=
flatten
;
}
bool
getFlattenUniformArrays
()
const
{
return
flattenUniformArrays
;
}
void
setNoStorageFormat
(
bool
b
)
{
useUnknownFormat
=
b
;
}
bool
getNoStorageFormat
()
const
{
return
useUnknownFormat
;
}
void
setVersion
(
int
v
)
{
version
=
v
;
}
int
getVersion
()
const
{
return
version
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
...
...
@@ -397,6 +400,7 @@ protected:
unsigned
int
shiftUboBinding
;
bool
autoMapBindings
;
bool
flattenUniformArrays
;
bool
useUnknownFormat
;
EProfile
profile
;
int
version
;
...
...
glslang/Public/ShaderLang.h
View file @
cce8d48b
...
...
@@ -309,6 +309,7 @@ public:
void
setShiftUboBinding
(
unsigned
int
base
);
void
setAutoMapBindings
(
bool
map
);
void
setFlattenUniformArrays
(
bool
flatten
);
void
setNoStorageFormat
(
bool
useUnknownFormat
);
// Interface to #include handlers.
//
...
...
hlsl/hlslParseHelper.cpp
View file @
cce8d48b
...
...
@@ -154,7 +154,10 @@ TLayoutFormat HlslParseContext::getLayoutFromTxType(const TSourceLoc& loc, const
{
const
int
components
=
txType
.
getVectorSize
();
const
auto
selectFormat
=
[
&
components
](
TLayoutFormat
v1
,
TLayoutFormat
v2
,
TLayoutFormat
v4
)
{
const
auto
selectFormat
=
[
this
,
&
components
](
TLayoutFormat
v1
,
TLayoutFormat
v2
,
TLayoutFormat
v4
)
{
if
(
intermediate
.
getNoStorageFormat
())
return
ElfNone
;
return
components
==
1
?
v1
:
components
==
2
?
v2
:
v4
;
};
...
...
@@ -288,13 +291,6 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
const
TSampler
&
texSampler
=
object
->
getType
().
getSampler
();
const
TLayoutFormat
fmt
=
object
->
getType
().
getQualifier
().
layoutFormat
;
// We only handle this subset of the possible formats.
assert
(
fmt
==
ElfRgba32f
||
fmt
==
ElfRgba32i
||
fmt
==
ElfRgba32ui
||
fmt
==
ElfRg32f
||
fmt
==
ElfRg32i
||
fmt
==
ElfRg32ui
||
fmt
==
ElfR32f
||
fmt
==
ElfR32i
||
fmt
==
ElfR32ui
);
const
TType
objDerefType
(
texSampler
.
type
,
EvqTemporary
,
texSampler
.
vectorSize
);
if
(
nodeAsBinary
)
{
...
...
@@ -1452,15 +1448,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
// Too many components. Construct shorter vector from it.
const
TType
clampedType
(
result
->
getType
().
getBasicType
(),
EvqTemporary
,
sampler
.
vectorSize
);
TOperator
op
;
switch
(
sampler
.
type
)
{
case
EbtInt
:
op
=
EOpConstructInt
;
break
;
case
EbtUint
:
op
=
EOpConstructUint
;
break
;
case
EbtFloat
:
op
=
EOpConstructFloat
;
break
;
default
:
error
(
loc
,
"unknown basic type in texture op"
,
""
,
""
);
}
const
TOperator
op
=
intermediate
.
mapTypeToConstructorOp
(
clampedType
);
result
=
constructBuiltIn
(
clampedType
,
op
,
result
,
loc
,
false
);
}
...
...
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