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
b247cfcd
Unverified
Commit
b247cfcd
authored
Jun 16, 2020
by
John Kessenich
Committed by
GitHub
Jun 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2275 from ben-clayton/mv-hlsl
Move hlsl/ source to glslang/HLSL/
parents
abd91adf
f49820dd
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
124 additions
and
123 deletions
+124
-123
Android.mk
Android.mk
+8
-8
BUILD.bazel
BUILD.bazel
+4
-4
BUILD.gn
BUILD.gn
+15
-15
CMakeLists.txt
glslang/CMakeLists.txt
+15
-15
hlslAttributes.cpp
glslang/HLSL/hlslAttributes.cpp
+0
-0
hlslAttributes.h
glslang/HLSL/hlslAttributes.h
+2
-2
hlslGrammar.cpp
glslang/HLSL/hlslGrammar.cpp
+0
-0
hlslGrammar.h
glslang/HLSL/hlslGrammar.h
+0
-0
hlslOpMap.cpp
glslang/HLSL/hlslOpMap.cpp
+0
-0
hlslOpMap.h
glslang/HLSL/hlslOpMap.h
+0
-0
hlslParseHelper.cpp
glslang/HLSL/hlslParseHelper.cpp
+55
-55
hlslParseHelper.h
glslang/HLSL/hlslParseHelper.h
+6
-6
hlslParseables.cpp
glslang/HLSL/hlslParseables.cpp
+0
-0
hlslParseables.h
glslang/HLSL/hlslParseables.h
+1
-1
hlslScanContext.cpp
glslang/HLSL/hlslScanContext.cpp
+5
-5
hlslScanContext.h
glslang/HLSL/hlslScanContext.h
+1
-1
hlslTokenStream.cpp
glslang/HLSL/hlslTokenStream.cpp
+0
-0
hlslTokenStream.h
glslang/HLSL/hlslTokenStream.h
+0
-0
hlslTokens.h
glslang/HLSL/hlslTokens.h
+0
-0
pch.cpp
glslang/HLSL/pch.cpp
+0
-0
pch.h
glslang/HLSL/pch.h
+7
-8
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+3
-3
CMakeLists.txt
hlsl/CMakeLists.txt
+1
-0
stub.cpp
hlsl/stub.cpp
+1
-0
No files found.
Android.mk
View file @
b247cfcd
...
@@ -27,15 +27,15 @@ include $(CLEAR_VARS)
...
@@ -27,15 +27,15 @@ include $(CLEAR_VARS)
LOCAL_MODULE:=HLSL
LOCAL_MODULE:=HLSL
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES)
LOCAL_SRC_FILES:= \
LOCAL_SRC_FILES:= \
hlsl
/hlslAttributes.cpp \
glslang/HLSL
/hlslAttributes.cpp \
hlsl
/hlslGrammar.cpp \
glslang/HLSL
/hlslGrammar.cpp \
hlsl
/hlslOpMap.cpp \
glslang/HLSL
/hlslOpMap.cpp \
hlsl
/hlslParseables.cpp \
glslang/HLSL
/hlslParseables.cpp \
hlsl
/hlslParseHelper.cpp \
glslang/HLSL
/hlslParseHelper.cpp \
hlsl
/hlslScanContext.cpp \
glslang/HLSL
/hlslScanContext.cpp \
hlsl
/hlslTokenStream.cpp
glslang/HLSL
/hlslTokenStream.cpp
LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
LOCAL_C_INCLUDES:=$(LOCAL_PATH) \
$(LOCAL_PATH)/
hlsl
$(LOCAL_PATH)/
glslang/HLSL
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
...
...
BUILD.bazel
View file @
b247cfcd
...
@@ -34,15 +34,15 @@ cc_library(
...
@@ -34,15 +34,15 @@ cc_library(
srcs = glob(
srcs = glob(
[
[
"glslang/GenericCodeGen/*.cpp",
"glslang/GenericCodeGen/*.cpp",
"glslang/HLSL/*.cpp",
"glslang/MachineIndependent/*.cpp",
"glslang/MachineIndependent/*.cpp",
"glslang/MachineIndependent/preprocessor/*.cpp",
"glslang/MachineIndependent/preprocessor/*.cpp",
"hlsl/*.cpp",
],
],
exclude = [
exclude = [
"glslang/HLSL/pch.cpp",
"glslang/HLSL/pch.h",
"glslang/MachineIndependent/pch.cpp",
"glslang/MachineIndependent/pch.cpp",
"glslang/MachineIndependent/pch.h",
"glslang/MachineIndependent/pch.h",
"hlsl/pch.cpp",
"hlsl/pch.h",
],
],
) + [
) + [
"OGLCompilersDLL/InitializeDll.cpp",
"OGLCompilersDLL/InitializeDll.cpp",
...
@@ -53,10 +53,10 @@ cc_library(
...
@@ -53,10 +53,10 @@ cc_library(
["glslang/OSDependent/Unix/ossource.cpp"],
["glslang/OSDependent/Unix/ossource.cpp"],
}),
}),
hdrs = glob([
hdrs = glob([
"glslang/HLSL/*.h",
"glslang/Include/*.h",
"glslang/Include/*.h",
"glslang/MachineIndependent/*.h",
"glslang/MachineIndependent/*.h",
"glslang/MachineIndependent/preprocessor/*.h",
"glslang/MachineIndependent/preprocessor/*.h",
"hlsl/*.h",
]) + [
]) + [
"OGLCompilersDLL/InitializeDll.h",
"OGLCompilersDLL/InitializeDll.h",
"StandAlone/DirStackFileIncluder.h",
"StandAlone/DirStackFileIncluder.h",
...
...
BUILD.gn
View file @
b247cfcd
...
@@ -88,6 +88,21 @@ source_set("glslang_sources") {
...
@@ -88,6 +88,21 @@ source_set("glslang_sources") {
"SPIRV/spvIR.h",
"SPIRV/spvIR.h",
"glslang/GenericCodeGen/CodeGen.cpp",
"glslang/GenericCodeGen/CodeGen.cpp",
"glslang/GenericCodeGen/Link.cpp",
"glslang/GenericCodeGen/Link.cpp",
"glslang/HLSL/hlslAttributes.cpp",
"glslang/HLSL/hlslAttributes.h",
"glslang/HLSL/hlslGrammar.cpp",
"glslang/HLSL/hlslGrammar.h",
"glslang/HLSL/hlslOpMap.cpp",
"glslang/HLSL/hlslOpMap.h",
"glslang/HLSL/hlslParseables.cpp",
"glslang/HLSL/hlslParseables.h",
"glslang/HLSL/hlslParseHelper.cpp",
"glslang/HLSL/hlslParseHelper.h",
"glslang/HLSL/hlslScanContext.cpp",
"glslang/HLSL/hlslScanContext.h",
"glslang/HLSL/hlslTokens.h",
"glslang/HLSL/hlslTokenStream.cpp",
"glslang/HLSL/hlslTokenStream.h",
"glslang/Include/BaseTypes.h",
"glslang/Include/BaseTypes.h",
"glslang/Include/Common.h",
"glslang/Include/Common.h",
"glslang/Include/ConstantUnion.h",
"glslang/Include/ConstantUnion.h",
...
@@ -147,21 +162,6 @@ source_set("glslang_sources") {
...
@@ -147,21 +162,6 @@ source_set("glslang_sources") {
"glslang/MachineIndependent/reflection.h",
"glslang/MachineIndependent/reflection.h",
"glslang/OSDependent/osinclude.h",
"glslang/OSDependent/osinclude.h",
"glslang/Public/ShaderLang.h",
"glslang/Public/ShaderLang.h",
"hlsl/hlslAttributes.cpp",
"hlsl/hlslAttributes.h",
"hlsl/hlslGrammar.cpp",
"hlsl/hlslGrammar.h",
"hlsl/hlslOpMap.cpp",
"hlsl/hlslOpMap.h",
"hlsl/hlslParseHelper.cpp",
"hlsl/hlslParseHelper.h",
"hlsl/hlslParseables.cpp",
"hlsl/hlslParseables.h",
"hlsl/hlslScanContext.cpp",
"hlsl/hlslScanContext.h",
"hlsl/hlslTokenStream.cpp",
"hlsl/hlslTokenStream.h",
"hlsl/hlslTokens.h",
]
]
defines = [ "ENABLE_OPT=1" ]
defines = [ "ENABLE_OPT=1" ]
...
...
glslang/CMakeLists.txt
View file @
b247cfcd
...
@@ -84,23 +84,23 @@ glslang_pch(SOURCES MachineIndependent/pch.cpp)
...
@@ -84,23 +84,23 @@ glslang_pch(SOURCES MachineIndependent/pch.cpp)
if
(
ENABLE_HLSL
)
if
(
ENABLE_HLSL
)
list
(
APPEND SOURCES
list
(
APPEND SOURCES
../hlsl
/hlslAttributes.cpp
HLSL
/hlslAttributes.cpp
../hlsl
/hlslParseHelper.cpp
HLSL
/hlslParseHelper.cpp
../hlsl
/hlslScanContext.cpp
HLSL
/hlslScanContext.cpp
../hlsl
/hlslOpMap.cpp
HLSL
/hlslOpMap.cpp
../hlsl
/hlslTokenStream.cpp
HLSL
/hlslTokenStream.cpp
../hlsl
/hlslGrammar.cpp
HLSL
/hlslGrammar.cpp
../hlsl
/hlslParseables.cpp
)
HLSL
/hlslParseables.cpp
)
list
(
APPEND HEADERS
list
(
APPEND HEADERS
../hlsl
/hlslAttributes.h
HLSL
/hlslAttributes.h
../hlsl
/hlslParseHelper.h
HLSL
/hlslParseHelper.h
../hlsl
/hlslTokens.h
HLSL
/hlslTokens.h
../hlsl
/hlslScanContext.h
HLSL
/hlslScanContext.h
../hlsl
/hlslOpMap.h
HLSL
/hlslOpMap.h
../hlsl
/hlslTokenStream.h
HLSL
/hlslTokenStream.h
../hlsl
/hlslGrammar.h
HLSL
/hlslGrammar.h
../hlsl
/hlslParseables.h
)
HLSL
/hlslParseables.h
)
endif
(
ENABLE_HLSL
)
endif
(
ENABLE_HLSL
)
add_library
(
glslang
${
LIB_TYPE
}
${
BISON_GLSLParser_OUTPUT_SOURCE
}
${
SOURCES
}
${
HEADERS
}
)
add_library
(
glslang
${
LIB_TYPE
}
${
BISON_GLSLParser_OUTPUT_SOURCE
}
${
SOURCES
}
${
HEADERS
}
)
...
...
hlsl
/hlslAttributes.cpp
→
glslang/HLSL
/hlslAttributes.cpp
View file @
b247cfcd
File moved
hlsl
/hlslAttributes.h
→
glslang/HLSL
/hlslAttributes.h
View file @
b247cfcd
...
@@ -39,8 +39,8 @@
...
@@ -39,8 +39,8 @@
#include <unordered_map>
#include <unordered_map>
#include <functional>
#include <functional>
#include "../
glslang/
MachineIndependent/attribute.h"
#include "../MachineIndependent/attribute.h"
#include "../
glslang/
MachineIndependent/SymbolTable.h"
#include "../MachineIndependent/SymbolTable.h"
#include "hlslScanContext.h"
#include "hlslScanContext.h"
namespace
glslang
{
namespace
glslang
{
...
...
hlsl
/hlslGrammar.cpp
→
glslang/HLSL
/hlslGrammar.cpp
View file @
b247cfcd
File moved
hlsl
/hlslGrammar.h
→
glslang/HLSL
/hlslGrammar.h
View file @
b247cfcd
File moved
hlsl
/hlslOpMap.cpp
→
glslang/HLSL
/hlslOpMap.cpp
View file @
b247cfcd
File moved
hlsl
/hlslOpMap.h
→
glslang/HLSL
/hlslOpMap.h
View file @
b247cfcd
File moved
hlsl
/hlslParseHelper.cpp
→
glslang/HLSL
/hlslParseHelper.cpp
View file @
b247cfcd
...
@@ -39,11 +39,11 @@
...
@@ -39,11 +39,11 @@
#include "hlslGrammar.h"
#include "hlslGrammar.h"
#include "hlslAttributes.h"
#include "hlslAttributes.h"
#include "../
glslang/
Include/Common.h"
#include "../Include/Common.h"
#include "../
glslang/
MachineIndependent/Scan.h"
#include "../MachineIndependent/Scan.h"
#include "../
glslang/
MachineIndependent/preprocessor/PpContext.h"
#include "../MachineIndependent/preprocessor/PpContext.h"
#include "../
glslang/
OSDependent/osinclude.h"
#include "../OSDependent/osinclude.h"
#include <algorithm>
#include <algorithm>
#include <functional>
#include <functional>
...
@@ -814,7 +814,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
...
@@ -814,7 +814,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
base
->
getAsSymbolNode
()
->
getName
().
c_str
(),
""
);
base
->
getAsSymbolNode
()
->
getName
().
c_str
(),
""
);
else
else
error
(
loc
,
" left of '[' is not of type array, matrix, or vector "
,
"expression"
,
""
);
error
(
loc
,
" left of '[' is not of type array, matrix, or vector "
,
"expression"
,
""
);
}
else
if
(
base
->
getType
().
getQualifier
().
isFrontEndConstant
()
&&
}
else
if
(
base
->
getType
().
getQualifier
().
isFrontEndConstant
()
&&
index
->
getQualifier
().
isFrontEndConstant
())
{
index
->
getQualifier
().
isFrontEndConstant
())
{
// both base and index are front-end constants
// both base and index are front-end constants
checkIndex
(
loc
,
base
->
getType
(),
indexValue
);
checkIndex
(
loc
,
base
->
getType
(),
indexValue
);
...
@@ -1848,7 +1848,7 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
...
@@ -1848,7 +1848,7 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
error
(
loc
,
"invalid partitioning"
,
""
,
""
);
error
(
loc
,
"invalid partitioning"
,
""
,
""
);
}
else
{
}
else
{
TVertexSpacing
partitioning
=
EvsNone
;
TVertexSpacing
partitioning
=
EvsNone
;
if
(
partitionStr
==
"integer"
)
{
if
(
partitionStr
==
"integer"
)
{
partitioning
=
EvsEqual
;
partitioning
=
EvsEqual
;
}
else
if
(
partitionStr
==
"fractional_even"
)
{
}
else
if
(
partitionStr
==
"fractional_even"
)
{
...
@@ -2484,7 +2484,7 @@ TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator
...
@@ -2484,7 +2484,7 @@ TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator
TIntermTyped
*
rhsElement
=
intermediate
.
addIndex
(
EOpIndexDirect
,
tempSymR
,
index
,
loc
);
TIntermTyped
*
rhsElement
=
intermediate
.
addIndex
(
EOpIndexDirect
,
tempSymR
,
index
,
loc
);
const
TType
derefType
(
right
->
getType
(),
0
);
const
TType
derefType
(
right
->
getType
(),
0
);
lhsElement
->
setType
(
derefType
);
lhsElement
->
setType
(
derefType
);
rhsElement
->
setType
(
derefType
);
rhsElement
->
setType
(
derefType
);
...
@@ -2504,7 +2504,7 @@ TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator
...
@@ -2504,7 +2504,7 @@ TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator
return
assignList
;
return
assignList
;
}
}
// Clip and cull distance require special handling due to a semantic mismatch. In HLSL,
// Clip and cull distance require special handling due to a semantic mismatch. In HLSL,
// these can be float scalar, float vector, or arrays of float scalar or float vector.
// these can be float scalar, float vector, or arrays of float scalar or float vector.
// In SPIR-V, they are arrays of scalar floats in all cases. We must copy individual components
// In SPIR-V, they are arrays of scalar floats in all cases. We must copy individual components
...
@@ -2573,7 +2573,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
...
@@ -2573,7 +2573,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
vecItems
+=
(
*
semanticNSize
)[
x
];
vecItems
+=
(
*
semanticNSize
)[
x
];
arrayLoc
+=
(
*
semanticNSize
)[
x
];
arrayLoc
+=
(
*
semanticNSize
)[
x
];
}
}
// It can have up to 2 array dimensions (in the case of geometry shader inputs)
// It can have up to 2 array dimensions (in the case of geometry shader inputs)
const
TArraySizes
*
const
internalArraySizes
=
internalNode
->
getType
().
getArraySizes
();
const
TArraySizes
*
const
internalArraySizes
=
internalNode
->
getType
().
getArraySizes
();
...
@@ -2594,7 +2594,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
...
@@ -2594,7 +2594,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
// into a float array, or vice versa. Here, we make the array the right size and type,
// into a float array, or vice versa. Here, we make the array the right size and type,
// which depends on the incoming data, which has several potential dimensions:
// which depends on the incoming data, which has several potential dimensions:
// * Semantic ID
// * Semantic ID
// * vector size
// * vector size
// * array size
// * array size
// Of those, semantic ID and array size cannot appear simultaneously.
// Of those, semantic ID and array size cannot appear simultaneously.
//
//
...
@@ -2655,7 +2655,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
...
@@ -2655,7 +2655,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
// Holds individual component assignments as we make them.
// Holds individual component assignments as we make them.
TIntermTyped
*
clipCullAssign
=
nullptr
;
TIntermTyped
*
clipCullAssign
=
nullptr
;
// If the types are homomorphic, use a simple assign. No need to mess about with
// If the types are homomorphic, use a simple assign. No need to mess about with
// individual components.
// individual components.
if
(
clipCullSym
->
getType
().
isArray
()
==
internalNode
->
getType
().
isArray
()
&&
if
(
clipCullSym
->
getType
().
isArray
()
==
internalNode
->
getType
().
isArray
()
&&
clipCullInnerArraySize
==
internalInnerArraySize
&&
clipCullInnerArraySize
==
internalInnerArraySize
&&
...
@@ -2766,7 +2766,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
...
@@ -2766,7 +2766,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
if
(
binaryNode
==
nullptr
)
if
(
binaryNode
==
nullptr
)
return
false
;
return
false
;
return
(
binaryNode
->
getOp
()
==
EOpIndexDirect
||
binaryNode
->
getOp
()
==
EOpIndexIndirect
)
&&
return
(
binaryNode
->
getOp
()
==
EOpIndexDirect
||
binaryNode
->
getOp
()
==
EOpIndexIndirect
)
&&
wasSplit
(
binaryNode
->
getLeft
());
wasSplit
(
binaryNode
->
getLeft
());
};
};
...
@@ -2798,7 +2798,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
...
@@ -2798,7 +2798,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
const
bool
isFlattenLeft
=
wasFlattened
(
leftSymbol
);
const
bool
isFlattenLeft
=
wasFlattened
(
leftSymbol
);
const
bool
isFlattenRight
=
wasFlattened
(
rightSymbol
);
const
bool
isFlattenRight
=
wasFlattened
(
rightSymbol
);
// OK to do a single assign if neither side is split or flattened. Otherwise,
// OK to do a single assign if neither side is split or flattened. Otherwise,
// fall through to a member-wise copy.
// fall through to a member-wise copy.
if
(
!
isFlattenLeft
&&
!
isFlattenRight
&&
!
isSplitLeft
&&
!
isSplitRight
)
{
if
(
!
isFlattenLeft
&&
!
isFlattenRight
&&
!
isSplitLeft
&&
!
isSplitRight
)
{
// Clip and cull distance requires more processing. See comment above assignClipCullDistance.
// Clip and cull distance requires more processing. See comment above assignClipCullDistance.
...
@@ -3430,9 +3430,9 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
...
@@ -3430,9 +3430,9 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// buffer then, but that's what it calls itself.
// buffer then, but that's what it calls itself.
const
bool
isByteAddressBuffer
=
(
builtInType
==
EbvByteAddressBuffer
||
const
bool
isByteAddressBuffer
=
(
builtInType
==
EbvByteAddressBuffer
||
builtInType
==
EbvRWByteAddressBuffer
);
builtInType
==
EbvRWByteAddressBuffer
);
if
(
isByteAddressBuffer
)
if
(
isByteAddressBuffer
)
argIndex
=
intermediate
.
addBinaryNode
(
EOpRightShift
,
argIndex
,
argIndex
=
intermediate
.
addBinaryNode
(
EOpRightShift
,
argIndex
,
...
@@ -3447,7 +3447,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
...
@@ -3447,7 +3447,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
const
TType
derefType
(
argArray
->
getType
(),
0
);
const
TType
derefType
(
argArray
->
getType
(),
0
);
node
->
setType
(
derefType
);
node
->
setType
(
derefType
);
}
}
break
;
break
;
case
EOpMethodLoad2
:
case
EOpMethodLoad2
:
...
@@ -3573,8 +3573,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
...
@@ -3573,8 +3573,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
const
TType
indexType
(
argValue
->
getType
(),
0
);
const
TType
indexType
(
argValue
->
getType
(),
0
);
rValue
->
setType
(
indexType
);
rValue
->
setType
(
indexType
);
}
}
TIntermTyped
*
assign
=
intermediate
.
addAssign
(
EOpAssign
,
lValue
,
rValue
,
loc
);
TIntermTyped
*
assign
=
intermediate
.
addAssign
(
EOpAssign
,
lValue
,
rValue
,
loc
);
body
=
intermediate
.
growAggregate
(
body
,
assign
);
body
=
intermediate
.
growAggregate
(
body
,
assign
);
}
}
...
@@ -3751,7 +3751,7 @@ TIntermConstantUnion* HlslParseContext::getSamplePosArray(int count)
...
@@ -3751,7 +3751,7 @@ TIntermConstantUnion* HlslParseContext::getSamplePosArray(int count)
}
}
TConstUnionArray
*
values
=
new
TConstUnionArray
(
numSamples
*
2
);
TConstUnionArray
*
values
=
new
TConstUnionArray
(
numSamples
*
2
);
for
(
int
pos
=
0
;
pos
<
count
;
++
pos
)
{
for
(
int
pos
=
0
;
pos
<
count
;
++
pos
)
{
TConstUnion
x
,
y
;
TConstUnion
x
,
y
;
x
.
setDConst
(
sampleLoc
[
pos
].
x
);
x
.
setDConst
(
sampleLoc
[
pos
].
x
);
...
@@ -3785,7 +3785,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -3785,7 +3785,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
result
->
setType
(
TType
(
node
->
getType
().
getBasicType
(),
EvqTemporary
,
node
->
getVectorSize
()));
result
->
setType
(
TType
(
node
->
getType
().
getBasicType
(),
EvqTemporary
,
node
->
getVectorSize
()));
TIntermTyped
*
convertedResult
=
nullptr
;
TIntermTyped
*
convertedResult
=
nullptr
;
TType
retType
;
TType
retType
;
getTextureReturnType
(
sampler
,
retType
);
getTextureReturnType
(
sampler
,
retType
);
...
@@ -3811,7 +3811,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -3811,7 +3811,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
for
(
unsigned
m
=
0
;
m
<
unsigned
(
retType
.
getStruct
()
->
size
());
++
m
)
{
for
(
unsigned
m
=
0
;
m
<
unsigned
(
retType
.
getStruct
()
->
size
());
++
m
)
{
const
TType
memberType
(
retType
,
m
);
// dereferenced type of the member we're about to assign.
const
TType
memberType
(
retType
,
m
);
// dereferenced type of the member we're about to assign.
// Check for bad struct members. This should have been caught upstream. Complain, because
// Check for bad struct members. This should have been caught upstream. Complain, because
// wwe don't know what to do with it. This algorithm could be generalized to handle
// wwe don't know what to do with it. This algorithm could be generalized to handle
// other things, e.g, sub-structures, but HLSL doesn't allow them.
// other things, e.g, sub-structures, but HLSL doesn't allow them.
...
@@ -3819,7 +3819,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -3819,7 +3819,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
error
(
loc
,
"expected: scalar or vector type in texture structure"
,
""
,
""
);
error
(
loc
,
"expected: scalar or vector type in texture structure"
,
""
,
""
);
return
nullptr
;
return
nullptr
;
}
}
// Index into the struct variable to find the member to assign.
// Index into the struct variable to find the member to assign.
TIntermTyped
*
structMember
=
intermediate
.
addIndex
(
EOpIndexDirectStruct
,
TIntermTyped
*
structMember
=
intermediate
.
addIndex
(
EOpIndexDirectStruct
,
intermediate
.
addSymbol
(
*
structVar
,
loc
),
intermediate
.
addSymbol
(
*
structVar
,
loc
),
...
@@ -3841,14 +3841,14 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -3841,14 +3841,14 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
TIntermTyped
*
structVecComponent
=
intermediate
.
addIndex
(
EOpIndexDirect
,
structMember
,
TIntermTyped
*
structVecComponent
=
intermediate
.
addIndex
(
EOpIndexDirect
,
structMember
,
intermediate
.
addConstantUnion
(
component
,
loc
),
loc
);
intermediate
.
addConstantUnion
(
component
,
loc
),
loc
);
memberAssign
=
intermediate
.
addAssign
(
EOpAssign
,
structVecComponent
,
vec4Member
,
loc
);
memberAssign
=
intermediate
.
addAssign
(
EOpAssign
,
structVecComponent
,
vec4Member
,
loc
);
}
else
{
}
else
{
// Scalar member: we can assign to it directly.
// Scalar member: we can assign to it directly.
memberAssign
=
intermediate
.
addAssign
(
EOpAssign
,
structMember
,
vec4Member
,
loc
);
memberAssign
=
intermediate
.
addAssign
(
EOpAssign
,
structMember
,
vec4Member
,
loc
);
}
}
conversionAggregate
->
getSequence
().
push_back
(
memberAssign
);
conversionAggregate
->
getSequence
().
push_back
(
memberAssign
);
}
}
}
}
...
@@ -3887,7 +3887,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -3887,7 +3887,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
if
(
arguments
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
if
(
arguments
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
return
;
return
;
}
else
{
}
else
{
if
(
argAggregate
->
getSequence
().
size
()
==
0
||
if
(
argAggregate
->
getSequence
().
size
()
==
0
||
argAggregate
->
getSequence
()[
0
]
==
nullptr
||
argAggregate
->
getSequence
()[
0
]
==
nullptr
||
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
return
;
return
;
...
@@ -4584,13 +4584,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -4584,13 +4584,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
int
count
=
0
;
int
count
=
0
;
for
(
int
val
=
2
;
val
<=
16
;
val
*=
2
)
for
(
int
val
=
2
;
val
<=
16
;
val
*=
2
)
idxtest
[
count
++
]
=
idxtest
[
count
++
]
=
intermediate
.
addBinaryNode
(
EOpEqual
,
intermediate
.
addBinaryNode
(
EOpEqual
,
intermediate
.
addSymbol
(
*
outSampleCount
,
loc
),
intermediate
.
addSymbol
(
*
outSampleCount
,
loc
),
intermediate
.
addConstantUnion
(
val
,
loc
),
intermediate
.
addConstantUnion
(
val
,
loc
),
loc
,
TType
(
EbtBool
));
loc
,
TType
(
EbtBool
));
const
TOperator
idxOp
=
(
argSampIdx
->
getQualifier
().
storage
==
EvqConst
)
?
EOpIndexDirect
:
EOpIndexIndirect
;
const
TOperator
idxOp
=
(
argSampIdx
->
getQualifier
().
storage
==
EvqConst
)
?
EOpIndexDirect
:
EOpIndexIndirect
;
// Create index ops into position arrays given sample index.
// Create index ops into position arrays given sample index.
// TODO: should it be clamped?
// TODO: should it be clamped?
TIntermTyped
*
index
[
4
];
TIntermTyped
*
index
[
4
];
...
@@ -4605,13 +4605,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -4605,13 +4605,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
// (sampleCount == 4) ? pos4[idx] :
// (sampleCount == 4) ? pos4[idx] :
// (sampleCount == 8) ? pos8[idx] :
// (sampleCount == 8) ? pos8[idx] :
// (sampleCount == 16) ? pos16[idx] : float2(0,0);
// (sampleCount == 16) ? pos16[idx] : float2(0,0);
TIntermTyped
*
test
=
TIntermTyped
*
test
=
intermediate
.
addSelection
(
idxtest
[
0
],
index
[
0
],
intermediate
.
addSelection
(
idxtest
[
0
],
index
[
0
],
intermediate
.
addSelection
(
idxtest
[
1
],
index
[
1
],
intermediate
.
addSelection
(
idxtest
[
1
],
index
[
1
],
intermediate
.
addSelection
(
idxtest
[
2
],
index
[
2
],
intermediate
.
addSelection
(
idxtest
[
2
],
index
[
2
],
intermediate
.
addSelection
(
idxtest
[
3
],
index
[
3
],
intermediate
.
addSelection
(
idxtest
[
3
],
index
[
3
],
getSamplePosArray
(
1
),
loc
),
loc
),
loc
),
loc
);
getSamplePosArray
(
1
),
loc
),
loc
),
loc
),
loc
);
compoundStatement
=
intermediate
.
growAggregate
(
compoundStatement
,
test
);
compoundStatement
=
intermediate
.
growAggregate
(
compoundStatement
,
test
);
compoundStatement
->
setOperator
(
EOpSequence
);
compoundStatement
->
setOperator
(
EOpSequence
);
compoundStatement
->
setLoc
(
loc
);
compoundStatement
->
setLoc
(
loc
);
...
@@ -4624,7 +4624,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -4624,7 +4624,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case
EOpSubpassLoad
:
case
EOpSubpassLoad
:
{
{
const
TIntermTyped
*
argSubpass
=
const
TIntermTyped
*
argSubpass
=
argAggregate
?
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
:
argAggregate
?
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
:
arguments
->
getAsTyped
();
arguments
->
getAsTyped
();
...
@@ -4639,7 +4639,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -4639,7 +4639,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
break
;
break
;
}
}
default
:
default
:
break
;
// most pass through unchanged
break
;
// most pass through unchanged
...
@@ -5159,7 +5159,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5159,7 +5159,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
for
(
int
idx
=
0
;
idx
<
vecSize
;
++
idx
)
{
for
(
int
idx
=
0
;
idx
<
vecSize
;
++
idx
)
{
TIntermTyped
*
idxConst
=
intermediate
.
addConstantUnion
(
idx
,
loc
,
true
);
TIntermTyped
*
idxConst
=
intermediate
.
addConstantUnion
(
idx
,
loc
,
true
);
TIntermTyped
*
component
=
argValue
->
getType
().
isVector
()
?
TIntermTyped
*
component
=
argValue
->
getType
().
isVector
()
?
intermediate
.
addIndex
(
EOpIndexDirect
,
argValue
,
idxConst
,
loc
)
:
argValue
;
intermediate
.
addIndex
(
EOpIndexDirect
,
argValue
,
idxConst
,
loc
)
:
argValue
;
if
(
component
!=
argValue
)
if
(
component
!=
argValue
)
...
@@ -5171,7 +5171,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5171,7 +5171,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
unpackOp
->
setLoc
(
loc
);
unpackOp
->
setLoc
(
loc
);
TIntermTyped
*
lowOrder
=
intermediate
.
addIndex
(
EOpIndexDirect
,
unpackOp
,
zero
,
loc
);
TIntermTyped
*
lowOrder
=
intermediate
.
addIndex
(
EOpIndexDirect
,
unpackOp
,
zero
,
loc
);
if
(
result
!=
nullptr
)
{
if
(
result
!=
nullptr
)
{
result
->
getSequence
().
push_back
(
lowOrder
);
result
->
getSequence
().
push_back
(
lowOrder
);
node
=
result
;
node
=
result
;
...
@@ -5179,7 +5179,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5179,7 +5179,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
node
=
lowOrder
;
node
=
lowOrder
;
}
}
}
}
break
;
break
;
}
}
...
@@ -5210,7 +5210,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5210,7 +5210,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
for
(
int
idx
=
0
;
idx
<
vecSize
;
++
idx
)
{
for
(
int
idx
=
0
;
idx
<
vecSize
;
++
idx
)
{
TIntermTyped
*
idxConst
=
intermediate
.
addConstantUnion
(
idx
,
loc
,
true
);
TIntermTyped
*
idxConst
=
intermediate
.
addConstantUnion
(
idx
,
loc
,
true
);
TIntermTyped
*
component
=
argValue
->
getType
().
isVector
()
?
TIntermTyped
*
component
=
argValue
->
getType
().
isVector
()
?
intermediate
.
addIndex
(
EOpIndexDirect
,
argValue
,
idxConst
,
loc
)
:
argValue
;
intermediate
.
addIndex
(
EOpIndexDirect
,
argValue
,
idxConst
,
loc
)
:
argValue
;
if
(
component
!=
argValue
)
if
(
component
!=
argValue
)
...
@@ -5221,7 +5221,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5221,7 +5221,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
vec2ComponentAndZero
->
getSequence
().
push_back
(
zero
);
vec2ComponentAndZero
->
getSequence
().
push_back
(
zero
);
vec2ComponentAndZero
->
setType
(
TType
(
EbtFloat
,
EvqTemporary
,
2
));
vec2ComponentAndZero
->
setType
(
TType
(
EbtFloat
,
EvqTemporary
,
2
));
vec2ComponentAndZero
->
setLoc
(
loc
);
vec2ComponentAndZero
->
setLoc
(
loc
);
TIntermTyped
*
packOp
=
new
TIntermUnary
(
EOpPackHalf2x16
);
TIntermTyped
*
packOp
=
new
TIntermUnary
(
EOpPackHalf2x16
);
packOp
->
getAsUnaryNode
()
->
setOperand
(
vec2ComponentAndZero
);
packOp
->
getAsUnaryNode
()
->
setOperand
(
vec2ComponentAndZero
);
packOp
->
setLoc
(
loc
);
packOp
->
setLoc
(
loc
);
...
@@ -5294,7 +5294,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
...
@@ -5294,7 +5294,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
TIntermTyped
*
notinf
=
handleUnaryMath
(
loc
,
"!"
,
EOpLogicalNot
,
isinf
);
TIntermTyped
*
notinf
=
handleUnaryMath
(
loc
,
"!"
,
EOpLogicalNot
,
isinf
);
notinf
->
setType
(
boolType
);
notinf
->
setType
(
boolType
);
TIntermTyped
*
andNode
=
handleBinaryMath
(
loc
,
"and"
,
EOpLogicalAnd
,
notnan
,
notinf
);
TIntermTyped
*
andNode
=
handleBinaryMath
(
loc
,
"and"
,
EOpLogicalAnd
,
notnan
,
notinf
);
andNode
->
setType
(
boolType
);
andNode
->
setType
(
boolType
);
...
@@ -5678,7 +5678,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
...
@@ -5678,7 +5678,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
// means take 'arguments' itself as the one argument.
// means take 'arguments' itself as the one argument.
TIntermTyped
*
arg
=
function
.
getParamCount
()
==
1
TIntermTyped
*
arg
=
function
.
getParamCount
()
==
1
?
arguments
->
getAsTyped
()
?
arguments
->
getAsTyped
()
:
(
aggregate
?
:
(
aggregate
?
aggregate
->
getSequence
()[
param
]
->
getAsTyped
()
:
aggregate
->
getSequence
()[
param
]
->
getAsTyped
()
:
arguments
->
getAsTyped
());
arguments
->
getAsTyped
());
if
(
*
function
[
param
].
type
!=
arg
->
getType
())
{
if
(
*
function
[
param
].
type
!=
arg
->
getType
())
{
...
@@ -5749,7 +5749,7 @@ void HlslParseContext::expandArguments(const TSourceLoc& loc, const TFunction& f
...
@@ -5749,7 +5749,7 @@ void HlslParseContext::expandArguments(const TSourceLoc& loc, const TFunction& f
else
if
(
args
.
size
()
>
1
)
{
else
if
(
args
.
size
()
>
1
)
{
if
(
function
.
getParamCount
()
+
functionParamNumberOffset
==
1
)
{
if
(
function
.
getParamCount
()
+
functionParamNumberOffset
==
1
)
{
arguments
=
intermediate
.
makeAggregate
(
args
.
front
());
arguments
=
intermediate
.
makeAggregate
(
args
.
front
());
std
::
for_each
(
args
.
begin
()
+
1
,
args
.
end
(),
std
::
for_each
(
args
.
begin
()
+
1
,
args
.
end
(),
[
&
](
TIntermTyped
*
arg
)
{
[
&
](
TIntermTyped
*
arg
)
{
arguments
=
intermediate
.
growAggregate
(
arguments
,
arg
);
arguments
=
intermediate
.
growAggregate
(
arguments
,
arg
);
});
});
...
@@ -5768,7 +5768,7 @@ void HlslParseContext::expandArguments(const TSourceLoc& loc, const TFunction& f
...
@@ -5768,7 +5768,7 @@ void HlslParseContext::expandArguments(const TSourceLoc& loc, const TFunction& f
// means take 'arguments' itself as the one argument.
// means take 'arguments' itself as the one argument.
TIntermTyped
*
arg
=
function
.
getParamCount
()
==
1
TIntermTyped
*
arg
=
function
.
getParamCount
()
==
1
?
arguments
->
getAsTyped
()
?
arguments
->
getAsTyped
()
:
(
aggregate
?
:
(
aggregate
?
aggregate
->
getSequence
()[
param
+
functionParamNumberOffset
]
->
getAsTyped
()
:
aggregate
->
getSequence
()[
param
+
functionParamNumberOffset
]
->
getAsTyped
()
:
arguments
->
getAsTyped
());
arguments
->
getAsTyped
());
...
@@ -8568,7 +8568,7 @@ TIntermTyped* HlslParseContext::convertArray(TIntermTyped* node, const TType& ty
...
@@ -8568,7 +8568,7 @@ TIntermTyped* HlslParseContext::convertArray(TIntermTyped* node, const TType& ty
// bump up to the next component to consume
// bump up to the next component to consume
const
auto
getNextComponent
=
[
&
]()
{
const
auto
getNextComponent
=
[
&
]()
{
TIntermTyped
*
component
;
TIntermTyped
*
component
;
component
=
handleBracketDereference
(
node
->
getLoc
(),
constructee
,
component
=
handleBracketDereference
(
node
->
getLoc
(),
constructee
,
intermediate
.
addConstantUnion
(
constructeeElement
,
node
->
getLoc
()));
intermediate
.
addConstantUnion
(
constructeeElement
,
node
->
getLoc
()));
if
(
component
->
isVector
())
if
(
component
->
isVector
())
component
=
handleBracketDereference
(
node
->
getLoc
(),
component
,
component
=
handleBracketDereference
(
node
->
getLoc
(),
component
,
...
@@ -9640,7 +9640,7 @@ bool HlslParseContext::setTextureReturnType(TSampler& sampler, const TType& retT
...
@@ -9640,7 +9640,7 @@ bool HlslParseContext::setTextureReturnType(TSampler& sampler, const TType& retT
// Insert it in the vector that tracks struct return types.
// Insert it in the vector that tracks struct return types.
sampler
.
structReturnIndex
=
unsigned
(
textureReturnStruct
.
size
());
sampler
.
structReturnIndex
=
unsigned
(
textureReturnStruct
.
size
());
textureReturnStruct
.
push_back
(
members
);
textureReturnStruct
.
push_back
(
members
);
// Success!
// Success!
return
true
;
return
true
;
}
}
...
@@ -9688,7 +9688,7 @@ const TFunction* HlslParseContext::findPatchConstantFunction(const TSourceLoc& l
...
@@ -9688,7 +9688,7 @@ const TFunction* HlslParseContext::findPatchConstantFunction(const TSourceLoc& l
TVector
<
const
TFunction
*>
candidateList
;
TVector
<
const
TFunction
*>
candidateList
;
bool
builtIn
;
bool
builtIn
;
symbolTable
.
findFunctionNameList
(
mangledName
,
candidateList
,
builtIn
);
symbolTable
.
findFunctionNameList
(
mangledName
,
candidateList
,
builtIn
);
// We have to have one and only one, or we don't know which to pick: the patchconstantfunc does not
// We have to have one and only one, or we don't know which to pick: the patchconstantfunc does not
// allow any disambiguation of overloads.
// allow any disambiguation of overloads.
if
(
candidateList
.
empty
())
{
if
(
candidateList
.
empty
())
{
...
@@ -9759,26 +9759,26 @@ void HlslParseContext::addPatchConstantInvocation()
...
@@ -9759,26 +9759,26 @@ void HlslParseContext::addPatchConstantInvocation()
return
type
.
isSizedArray
()
&&
biType
==
EbvOutputPatch
;
return
type
.
isSizedArray
()
&&
biType
==
EbvOutputPatch
;
};
};
// We will perform these steps. Each is in a scoped block for separation: they could
// We will perform these steps. Each is in a scoped block for separation: they could
// become separate functions to make addPatchConstantInvocation shorter.
// become separate functions to make addPatchConstantInvocation shorter.
//
//
// 1. Union the interfaces, and create built-ins for anything present in the PCF and
// 1. Union the interfaces, and create built-ins for anything present in the PCF and
// declared as a built-in variable that isn't present in the entry point's signature.
// declared as a built-in variable that isn't present in the entry point's signature.
//
//
// 2. Synthesizes a call to the patchconstfunction using built-in variables from either main,
// 2. Synthesizes a call to the patchconstfunction using built-in variables from either main,
// or the ones we created. Matching is based on built-in type. We may use synthesized
// or the ones we created. Matching is based on built-in type. We may use synthesized
// variables from (1) above.
// variables from (1) above.
//
//
// 2B: Synthesize per control point invocations of wrapped entry point if the PCF requires them.
// 2B: Synthesize per control point invocations of wrapped entry point if the PCF requires them.
//
//
// 3. Create a return sequence: copy the return value (if any) from the PCF to a
// 3. Create a return sequence: copy the return value (if any) from the PCF to a
// (non-sanitized) output variable. In case this may involve multiple copies, such as for
// (non-sanitized) output variable. In case this may involve multiple copies, such as for
// an arrayed variable, a temporary copy of the PCF output is created to avoid multiple
// an arrayed variable, a temporary copy of the PCF output is created to avoid multiple
// indirections into a complex R-value coming from the call to the PCF.
// indirections into a complex R-value coming from the call to the PCF.
//
//
// 4. Create a barrier.
// 4. Create a barrier.
//
//
// 5/5B. Call the PCF inside an if test for (invocation id == 0).
// 5/5B. Call the PCF inside an if test for (invocation id == 0).
TFunction
*
patchConstantFunctionPtr
=
const_cast
<
TFunction
*>
(
findPatchConstantFunction
(
loc
));
TFunction
*
patchConstantFunctionPtr
=
const_cast
<
TFunction
*>
(
findPatchConstantFunction
(
loc
));
...
@@ -9885,7 +9885,7 @@ void HlslParseContext::addPatchConstantInvocation()
...
@@ -9885,7 +9885,7 @@ void HlslParseContext::addPatchConstantInvocation()
}
else
{
}
else
{
// find which built-in it is
// find which built-in it is
const
TBuiltInVariable
biType
=
patchConstantFunction
[
p
].
getDeclaredBuiltIn
();
const
TBuiltInVariable
biType
=
patchConstantFunction
[
p
].
getDeclaredBuiltIn
();
if
(
biType
==
EbvInputPatch
&&
inputPatch
==
nullptr
)
{
if
(
biType
==
EbvInputPatch
&&
inputPatch
==
nullptr
)
{
error
(
loc
,
"unimplemented: PCF input patch without entry point input patch parameter"
,
""
,
""
);
error
(
loc
,
"unimplemented: PCF input patch without entry point input patch parameter"
,
""
,
""
);
return
;
return
;
...
@@ -9992,7 +9992,7 @@ void HlslParseContext::addPatchConstantInvocation()
...
@@ -9992,7 +9992,7 @@ void HlslParseContext::addPatchConstantInvocation()
element
->
setType
(
derefType
);
element
->
setType
(
derefType
);
element
->
setLoc
(
loc
);
element
->
setLoc
(
loc
);
pcfCallSequence
=
intermediate
.
growAggregate
(
pcfCallSequence
,
pcfCallSequence
=
intermediate
.
growAggregate
(
pcfCallSequence
,
handleAssign
(
loc
,
EOpAssign
,
element
,
callReturn
));
handleAssign
(
loc
,
EOpAssign
,
element
,
callReturn
));
}
}
}
}
...
@@ -10041,7 +10041,7 @@ void HlslParseContext::addPatchConstantInvocation()
...
@@ -10041,7 +10041,7 @@ void HlslParseContext::addPatchConstantInvocation()
pcfCallSequence
=
intermediate
.
growAggregate
(
pcfCallSequence
,
pcfCall
);
pcfCallSequence
=
intermediate
.
growAggregate
(
pcfCallSequence
,
pcfCall
);
}
}
// ================ Step 4: Barrier ================
// ================ Step 4: Barrier ================
TIntermTyped
*
barrier
=
new
TIntermAggregate
(
EOpBarrier
);
TIntermTyped
*
barrier
=
new
TIntermAggregate
(
EOpBarrier
);
barrier
->
setLoc
(
loc
);
barrier
->
setLoc
(
loc
);
barrier
->
setType
(
TType
(
EbtVoid
));
barrier
->
setType
(
TType
(
EbtVoid
));
...
@@ -10113,7 +10113,7 @@ void HlslParseContext::finalizeAppendMethods()
...
@@ -10113,7 +10113,7 @@ void HlslParseContext::finalizeAppendMethods()
// Patch append sequences, now that we know the stream output symbol.
// Patch append sequences, now that we know the stream output symbol.
for
(
auto
append
=
gsAppends
.
begin
();
append
!=
gsAppends
.
end
();
++
append
)
{
for
(
auto
append
=
gsAppends
.
begin
();
append
!=
gsAppends
.
end
();
++
append
)
{
append
->
node
->
getSequence
()[
0
]
=
append
->
node
->
getSequence
()[
0
]
=
handleAssign
(
append
->
loc
,
EOpAssign
,
handleAssign
(
append
->
loc
,
EOpAssign
,
intermediate
.
addSymbol
(
*
gsStreamOutput
,
append
->
loc
),
intermediate
.
addSymbol
(
*
gsStreamOutput
,
append
->
loc
),
append
->
node
->
getSequence
()[
0
]
->
getAsTyped
());
append
->
node
->
getSequence
()[
0
]
->
getAsTyped
());
...
...
hlsl
/hlslParseHelper.h
→
glslang/HLSL
/hlslParseHelper.h
View file @
b247cfcd
...
@@ -36,9 +36,9 @@
...
@@ -36,9 +36,9 @@
#ifndef HLSL_PARSE_INCLUDED_
#ifndef HLSL_PARSE_INCLUDED_
#define HLSL_PARSE_INCLUDED_
#define HLSL_PARSE_INCLUDED_
#include "../
glslang/
MachineIndependent/parseVersions.h"
#include "../MachineIndependent/parseVersions.h"
#include "../
glslang/
MachineIndependent/ParseHelper.h"
#include "../MachineIndependent/ParseHelper.h"
#include "../
glslang/
MachineIndependent/attribute.h"
#include "../MachineIndependent/attribute.h"
#include <array>
#include <array>
...
@@ -320,7 +320,7 @@ protected:
...
@@ -320,7 +320,7 @@ protected:
// Finalization step: remove unused buffer blocks from linkage (we don't know until the
// Finalization step: remove unused buffer blocks from linkage (we don't know until the
// shader is entirely compiled)
// shader is entirely compiled)
void
removeUnusedStructBufferCounters
();
void
removeUnusedStructBufferCounters
();
static
bool
isClipOrCullDistance
(
TBuiltInVariable
);
static
bool
isClipOrCullDistance
(
TBuiltInVariable
);
static
bool
isClipOrCullDistance
(
const
TQualifier
&
qual
)
{
return
isClipOrCullDistance
(
qual
.
builtIn
);
}
static
bool
isClipOrCullDistance
(
const
TQualifier
&
qual
)
{
return
isClipOrCullDistance
(
qual
.
builtIn
);
}
static
bool
isClipOrCullDistance
(
const
TType
&
type
)
{
return
isClipOrCullDistance
(
type
.
getQualifier
());
}
static
bool
isClipOrCullDistance
(
const
TType
&
type
)
{
return
isClipOrCullDistance
(
type
.
getQualifier
());
}
...
@@ -407,7 +407,7 @@ protected:
...
@@ -407,7 +407,7 @@ protected:
// This tracks texture sample user structure return types. Only a limited number are supported, as
// This tracks texture sample user structure return types. Only a limited number are supported, as
// may fit in TSampler::structReturnIndex.
// may fit in TSampler::structReturnIndex.
TVector
<
TTypeList
*>
textureReturnStruct
;
TVector
<
TTypeList
*>
textureReturnStruct
;
TMap
<
TString
,
bool
>
structBufferCounter
;
// true if counter buffer is in use
TMap
<
TString
,
bool
>
structBufferCounter
;
// true if counter buffer is in use
// The built-in interstage IO map considers e.g, EvqPosition on input and output separately, so that we
// The built-in interstage IO map considers e.g, EvqPosition on input and output separately, so that we
...
@@ -456,7 +456,7 @@ protected:
...
@@ -456,7 +456,7 @@ protected:
std
::
array
<
int
,
maxClipCullRegs
>
cullSemanticNSizeOut
;
// vector, indexed by cull semantic ID
std
::
array
<
int
,
maxClipCullRegs
>
cullSemanticNSizeOut
;
// vector, indexed by cull semantic ID
// This tracks the first (mip level) argument to the .mips[][] operator. Since this can be nested as
// This tracks the first (mip level) argument to the .mips[][] operator. Since this can be nested as
// in tx.mips[tx.mips[0][1].x][2], we need a stack. We also track the TSourceLoc for error reporting
// in tx.mips[tx.mips[0][1].x][2], we need a stack. We also track the TSourceLoc for error reporting
// purposes.
// purposes.
struct
tMipsOperatorData
{
struct
tMipsOperatorData
{
tMipsOperatorData
(
TSourceLoc
l
,
TIntermTyped
*
m
)
:
loc
(
l
),
mipLevel
(
m
)
{
}
tMipsOperatorData
(
TSourceLoc
l
,
TIntermTyped
*
m
)
:
loc
(
l
),
mipLevel
(
m
)
{
}
...
...
hlsl
/hlslParseables.cpp
→
glslang/HLSL
/hlslParseables.cpp
View file @
b247cfcd
File moved
hlsl
/hlslParseables.h
→
glslang/HLSL
/hlslParseables.h
View file @
b247cfcd
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#ifndef _HLSLPARSEABLES_INCLUDED_
#ifndef _HLSLPARSEABLES_INCLUDED_
#define _HLSLPARSEABLES_INCLUDED_
#define _HLSLPARSEABLES_INCLUDED_
#include "../
glslang/
MachineIndependent/Initialize.h"
#include "../MachineIndependent/Initialize.h"
namespace
glslang
{
namespace
glslang
{
...
...
hlsl
/hlslScanContext.cpp
→
glslang/HLSL
/hlslScanContext.cpp
View file @
b247cfcd
...
@@ -42,15 +42,15 @@
...
@@ -42,15 +42,15 @@
#include <unordered_map>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include "../
glslang/
Include/Types.h"
#include "../Include/Types.h"
#include "../
glslang/
MachineIndependent/SymbolTable.h"
#include "../MachineIndependent/SymbolTable.h"
#include "../
glslang/
MachineIndependent/ParseHelper.h"
#include "../MachineIndependent/ParseHelper.h"
#include "hlslScanContext.h"
#include "hlslScanContext.h"
#include "hlslTokens.h"
#include "hlslTokens.h"
// preprocessor includes
// preprocessor includes
#include "../
glslang/
MachineIndependent/preprocessor/PpContext.h"
#include "../MachineIndependent/preprocessor/PpContext.h"
#include "../
glslang/
MachineIndependent/preprocessor/PpTokens.h"
#include "../MachineIndependent/preprocessor/PpTokens.h"
namespace
{
namespace
{
...
...
hlsl
/hlslScanContext.h
→
glslang/HLSL
/hlslScanContext.h
View file @
b247cfcd
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#ifndef HLSLSCANCONTEXT_H_
#ifndef HLSLSCANCONTEXT_H_
#define HLSLSCANCONTEXT_H_
#define HLSLSCANCONTEXT_H_
#include "../
glslang/
MachineIndependent/ParseHelper.h"
#include "../MachineIndependent/ParseHelper.h"
#include "hlslTokens.h"
#include "hlslTokens.h"
namespace
glslang
{
namespace
glslang
{
...
...
hlsl
/hlslTokenStream.cpp
→
glslang/HLSL
/hlslTokenStream.cpp
View file @
b247cfcd
File moved
hlsl
/hlslTokenStream.h
→
glslang/HLSL
/hlslTokenStream.h
View file @
b247cfcd
File moved
hlsl
/hlslTokens.h
→
glslang/HLSL
/hlslTokens.h
View file @
b247cfcd
File moved
hlsl
/pch.cpp
→
glslang/HLSL
/pch.cpp
View file @
b247cfcd
File moved
hlsl
/pch.h
→
glslang/HLSL
/pch.h
View file @
b247cfcd
...
@@ -34,21 +34,20 @@
...
@@ -34,21 +34,20 @@
// POSSIBILITY OF SUCH DAMAGE.
// POSSIBILITY OF SUCH DAMAGE.
//
//
#include "hlslAttributes.h"
#include "hlslGrammar.h"
#include "hlslParseHelper.h"
#include "hlslParseHelper.h"
#include "hlslScanContext.h"
#include "hlslScanContext.h"
#include "hlslGrammar.h"
#include "hlslAttributes.h"
#include "../
glslang/
MachineIndependent/Scan.h"
#include "../MachineIndependent/Scan.h"
#include "../
glslang/
MachineIndependent/preprocessor/PpContext.h"
#include "../MachineIndependent/preprocessor/PpContext.h"
#include "../
glslang/
OSDependent/osinclude.h"
#include "../OSDependent/osinclude.h"
#include <algorithm>
#include <algorithm>
#include <functional>
#include <cctype>
#include <array>
#include <array>
#include <cctype>
#include <functional>
#include <set>
#include <set>
#endif
/* _PCH_H */
#endif
/* _PCH_H */
glslang/MachineIndependent/ShaderLang.cpp
View file @
b247cfcd
...
@@ -51,9 +51,9 @@
...
@@ -51,9 +51,9 @@
#include "ScanContext.h"
#include "ScanContext.h"
#ifdef ENABLE_HLSL
#ifdef ENABLE_HLSL
#include "../
../hlsl
/hlslParseHelper.h"
#include "../
HLSL
/hlslParseHelper.h"
#include "../
../hlsl
/hlslParseables.h"
#include "../
HLSL
/hlslParseables.h"
#include "../
../hlsl
/hlslScanContext.h"
#include "../
HLSL
/hlslScanContext.h"
#endif
#endif
#include "../Include/ShHandle.h"
#include "../Include/ShHandle.h"
...
...
hlsl/CMakeLists.txt
View file @
b247cfcd
# The HLSL source is directly embedded into the glslang target when ENABLE_HLSL
# The HLSL source is directly embedded into the glslang target when ENABLE_HLSL
# is set.
# is set.
# This source now lives at: glslang/HLSL/
# The HLSL target is now just a stub that exists for backwards compatibility for
# The HLSL target is now just a stub that exists for backwards compatibility for
# projects that referenced this target.
# projects that referenced this target.
...
...
hlsl/stub.cpp
View file @
b247cfcd
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
// The HLSL source is directly embedded into the glslang target when ENABLE_HLSL
// The HLSL source is directly embedded into the glslang target when ENABLE_HLSL
// is set.
// is set.
// This source now lives at: glslang/HLSL/
// The HLSL target is now just a stub that exists for backwards compatibility
// The HLSL target is now just a stub that exists for backwards compatibility
// for projects that referenced this target. As a target requires at least one
// for projects that referenced this target. As a target requires at least one
// source file to build, this file acts as that stub.
// source file to build, this file acts as that stub.
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