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
7d4c9a07
Commit
7d4c9a07
authored
Jul 23, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Construct shadow texture from non-shadow sampler.
Tracks
https://github.com/KhronosGroup/GLSL/pull/22
.
parent
0339af3c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
71 deletions
+8
-71
vulkan.frag.out
Test/baseResults/vulkan.frag.out
+1
-2
vulkan.frag
Test/vulkan.frag
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+4
-3
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+2
-64
hlslParseHelper.h
hlsl/hlslParseHelper.h
+0
-1
No files found.
Test/baseResults/vulkan.frag.out
View file @
7d4c9a07
...
@@ -16,7 +16,6 @@ ERROR: 0:21: 'sampler3D' : sampler-constructor cannot make an array of samplers
...
@@ -16,7 +16,6 @@ ERROR: 0:21: 'sampler3D' : sampler-constructor cannot make an array of samplers
ERROR: 0:22: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type
ERROR: 0:22: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type
ERROR: 0:23: 'sampler2D' : sampler-constructor first argument must match type and dimensionality of constructor type
ERROR: 0:23: 'sampler2D' : sampler-constructor first argument must match type and dimensionality of constructor type
ERROR: 0:24: 'sampler2D' : sampler-constructor second argument presence of shadow must match constructor presence of shadow
ERROR: 0:24: 'sampler2D' : sampler-constructor second argument presence of shadow must match constructor presence of shadow
ERROR: 0:25: 'sampler2DShadow' : sampler-constructor second argument presence of shadow must match constructor presence of shadow
ERROR: 0:28: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: s2D
ERROR: 0:28: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: s2D
ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers
ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers
ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d
ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d
...
@@ -56,7 +55,7 @@ ERROR: 0:101: 'noise1' : no matching overloaded function found
...
@@ -56,7 +55,7 @@ ERROR: 0:101: 'noise1' : no matching overloaded function found
ERROR: 0:102: 'noise2' : no matching overloaded function found
ERROR: 0:102: 'noise2' : no matching overloaded function found
ERROR: 0:103: 'noise3' : no matching overloaded function found
ERROR: 0:103: 'noise3' : no matching overloaded function found
ERROR: 0:104: 'noise4' : no matching overloaded function found
ERROR: 0:104: 'noise4' : no matching overloaded function found
ERROR: 5
5
compilation errors. No code generated.
ERROR: 5
4
compilation errors. No code generated.
ERROR: Linking fragment stage: Only one push_constant block is allowed per stage
ERROR: Linking fragment stage: Only one push_constant block is allowed per stage
...
...
Test/vulkan.frag
100644 → 100755
View file @
7d4c9a07
...
@@ -22,7 +22,7 @@ void badConst()
...
@@ -22,7 +22,7 @@ void badConst()
sampler2D
(
i2d
,
s
);
// ERROR, image instead of texture
sampler2D
(
i2d
,
s
);
// ERROR, image instead of texture
sampler2D
(
t3d
[
1
],
s
);
// ERROR, 3D not 2D
sampler2D
(
t3d
[
1
],
s
);
// ERROR, 3D not 2D
sampler2D
(
t2d
,
sShadow
);
// ERROR, shadow mismatch
sampler2D
(
t2d
,
sShadow
);
// ERROR, shadow mismatch
sampler2DShadow
(
t2d
,
s
);
// ERROR, shadow mismatch
sampler2DShadow
(
t2d
,
s
);
}
}
sampler2D
s2D
=
sampler2D
(
t2d
,
s
);
// ERROR, no sampler constructor
sampler2D
s2D
=
sampler2D
(
t2d
,
s
);
// ERROR, no sampler constructor
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
7d4c9a07
...
@@ -2655,15 +2655,16 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const
...
@@ -2655,15 +2655,16 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const
// second argument
// second argument
// * the constructor's second argument must be a scalar of type
// * the constructor's second argument must be a scalar of type
// *sampler* or *samplerShadow*
// *sampler* or *samplerShadow*
// * the presence or absence of depth comparison (Shadow) must match
// * if the second argument is *samplerShadow* the constructor must be a
// between the constructed sampler type and the type of the second argument
// shadow constructor (however, shadow constructors are allowed to have
// a second argument of *sampler*)
if
(
function
[
1
].
type
->
getBasicType
()
!=
EbtSampler
||
if
(
function
[
1
].
type
->
getBasicType
()
!=
EbtSampler
||
!
function
[
1
].
type
->
getSampler
().
isPureSampler
()
||
!
function
[
1
].
type
->
getSampler
().
isPureSampler
()
||
function
[
1
].
type
->
isArray
())
{
function
[
1
].
type
->
isArray
())
{
error
(
loc
,
"sampler-constructor second argument must be a scalar type 'sampler'"
,
token
,
""
);
error
(
loc
,
"sampler-constructor second argument must be a scalar type 'sampler'"
,
token
,
""
);
return
true
;
return
true
;
}
}
if
(
function
.
getType
().
getSampler
().
shadow
!=
function
[
1
].
type
->
getSampler
().
shadow
)
{
if
(
!
function
.
getType
().
getSampler
().
shadow
&&
function
[
1
].
type
->
getSampler
().
shadow
)
{
error
(
loc
,
"sampler-constructor second argument presence of shadow must match constructor presence of shadow"
,
token
,
""
);
error
(
loc
,
"sampler-constructor second argument presence of shadow must match constructor presence of shadow"
,
token
,
""
);
return
true
;
return
true
;
}
}
...
...
hlsl/hlslParseHelper.cpp
View file @
7d4c9a07
...
@@ -6246,7 +6246,8 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node
...
@@ -6246,7 +6246,8 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node
bool
constructingMatrix
=
false
;
bool
constructingMatrix
=
false
;
switch
(
op
)
{
switch
(
op
)
{
case
EOpConstructTextureSampler
:
case
EOpConstructTextureSampler
:
return
constructorTextureSamplerError
(
loc
,
function
);
error
(
loc
,
"unhandled texture constructor"
,
"constructor"
,
""
);
return
true
;
case
EOpConstructMat2x2
:
case
EOpConstructMat2x2
:
case
EOpConstructMat2x3
:
case
EOpConstructMat2x3
:
case
EOpConstructMat2x4
:
case
EOpConstructMat2x4
:
...
@@ -6438,67 +6439,6 @@ bool HlslParseContext::isScalarConstructor(const TIntermNode* node)
...
@@ -6438,67 +6439,6 @@ bool HlslParseContext::isScalarConstructor(const TIntermNode* node)
(
node
->
getAsAggregate
()
==
nullptr
||
node
->
getAsAggregate
()
->
getOp
()
!=
EOpNull
);
(
node
->
getAsAggregate
()
==
nullptr
||
node
->
getAsAggregate
()
->
getOp
()
!=
EOpNull
);
}
}
// Verify all the correct semantics for constructing a combined texture/sampler.
// Return true if the semantics are incorrect.
bool
HlslParseContext
::
constructorTextureSamplerError
(
const
TSourceLoc
&
loc
,
const
TFunction
&
function
)
{
TString
constructorName
=
function
.
getType
().
getBasicTypeString
();
// TODO: performance: should not be making copy; interface needs to change
const
char
*
token
=
constructorName
.
c_str
();
// exactly two arguments needed
if
(
function
.
getParamCount
()
!=
2
)
{
error
(
loc
,
"sampler-constructor requires two arguments"
,
token
,
""
);
return
true
;
}
// For now, not allowing arrayed constructors, the rest of this function
// is set up to allow them, if this test is removed:
if
(
function
.
getType
().
isArray
())
{
error
(
loc
,
"sampler-constructor cannot make an array of samplers"
,
token
,
""
);
return
true
;
}
// first argument
// * the constructor's first argument must be a texture type
// * the dimensionality (1D, 2D, 3D, Cube, Rect, Buffer, MS, and Array)
// of the texture type must match that of the constructed sampler type
// (that is, the suffixes of the type of the first argument and the
// type of the constructor will be spelled the same way)
if
(
function
[
0
].
type
->
getBasicType
()
!=
EbtSampler
||
!
function
[
0
].
type
->
getSampler
().
isTexture
()
||
function
[
0
].
type
->
isArray
())
{
error
(
loc
,
"sampler-constructor first argument must be a scalar textureXXX type"
,
token
,
""
);
return
true
;
}
// simulate the first argument's impact on the result type, so it can be compared with the encapsulated operator!=()
TSampler
texture
=
function
.
getType
().
getSampler
();
texture
.
combined
=
false
;
texture
.
shadow
=
false
;
if
(
texture
!=
function
[
0
].
type
->
getSampler
())
{
error
(
loc
,
"sampler-constructor first argument must match type and dimensionality of constructor type"
,
token
,
""
);
return
true
;
}
// second argument
// * the constructor's second argument must be a scalar of type
// *sampler* or *samplerShadow*
// * the presence or absence of depth comparison (Shadow) must match
// between the constructed sampler type and the type of the second argument
if
(
function
[
1
].
type
->
getBasicType
()
!=
EbtSampler
||
!
function
[
1
].
type
->
getSampler
().
isPureSampler
()
||
function
[
1
].
type
->
isArray
())
{
error
(
loc
,
"sampler-constructor second argument must be a scalar type 'sampler'"
,
token
,
""
);
return
true
;
}
if
(
function
.
getType
().
getSampler
().
shadow
!=
function
[
1
].
type
->
getSampler
().
shadow
)
{
error
(
loc
,
"sampler-constructor second argument presence of shadow must match constructor presence of shadow"
,
token
,
""
);
return
true
;
}
return
false
;
}
// Checks to see if a void variable has been declared and raise an error message for such a case
// Checks to see if a void variable has been declared and raise an error message for such a case
//
//
// returns true in case of an error
// returns true in case of an error
...
@@ -8175,8 +8115,6 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
...
@@ -8175,8 +8115,6 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
TIntermAggregate
*
aggrNode
=
node
->
getAsAggregate
();
TIntermAggregate
*
aggrNode
=
node
->
getAsAggregate
();
TOperator
op
=
intermediate
.
mapTypeToConstructorOp
(
type
);
TOperator
op
=
intermediate
.
mapTypeToConstructorOp
(
type
);
// Combined texture-sampler constructors are completely semantic checked
// in constructorTextureSamplerError()
if
(
op
==
EOpConstructTextureSampler
)
if
(
op
==
EOpConstructTextureSampler
)
return
intermediate
.
setAggregateOperator
(
aggrNode
,
op
,
type
,
loc
);
return
intermediate
.
setAggregateOperator
(
aggrNode
,
op
,
type
,
loc
);
...
...
hlsl/hlslParseHelper.h
View file @
7d4c9a07
...
@@ -122,7 +122,6 @@ public:
...
@@ -122,7 +122,6 @@ public:
void
integerCheck
(
const
TIntermTyped
*
node
,
const
char
*
token
);
void
integerCheck
(
const
TIntermTyped
*
node
,
const
char
*
token
);
void
globalCheck
(
const
TSourceLoc
&
,
const
char
*
token
);
void
globalCheck
(
const
TSourceLoc
&
,
const
char
*
token
);
bool
constructorError
(
const
TSourceLoc
&
,
TIntermNode
*
,
TFunction
&
,
TOperator
,
TType
&
);
bool
constructorError
(
const
TSourceLoc
&
,
TIntermNode
*
,
TFunction
&
,
TOperator
,
TType
&
);
bool
constructorTextureSamplerError
(
const
TSourceLoc
&
,
const
TFunction
&
);
void
arraySizeCheck
(
const
TSourceLoc
&
,
TIntermTyped
*
expr
,
TArraySize
&
);
void
arraySizeCheck
(
const
TSourceLoc
&
,
TIntermTyped
*
expr
,
TArraySize
&
);
void
arraySizeRequiredCheck
(
const
TSourceLoc
&
,
const
TArraySizes
&
);
void
arraySizeRequiredCheck
(
const
TSourceLoc
&
,
const
TArraySizes
&
);
void
structArrayCheck
(
const
TSourceLoc
&
,
const
TType
&
structure
);
void
structArrayCheck
(
const
TSourceLoc
&
,
const
TType
&
structure
);
...
...
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