2015-06-27 01:42:50 +03:00
|
|
|
if(WIN32)
|
|
|
|
add_subdirectory(OSDependent/Windows)
|
|
|
|
elseif(UNIX)
|
2015-11-16 20:03:28 +03:00
|
|
|
add_subdirectory(OSDependent/Unix)
|
2015-06-27 01:42:50 +03:00
|
|
|
else(WIN32)
|
2016-03-07 01:37:56 +03:00
|
|
|
message("unknown platform")
|
2015-06-27 01:42:50 +03:00
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
set(SOURCES
|
|
|
|
MachineIndependent/glslang.y
|
2016-03-07 01:37:56 +03:00
|
|
|
MachineIndependent/glslang_tab.cpp
|
2018-01-30 21:01:39 +03:00
|
|
|
MachineIndependent/attribute.cpp
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/Constant.cpp
|
HLSL: Add location offsets per resource type
This PR adds the ability to offset sampler, texture, and UBO bindings
from provided base bindings, and to auto-number bindings that are not
provided with explicit register numbers. The mechanism works as
follows:
- Offsets may be given on the command line for all stages, or
individually for one or more single stages, in which case the
offset will be auto-selected according to the stage being
compiled. There is also an API to set them. The new command line
options are --shift-sampler-binding, --shift-texture-binding, and
--shift-UBO-binding.
- Uniforms which are not given explicit bindings in the source code
are auto-numbered if and only if they are in live code as
determined by the algorithm used to build the reflection
database, and the --auto-map-bindings option is given. This auto-numbering
avoids using any binding slots which were explicitly provided in
the code, whether or not that explicit use was live. E.g, "uniform
Texture1D foo : register(t3);" with --shift-texture-binding 10 will
reserve binding 13, whether or not foo is used in live code.
- Shorter synonyms for the command line options are available. See
the --help output.
The testing infrastructure is slightly extended to allow use of the
binding offset API, and two new tests spv.register.(no)autoassign.frag are
added for comparing the resulting SPIR-V.
2016-09-08 00:20:19 +03:00
|
|
|
MachineIndependent/iomapper.cpp
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/InfoSink.cpp
|
|
|
|
MachineIndependent/Initialize.cpp
|
|
|
|
MachineIndependent/IntermTraverse.cpp
|
|
|
|
MachineIndependent/Intermediate.cpp
|
2016-08-24 03:20:19 +03:00
|
|
|
MachineIndependent/ParseContextBase.cpp
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/ParseHelper.cpp
|
|
|
|
MachineIndependent/PoolAlloc.cpp
|
|
|
|
MachineIndependent/RemoveTree.cpp
|
|
|
|
MachineIndependent/Scan.cpp
|
|
|
|
MachineIndependent/ShaderLang.cpp
|
|
|
|
MachineIndependent/SymbolTable.cpp
|
|
|
|
MachineIndependent/Versions.cpp
|
|
|
|
MachineIndependent/intermOut.cpp
|
|
|
|
MachineIndependent/limits.cpp
|
|
|
|
MachineIndependent/linkValidate.cpp
|
|
|
|
MachineIndependent/parseConst.cpp
|
|
|
|
MachineIndependent/reflection.cpp
|
|
|
|
MachineIndependent/preprocessor/Pp.cpp
|
|
|
|
MachineIndependent/preprocessor/PpAtom.cpp
|
|
|
|
MachineIndependent/preprocessor/PpContext.cpp
|
|
|
|
MachineIndependent/preprocessor/PpScanner.cpp
|
|
|
|
MachineIndependent/preprocessor/PpTokens.cpp
|
Precise and noContraction propagation
Reimplement the whole workflow to make that: precise'ness of struct
members won't spread to other non-precise members of the same struct
instance.
Approach:
1. Build the map from symbols to their defining nodes. And for each
object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
accesschain path. Different AST nodes that indicating a same object
should have the same accesschain path.
2. Along the building phase in step 1, collect the initial set of
'precise' (AST qualifier: 'noContraction') objects' accesschain paths.
3. Start with the initial set of 'precise' accesschain paths, use it as
a worklist, do as the following steps until the worklist is empty:
1) Pop an accesschain path from worklist.
2) Get the symbol part from the accesschain path.
3) Find the defining nodes of that symbol.
4) For each defining node, check whether it is defining a 'precise'
object, or its assignee has nested 'precise' object. Get the
incremental path from assignee to its nested 'precise' object (if
any).
5) Traverse the right side of the defining node, obtain the
accesschain paths of the corresponding involved 'precise' objects.
Update the worklist with those new objects' accesschain paths.
Label involved operations with 'noContraction'.
In each step, whenever we find the parent object of an nested object is
'precise' (has 'noContraction' qualifier), we let the nested object
inherit the 'precise'ness from its parent object.
2016-05-05 00:34:38 +03:00
|
|
|
MachineIndependent/propagateNoContraction.cpp
|
2015-06-27 01:42:50 +03:00
|
|
|
GenericCodeGen/CodeGen.cpp
|
|
|
|
GenericCodeGen/Link.cpp)
|
|
|
|
|
|
|
|
set(HEADERS
|
|
|
|
Public/ShaderLang.h
|
2015-07-07 09:53:26 +03:00
|
|
|
Include/arrays.h
|
2015-06-27 01:42:50 +03:00
|
|
|
Include/BaseTypes.h
|
|
|
|
Include/Common.h
|
|
|
|
Include/ConstantUnion.h
|
|
|
|
Include/InfoSink.h
|
|
|
|
Include/InitializeGlobals.h
|
|
|
|
Include/intermediate.h
|
|
|
|
Include/PoolAlloc.h
|
|
|
|
Include/ResourceLimits.h
|
|
|
|
Include/revision.h
|
|
|
|
Include/ShHandle.h
|
|
|
|
Include/Types.h
|
2018-01-30 21:01:39 +03:00
|
|
|
MachineIndependent/attribute.h
|
2016-03-07 01:37:56 +03:00
|
|
|
MachineIndependent/glslang_tab.cpp.h
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/gl_types.h
|
|
|
|
MachineIndependent/Initialize.h
|
HLSL: Add location offsets per resource type
This PR adds the ability to offset sampler, texture, and UBO bindings
from provided base bindings, and to auto-number bindings that are not
provided with explicit register numbers. The mechanism works as
follows:
- Offsets may be given on the command line for all stages, or
individually for one or more single stages, in which case the
offset will be auto-selected according to the stage being
compiled. There is also an API to set them. The new command line
options are --shift-sampler-binding, --shift-texture-binding, and
--shift-UBO-binding.
- Uniforms which are not given explicit bindings in the source code
are auto-numbered if and only if they are in live code as
determined by the algorithm used to build the reflection
database, and the --auto-map-bindings option is given. This auto-numbering
avoids using any binding slots which were explicitly provided in
the code, whether or not that explicit use was live. E.g, "uniform
Texture1D foo : register(t3);" with --shift-texture-binding 10 will
reserve binding 13, whether or not foo is used in live code.
- Shorter synonyms for the command line options are available. See
the --help output.
The testing infrastructure is slightly extended to allow use of the
binding offset API, and two new tests spv.register.(no)autoassign.frag are
added for comparing the resulting SPIR-V.
2016-09-08 00:20:19 +03:00
|
|
|
MachineIndependent/iomapper.h
|
2016-09-20 00:35:12 +03:00
|
|
|
MachineIndependent/LiveTraverser.h
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/localintermediate.h
|
|
|
|
MachineIndependent/ParseHelper.h
|
|
|
|
MachineIndependent/reflection.h
|
|
|
|
MachineIndependent/RemoveTree.h
|
|
|
|
MachineIndependent/Scan.h
|
|
|
|
MachineIndependent/ScanContext.h
|
|
|
|
MachineIndependent/SymbolTable.h
|
|
|
|
MachineIndependent/Versions.h
|
2016-03-13 05:08:55 +03:00
|
|
|
MachineIndependent/parseVersions.h
|
Precise and noContraction propagation
Reimplement the whole workflow to make that: precise'ness of struct
members won't spread to other non-precise members of the same struct
instance.
Approach:
1. Build the map from symbols to their defining nodes. And for each
object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
accesschain path. Different AST nodes that indicating a same object
should have the same accesschain path.
2. Along the building phase in step 1, collect the initial set of
'precise' (AST qualifier: 'noContraction') objects' accesschain paths.
3. Start with the initial set of 'precise' accesschain paths, use it as
a worklist, do as the following steps until the worklist is empty:
1) Pop an accesschain path from worklist.
2) Get the symbol part from the accesschain path.
3) Find the defining nodes of that symbol.
4) For each defining node, check whether it is defining a 'precise'
object, or its assignee has nested 'precise' object. Get the
incremental path from assignee to its nested 'precise' object (if
any).
5) Traverse the right side of the defining node, obtain the
accesschain paths of the corresponding involved 'precise' objects.
Update the worklist with those new objects' accesschain paths.
Label involved operations with 'noContraction'.
In each step, whenever we find the parent object of an nested object is
'precise' (has 'noContraction' qualifier), we let the nested object
inherit the 'precise'ness from its parent object.
2016-05-05 00:34:38 +03:00
|
|
|
MachineIndependent/propagateNoContraction.h
|
2015-06-27 01:42:50 +03:00
|
|
|
MachineIndependent/preprocessor/PpContext.h
|
|
|
|
MachineIndependent/preprocessor/PpTokens.h)
|
|
|
|
|
2016-03-07 01:37:56 +03:00
|
|
|
# This might be useful for making grammar changes:
|
|
|
|
#
|
|
|
|
# find_package(BISON)
|
|
|
|
# add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h
|
|
|
|
# COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h -t ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang.y -o ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp
|
|
|
|
# MAIN_DEPENDENCY MachineIndependent/glslang.y
|
|
|
|
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp)
|
2015-06-27 01:42:50 +03:00
|
|
|
|
2018-11-07 18:35:20 +03:00
|
|
|
glslang_pch(SOURCES MachineIndependent/pch.cpp)
|
2018-10-31 23:38:08 +03:00
|
|
|
|
2018-03-30 17:32:03 +03:00
|
|
|
add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
|
2017-07-04 17:53:45 +03:00
|
|
|
set_property(TARGET glslang PROPERTY FOLDER glslang)
|
|
|
|
set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON)
|
2017-01-21 21:59:15 +03:00
|
|
|
target_link_libraries(glslang OGLCompiler OSDependent)
|
2017-05-03 02:16:06 +03:00
|
|
|
target_include_directories(glslang PUBLIC ..)
|
2018-03-30 17:32:03 +03:00
|
|
|
|
|
|
|
if(WIN32 AND BUILD_SHARED_LIBS)
|
|
|
|
set_target_properties(glslang PROPERTIES PREFIX "")
|
|
|
|
endif()
|
|
|
|
|
2017-01-21 21:59:15 +03:00
|
|
|
if(ENABLE_HLSL)
|
2017-04-29 11:57:36 +03:00
|
|
|
target_link_libraries(glslang HLSL)
|
2017-01-21 21:59:15 +03:00
|
|
|
endif()
|
2015-06-27 01:42:50 +03:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
source_group("Public" REGULAR_EXPRESSION "Public/*")
|
|
|
|
source_group("MachineIndependent" REGULAR_EXPRESSION "MachineIndependent/[^/]*")
|
|
|
|
source_group("Include" REGULAR_EXPRESSION "Include/[^/]*")
|
|
|
|
source_group("GenericCodeGen" REGULAR_EXPRESSION "GenericCodeGen/*")
|
|
|
|
source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*")
|
|
|
|
endif(WIN32)
|
|
|
|
|
2017-07-04 15:57:08 +03:00
|
|
|
if(ENABLE_GLSLANG_INSTALL)
|
2018-04-26 17:04:25 +03:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
install(TARGETS glslang
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
else()
|
|
|
|
install(TARGETS glslang
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
endif()
|
2017-07-04 15:57:08 +03:00
|
|
|
endif(ENABLE_GLSLANG_INSTALL)
|
2017-01-30 04:45:12 +03:00
|
|
|
|
2017-07-04 15:57:08 +03:00
|
|
|
if(ENABLE_GLSLANG_INSTALL)
|
|
|
|
foreach(file ${HEADERS})
|
|
|
|
get_filename_component(dir ${file} DIRECTORY)
|
|
|
|
install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
|
|
|
|
endforeach()
|
|
|
|
endif(ENABLE_GLSLANG_INSTALL)
|