Updated glslang.

This commit is contained in:
Branimir Karadžić 2017-05-06 00:12:46 -07:00
parent 5cf382eac5
commit be1d487034
36 changed files with 794 additions and 316 deletions

View File

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 2.8.11)
# increase to 3.1 once all major distributions
# include a version of CMake >= 3.1
cmake_minimum_required(VERSION 2.8.12)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Adhere to GNU filesystem layout conventions
include(GNUInstallDirs)
option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON)
option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
@ -8,11 +13,13 @@ option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
option(ENABLE_HLSL "Enables HLSL input support" ON)
enable_testing()
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
endif()
project(glslang)
# make testing optional
include(CTest)
if(ENABLE_AMD_EXTENSIONS)
add_definitions(-DAMD_EXTENSIONS)
@ -33,33 +40,39 @@ if(WIN32)
endif(MSVC)
add_definitions(-DGLSLANG_OSINCLUDE_WIN32)
elseif(UNIX)
add_definitions(-fPIC)
add_definitions(-DGLSLANG_OSINCLUDE_UNIX)
else(WIN32)
message("unknown platform")
endif(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable)
add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_definitions(-std=c++11)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_definitions(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_definitions(-std=c++11)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
endif()
# Request C++11
if(${CMAKE_VERSION} VERSION_LESS 3.1)
# CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD
# remove this block once CMake >=3.1 has fixated in the ecosystem
add_compile_options(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
function(glslang_set_link_args TARGET)
# For MinGW compiles, statically link against the GCC and C++ runtimes.
# This avoids the need to ship those runtimes as DLLs.
if(WIN32)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "-static -static-libgcc -static-libstdc++")
endif()
endif(WIN32)
if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "-static -static-libgcc -static-libstdc++")
endif()
endfunction(glslang_set_link_args)
# We depend on these for later projects, so they should come first.
@ -68,7 +81,7 @@ add_subdirectory(External)
add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL)
if(ENABLE_GLSLANG_BINARIES)
add_subdirectory(StandAlone)
add_subdirectory(StandAlone)
endif()
add_subdirectory(SPIRV)
if(ENABLE_HLSL)

View File

@ -1,34 +1,35 @@
# Suppress all warnings from external projects.
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w)
if (TARGET gmock)
message(STATUS "Google Mock already configured - use it")
elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
# We need to make sure Google Test does not mess up with the
# global CRT settings on Windows.
if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif(WIN32)
add_subdirectory(googletest)
set(GTEST_TARGETS
gtest
gtest_main
gmock
gmock_main
)
foreach(target ${GTEST_TARGETS})
set_property(TARGET ${target} PROPERTY FOLDER gtest)
endforeach()
mark_as_advanced(gmock_build_tests
BUILD_GMOCK
BUILD_GTEST
BUILD_SHARED_LIBS
gtest_build_samples
gtest_build_tests
gtest_disable_pthreads
gtest_force_shared_crt
gtest_hide_internal_symbols)
else()
message(STATUS
"Google Mock was not found - tests based on that will not build")
if(BUILD_TESTING)
if(TARGET gmock)
message(STATUS "Google Mock already configured - use it")
elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
# We need to make sure Google Test does not mess up with the
# global CRT settings on Windows.
if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif(WIN32)
add_subdirectory(googletest)
set(GTEST_TARGETS
gtest
gtest_main
gmock
gmock_main)
foreach(target ${GTEST_TARGETS})
set_property(TARGET ${target} PROPERTY FOLDER gtest)
endforeach()
mark_as_advanced(gmock_build_tests
BUILD_GMOCK
BUILD_GTEST
BUILD_SHARED_LIBS
gtest_build_samples
gtest_build_tests
gtest_disable_pthreads
gtest_force_shared_crt
gtest_hide_internal_symbols)
else()
message(STATUS
"Google Mock was not found - tests based on that will not build")
endif()
endif()

View File

@ -1,11 +1,11 @@
set(SOURCES InitializeDll.cpp InitializeDll.h)
add_library(OGLCompiler STATIC ${SOURCES})
set_property(TARGET OGLCompiler PROPERTY FOLDER glslang)
set_property(TARGET OGLCompiler PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
if(WIN32)
source_group("Source" FILES ${SOURCES})
endif(WIN32)
install(TARGETS OGLCompiler
ARCHIVE DESTINATION lib)
install(TARGETS OGLCompiler
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -40,11 +40,11 @@ if(ENABLE_NV_EXTENSIONS)
endif(ENABLE_NV_EXTENSIONS)
add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
set_property(TARGET SPIRV PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
target_link_libraries(SPIRV glslang)
add_library(SPVRemapper STATIC ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
if(WIN32)
source_group("Source" FILES ${SOURCES} ${HEADERS})
@ -52,6 +52,6 @@ if(WIN32)
endif(WIN32)
install(TARGETS SPIRV SPVRemapper
ARCHIVE DESTINATION lib)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION include/SPIRV/)
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)

View File

@ -34,11 +34,12 @@ enum Capability;
static const int GLSLextKHRVersion = 100;
static const int GLSLextKHRRevision = 1;
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group";
static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview";
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group";
static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview";
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class";
#endif // #ifndef GLSLextKHR_H

View File

@ -122,6 +122,8 @@ protected:
spv::Decoration TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier);
spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool memberDeclaration);
spv::ImageFormat TranslateImageFormat(const glslang::TType& type);
spv::LoopControlMask TranslateLoopControl(glslang::TLoopControl) const;
spv::StorageClass TranslateStorageClass(const glslang::TType&);
spv::Id createSpvVariable(const glslang::TIntermSymbol*);
spv::Id getSampledType(const glslang::TSampler&);
spv::Id getInvertedSwizzleType(const glslang::TIntermTyped&);
@ -244,39 +246,6 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage)
}
}
// Translate glslang type to SPIR-V storage class.
spv::StorageClass TranslateStorageClass(const glslang::TType& type, bool useStorageBuffer)
{
if (type.getQualifier().isPipeInput())
return spv::StorageClassInput;
else if (type.getQualifier().isPipeOutput())
return spv::StorageClassOutput;
else if (type.getBasicType() == glslang::EbtAtomicUint)
return spv::StorageClassAtomicCounter;
else if (type.containsOpaque())
return spv::StorageClassUniformConstant;
else if (useStorageBuffer && type.getQualifier().storage == glslang::EvqBuffer)
return spv::StorageClassStorageBuffer;
else if (type.getQualifier().isUniformOrBuffer()) {
if (type.getQualifier().layoutPushConstant)
return spv::StorageClassPushConstant;
if (type.getBasicType() == glslang::EbtBlock)
return spv::StorageClassUniform;
else
return spv::StorageClassUniformConstant;
} else {
switch (type.getQualifier().storage) {
case glslang::EvqShared: return spv::StorageClassWorkgroup; break;
case glslang::EvqGlobal: return spv::StorageClassPrivate;
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
case glslang::EvqTemporary: return spv::StorageClassFunction;
default:
assert(0);
return spv::StorageClassFunction;
}
}
}
// Translate glslang sampler type to SPIR-V dimensionality.
spv::Dim TranslateDimensionality(const glslang::TSampler& sampler)
{
@ -767,6 +736,52 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy
}
}
spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(glslang::TLoopControl loopControl) const
{
switch (loopControl) {
case glslang::ELoopControlNone: return spv::LoopControlMaskNone;
case glslang::ELoopControlUnroll: return spv::LoopControlUnrollMask;
case glslang::ELoopControlDontUnroll: return spv::LoopControlDontUnrollMask;
// TODO: DependencyInfinite
// TODO: DependencyLength
default: return spv::LoopControlMaskNone;
}
}
// Translate glslang type to SPIR-V storage class.
spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::TType& type)
{
if (type.getQualifier().isPipeInput())
return spv::StorageClassInput;
else if (type.getQualifier().isPipeOutput())
return spv::StorageClassOutput;
else if (type.getBasicType() == glslang::EbtAtomicUint)
return spv::StorageClassAtomicCounter;
else if (type.containsOpaque())
return spv::StorageClassUniformConstant;
else if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) {
builder.addExtension(spv::E_SPV_KHR_storage_buffer_storage_class);
return spv::StorageClassStorageBuffer;
} else if (type.getQualifier().isUniformOrBuffer()) {
if (type.getQualifier().layoutPushConstant)
return spv::StorageClassPushConstant;
if (type.getBasicType() == glslang::EbtBlock)
return spv::StorageClassUniform;
else
return spv::StorageClassUniformConstant;
} else {
switch (type.getQualifier().storage) {
case glslang::EvqShared: return spv::StorageClassWorkgroup; break;
case glslang::EvqGlobal: return spv::StorageClassPrivate;
case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
case glslang::EvqTemporary: return spv::StorageClassFunction;
default:
assert(0);
return spv::StorageClassFunction;
}
}
}
// Return whether or not the given type is something that should be tied to a
// descriptor set.
bool IsDescriptorResource(const glslang::TType& type)
@ -1960,6 +1975,12 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
{
auto blocks = builder.makeNewLoop();
builder.createBranch(&blocks.head);
// Loop control:
const spv::LoopControlMask control = TranslateLoopControl(node->getLoopControl());
// TODO: dependency length
// Spec requires back edges to target header blocks, and every header block
// must dominate its merge block. Make a header block first to ensure these
// conditions are met. By definition, it will contain OpLoopMerge, followed
@ -1967,7 +1988,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
// instructions in it, since the body/test may have arbitrary instructions,
// including merges of its own.
builder.setBuildPoint(&blocks.head);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control);
if (node->testFirst() && node->getTest()) {
spv::Block& test = builder.makeNewBlock();
builder.createBranch(&test);
@ -2073,7 +2094,7 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
}
// Now, handle actual variables
spv::StorageClass storageClass = TranslateStorageClass(node->getType(), glslangIntermediate->usingStorageBuffer());
spv::StorageClass storageClass = TranslateStorageClass(node->getType());
spv::Id spvType = convertGlslangToSpvType(node->getType());
#ifdef AMD_EXTENSIONS
@ -2836,7 +2857,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
(paramType.getBasicType() == glslang::EbtBlock &&
paramType.getQualifier().storage == glslang::EvqBuffer) || // SSBO
(p == 0 && implicitThis)) // implicit 'this'
typeId = builder.makePointer(TranslateStorageClass(paramType, glslangIntermediate->usingStorageBuffer()), typeId);
typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
typeId = builder.makePointer(spv::StorageClassFunction, typeId);
else

View File

@ -1,12 +1,10 @@
add_library(glslang-default-resource-limits
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
target_include_directories(glslang-default-resource-limits
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${PROJECT_SOURCE_DIR}
)
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${PROJECT_SOURCE_DIR})
set(SOURCES StandAlone.cpp)
set(REMAPPER_SOURCES spirv-remap.cpp)
@ -41,7 +39,7 @@ if(WIN32)
endif(WIN32)
install(TARGETS glslangValidator
RUNTIME DESTINATION bin)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS spirv-remap
RUNTIME DESTINATION bin)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -132,7 +132,7 @@ local_size = (4, 6, 8)
Store 13(x) 14
Branch 15
15: Label
LoopMerge 17 18 None
LoopMerge 17 18 Unroll
Branch 19
19: Label
20: 11(int) Load 13(x)

View File

@ -194,7 +194,7 @@ gl_FragCoord origin is upper left
12: Label
Branch 13
13: Label
LoopMerge 15 16 None
LoopMerge 15 16 Unroll
Branch 14
14: Label
Branch 16
@ -203,7 +203,7 @@ gl_FragCoord origin is upper left
15: Label
Branch 19
19: Label
LoopMerge 21 22 None
LoopMerge 21 22 Unroll
Branch 20
20: Label
Branch 22

View File

@ -338,7 +338,7 @@ gl_FragCoord origin is upper left
23: Label
Branch 25
25: Label
LoopMerge 27 28 None
LoopMerge 27 28 Unroll
Branch 29
29: Label
30: 7(fvec4) Load 10(input)

View File

@ -119,25 +119,73 @@ gl_FragCoord origin is upper left
0:51 1 (const int)
0:51 1 (const int)
0:51 1 (const int)
0:114 move second child to first child ( temp 4-component vector of float)
0:114 Color: direct index for structure ( temp 4-component vector of float)
0:114 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:114 Constant:
0:114 0 (const int)
0:114 Constant:
0:114 1.000000
0:114 1.000000
0:114 1.000000
0:114 1.000000
0:115 move second child to first child ( temp float)
0:115 Depth: direct index for structure ( temp float)
0:115 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:115 Constant:
0:115 1 (const int)
0:115 Constant:
0:115 1.000000
0:117 Branch: Return with expression
0:117 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:53 Sequence
0:53 move second child to first child ( temp 4-component vector of float)
0:53 'txval401' ( temp 4-component vector of float)
0:53 textureGatherOffset ( temp 4-component vector of float)
0:53 Construct combined texture-sampler ( temp sampler2DShadow)
0:53 'g_tTex2df4' ( uniform texture2D)
0:53 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:53 c2: direct index for structure ( uniform 2-component vector of float)
0:53 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:53 Constant:
0:53 1 (const uint)
0:53 Constant:
0:53 0.750000
0:? Constant:
0:? 1 (const int)
0:? 0 (const int)
0:54 Sequence
0:54 move second child to first child ( temp 4-component vector of int)
0:54 'txval411' ( temp 4-component vector of int)
0:54 textureGatherOffset ( temp 4-component vector of int)
0:54 Construct combined texture-sampler ( temp isampler2DShadow)
0:54 'g_tTex2di4' ( uniform itexture2D)
0:54 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:54 c2: direct index for structure ( uniform 2-component vector of float)
0:54 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:54 Constant:
0:54 1 (const uint)
0:54 Constant:
0:54 0.750000
0:? Constant:
0:? 1 (const int)
0:? -1 (const int)
0:55 Sequence
0:55 move second child to first child ( temp 4-component vector of uint)
0:55 'txval421' ( temp 4-component vector of uint)
0:55 textureGatherOffset ( temp 4-component vector of uint)
0:55 Construct combined texture-sampler ( temp usampler2DShadow)
0:55 'g_tTex2du4' ( uniform utexture2D)
0:55 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:55 c2: direct index for structure ( uniform 2-component vector of float)
0:55 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:55 Constant:
0:55 1 (const uint)
0:55 Constant:
0:55 0.750000
0:? Constant:
0:? 1 (const int)
0:? 1 (const int)
0:110 move second child to first child ( temp 4-component vector of float)
0:110 Color: direct index for structure ( temp 4-component vector of float)
0:110 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:110 Constant:
0:110 0 (const int)
0:110 Constant:
0:110 1.000000
0:110 1.000000
0:110 1.000000
0:110 1.000000
0:111 move second child to first child ( temp float)
0:111 Depth: direct index for structure ( temp float)
0:111 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:111 Constant:
0:111 1 (const int)
0:111 Constant:
0:111 1.000000
0:113 Branch: Return with expression
0:113 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:38 Function Definition: main( ( temp void)
0:38 Function Parameters:
0:? Sequence
@ -300,25 +348,73 @@ gl_FragCoord origin is upper left
0:51 1 (const int)
0:51 1 (const int)
0:51 1 (const int)
0:114 move second child to first child ( temp 4-component vector of float)
0:114 Color: direct index for structure ( temp 4-component vector of float)
0:114 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:114 Constant:
0:114 0 (const int)
0:114 Constant:
0:114 1.000000
0:114 1.000000
0:114 1.000000
0:114 1.000000
0:115 move second child to first child ( temp float)
0:115 Depth: direct index for structure ( temp float)
0:115 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:115 Constant:
0:115 1 (const int)
0:115 Constant:
0:115 1.000000
0:117 Branch: Return with expression
0:117 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:53 Sequence
0:53 move second child to first child ( temp 4-component vector of float)
0:53 'txval401' ( temp 4-component vector of float)
0:53 textureGatherOffset ( temp 4-component vector of float)
0:53 Construct combined texture-sampler ( temp sampler2DShadow)
0:53 'g_tTex2df4' ( uniform texture2D)
0:53 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:53 c2: direct index for structure ( uniform 2-component vector of float)
0:53 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:53 Constant:
0:53 1 (const uint)
0:53 Constant:
0:53 0.750000
0:? Constant:
0:? 1 (const int)
0:? 0 (const int)
0:54 Sequence
0:54 move second child to first child ( temp 4-component vector of int)
0:54 'txval411' ( temp 4-component vector of int)
0:54 textureGatherOffset ( temp 4-component vector of int)
0:54 Construct combined texture-sampler ( temp isampler2DShadow)
0:54 'g_tTex2di4' ( uniform itexture2D)
0:54 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:54 c2: direct index for structure ( uniform 2-component vector of float)
0:54 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:54 Constant:
0:54 1 (const uint)
0:54 Constant:
0:54 0.750000
0:? Constant:
0:? 1 (const int)
0:? -1 (const int)
0:55 Sequence
0:55 move second child to first child ( temp 4-component vector of uint)
0:55 'txval421' ( temp 4-component vector of uint)
0:55 textureGatherOffset ( temp 4-component vector of uint)
0:55 Construct combined texture-sampler ( temp usampler2DShadow)
0:55 'g_tTex2du4' ( uniform utexture2D)
0:55 'g_sSampCmp' (layout( binding=0) uniform sampler)
0:55 c2: direct index for structure ( uniform 2-component vector of float)
0:55 'anon@0' (layout( row_major std140) uniform block{ uniform float c1, uniform 2-component vector of float c2, uniform 3-component vector of float c3, uniform 4-component vector of float c4})
0:55 Constant:
0:55 1 (const uint)
0:55 Constant:
0:55 0.750000
0:? Constant:
0:? 1 (const int)
0:? 1 (const int)
0:110 move second child to first child ( temp 4-component vector of float)
0:110 Color: direct index for structure ( temp 4-component vector of float)
0:110 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:110 Constant:
0:110 0 (const int)
0:110 Constant:
0:110 1.000000
0:110 1.000000
0:110 1.000000
0:110 1.000000
0:111 move second child to first child ( temp float)
0:111 Depth: direct index for structure ( temp float)
0:111 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:111 Constant:
0:111 1 (const int)
0:111 Constant:
0:111 1.000000
0:113 Branch: Return with expression
0:113 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth})
0:38 Function Definition: main( ( temp void)
0:38 Function Parameters:
0:? Sequence
@ -359,13 +455,13 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 146
// Id's are bound by 167
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 111 115
EntryPoint Fragment 4 "main" 132 136
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@ -389,20 +485,23 @@ gl_FragCoord origin is upper left
Name 72 "txval004"
Name 82 "txval014"
Name 90 "txval024"
Name 99 "psout"
Name 108 "flattenTemp"
Name 111 "Color"
Name 115 "Depth"
Name 120 "g_tTex1df4a"
Name 121 "g_tTex1df4"
Name 124 "g_tTex1di4"
Name 127 "g_tTex1du4"
Name 130 "g_tTex3df4"
Name 133 "g_tTex3di4"
Name 136 "g_tTex3du4"
Name 139 "g_tTexcdf4"
Name 142 "g_tTexcdi4"
Name 145 "g_tTexcdu4"
Name 98 "txval401"
Name 105 "txval411"
Name 112 "txval421"
Name 120 "psout"
Name 129 "flattenTemp"
Name 132 "Color"
Name 136 "Depth"
Name 141 "g_tTex1df4a"
Name 142 "g_tTex1df4"
Name 145 "g_tTex1di4"
Name 148 "g_tTex1du4"
Name 151 "g_tTex3df4"
Name 154 "g_tTex3di4"
Name 157 "g_tTex3du4"
Name 160 "g_tTexcdf4"
Name 163 "g_tTexcdi4"
Name 166 "g_tTexcdu4"
Decorate 16(g_tTex2df4) DescriptorSet 0
Decorate 20(g_sSampCmp) DescriptorSet 0
Decorate 20(g_sSampCmp) Binding 0
@ -414,20 +513,20 @@ gl_FragCoord origin is upper left
Decorate 29 DescriptorSet 0
Decorate 45(g_tTex2di4) DescriptorSet 0
Decorate 62(g_tTex2du4) DescriptorSet 0
Decorate 111(Color) Location 0
Decorate 115(Depth) BuiltIn FragDepth
Decorate 120(g_tTex1df4a) DescriptorSet 0
Decorate 120(g_tTex1df4a) Binding 1
Decorate 121(g_tTex1df4) DescriptorSet 0
Decorate 121(g_tTex1df4) Binding 0
Decorate 124(g_tTex1di4) DescriptorSet 0
Decorate 127(g_tTex1du4) DescriptorSet 0
Decorate 130(g_tTex3df4) DescriptorSet 0
Decorate 133(g_tTex3di4) DescriptorSet 0
Decorate 136(g_tTex3du4) DescriptorSet 0
Decorate 139(g_tTexcdf4) DescriptorSet 0
Decorate 142(g_tTexcdi4) DescriptorSet 0
Decorate 145(g_tTexcdu4) DescriptorSet 0
Decorate 132(Color) Location 0
Decorate 136(Depth) BuiltIn FragDepth
Decorate 141(g_tTex1df4a) DescriptorSet 0
Decorate 141(g_tTex1df4a) Binding 1
Decorate 142(g_tTex1df4) DescriptorSet 0
Decorate 142(g_tTex1df4) Binding 0
Decorate 145(g_tTex1di4) DescriptorSet 0
Decorate 148(g_tTex1du4) DescriptorSet 0
Decorate 151(g_tTex3df4) DescriptorSet 0
Decorate 154(g_tTex3di4) DescriptorSet 0
Decorate 157(g_tTex3du4) DescriptorSet 0
Decorate 160(g_tTexcdf4) DescriptorSet 0
Decorate 163(g_tTexcdi4) DescriptorSet 0
Decorate 166(g_tTexcdu4) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -478,53 +577,53 @@ gl_FragCoord origin is upper left
80: 79 ConstantComposite 38 38 38 38
88: 79 ConstantComposite 54 54 54 54
96: 79 ConstantComposite 70 70 70 70
98: TypePointer Function 8(PS_OUTPUT)
100: 6(float) Constant 1065353216
101: 7(fvec4) ConstantComposite 100 100 100 100
103: TypePointer Function 6(float)
110: TypePointer Output 7(fvec4)
111(Color): 110(ptr) Variable Output
114: TypePointer Output 6(float)
115(Depth): 114(ptr) Variable Output
118: TypeImage 6(float) 1D sampled format:Unknown
119: TypePointer UniformConstant 118
120(g_tTex1df4a): 119(ptr) Variable UniformConstant
121(g_tTex1df4): 119(ptr) Variable UniformConstant
122: TypeImage 30(int) 1D sampled format:Unknown
123: TypePointer UniformConstant 122
124(g_tTex1di4): 123(ptr) Variable UniformConstant
125: TypeImage 56(int) 1D sampled format:Unknown
126: TypePointer UniformConstant 125
127(g_tTex1du4): 126(ptr) Variable UniformConstant
128: TypeImage 6(float) 3D sampled format:Unknown
129: TypePointer UniformConstant 128
130(g_tTex3df4): 129(ptr) Variable UniformConstant
131: TypeImage 30(int) 3D sampled format:Unknown
132: TypePointer UniformConstant 131
133(g_tTex3di4): 132(ptr) Variable UniformConstant
134: TypeImage 56(int) 3D sampled format:Unknown
135: TypePointer UniformConstant 134
136(g_tTex3du4): 135(ptr) Variable UniformConstant
137: TypeImage 6(float) Cube sampled format:Unknown
138: TypePointer UniformConstant 137
139(g_tTexcdf4): 138(ptr) Variable UniformConstant
140: TypeImage 30(int) Cube sampled format:Unknown
141: TypePointer UniformConstant 140
142(g_tTexcdi4): 141(ptr) Variable UniformConstant
143: TypeImage 56(int) Cube sampled format:Unknown
119: TypePointer Function 8(PS_OUTPUT)
121: 6(float) Constant 1065353216
122: 7(fvec4) ConstantComposite 121 121 121 121
124: TypePointer Function 6(float)
131: TypePointer Output 7(fvec4)
132(Color): 131(ptr) Variable Output
135: TypePointer Output 6(float)
136(Depth): 135(ptr) Variable Output
139: TypeImage 6(float) 1D sampled format:Unknown
140: TypePointer UniformConstant 139
141(g_tTex1df4a): 140(ptr) Variable UniformConstant
142(g_tTex1df4): 140(ptr) Variable UniformConstant
143: TypeImage 30(int) 1D sampled format:Unknown
144: TypePointer UniformConstant 143
145(g_tTexcdu4): 144(ptr) Variable UniformConstant
145(g_tTex1di4): 144(ptr) Variable UniformConstant
146: TypeImage 56(int) 1D sampled format:Unknown
147: TypePointer UniformConstant 146
148(g_tTex1du4): 147(ptr) Variable UniformConstant
149: TypeImage 6(float) 3D sampled format:Unknown
150: TypePointer UniformConstant 149
151(g_tTex3df4): 150(ptr) Variable UniformConstant
152: TypeImage 30(int) 3D sampled format:Unknown
153: TypePointer UniformConstant 152
154(g_tTex3di4): 153(ptr) Variable UniformConstant
155: TypeImage 56(int) 3D sampled format:Unknown
156: TypePointer UniformConstant 155
157(g_tTex3du4): 156(ptr) Variable UniformConstant
158: TypeImage 6(float) Cube sampled format:Unknown
159: TypePointer UniformConstant 158
160(g_tTexcdf4): 159(ptr) Variable UniformConstant
161: TypeImage 30(int) Cube sampled format:Unknown
162: TypePointer UniformConstant 161
163(g_tTexcdi4): 162(ptr) Variable UniformConstant
164: TypeImage 56(int) Cube sampled format:Unknown
165: TypePointer UniformConstant 164
166(g_tTexcdu4): 165(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
108(flattenTemp): 98(ptr) Variable Function
109:8(PS_OUTPUT) FunctionCall 10(@main()
Store 108(flattenTemp) 109
112: 12(ptr) AccessChain 108(flattenTemp) 37
113: 7(fvec4) Load 112
Store 111(Color) 113
116: 103(ptr) AccessChain 108(flattenTemp) 31
117: 6(float) Load 116
Store 115(Depth) 117
129(flattenTemp): 119(ptr) Variable Function
130:8(PS_OUTPUT) FunctionCall 10(@main()
Store 129(flattenTemp) 130
133: 12(ptr) AccessChain 129(flattenTemp) 37
134: 7(fvec4) Load 133
Store 132(Color) 134
137: 124(ptr) AccessChain 129(flattenTemp) 31
138: 6(float) Load 137
Store 136(Depth) 138
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
@ -535,7 +634,10 @@ gl_FragCoord origin is upper left
72(txval004): 12(ptr) Variable Function
82(txval014): 41(ptr) Variable Function
90(txval024): 58(ptr) Variable Function
99(psout): 98(ptr) Variable Function
98(txval401): 12(ptr) Variable Function
105(txval411): 41(ptr) Variable Function
112(txval421): 58(ptr) Variable Function
120(psout): 119(ptr) Variable Function
17: 14 Load 16(g_tTex2df4)
21: 18 Load 20(g_sSampCmp)
24: 23 SampledImage 17 21
@ -578,10 +680,31 @@ gl_FragCoord origin is upper left
95: 25(fvec2) Load 94
97: 57(ivec4) ImageDrefGather 93 95 35 ConstOffsets 96
Store 90(txval024) 97
102: 12(ptr) AccessChain 99(psout) 37
Store 102 101
104: 103(ptr) AccessChain 99(psout) 31
Store 104 100
105:8(PS_OUTPUT) Load 99(psout)
ReturnValue 105
99: 14 Load 16(g_tTex2df4)
100: 18 Load 20(g_sSampCmp)
101: 23 SampledImage 99 100
102: 32(ptr) AccessChain 29 31
103: 25(fvec2) Load 102
104: 7(fvec4) ImageDrefGather 101 103 35 ConstOffset 38
Store 98(txval401) 104
106: 43 Load 45(g_tTex2di4)
107: 18 Load 20(g_sSampCmp)
108: 49 SampledImage 106 107
109: 32(ptr) AccessChain 29 31
110: 25(fvec2) Load 109
111: 40(ivec4) ImageDrefGather 108 110 35 ConstOffset 54
Store 105(txval411) 111
113: 60 Load 62(g_tTex2du4)
114: 18 Load 20(g_sSampCmp)
115: 66 SampledImage 113 114
116: 32(ptr) AccessChain 29 31
117: 25(fvec2) Load 116
118: 57(ivec4) ImageDrefGather 115 117 35 ConstOffset 70
Store 112(txval421) 118
123: 12(ptr) AccessChain 120(psout) 37
Store 123 122
125: 124(ptr) AccessChain 120(psout) 31
Store 125 121
126:8(PS_OUTPUT) Load 120(psout)
ReturnValue 126
FunctionEnd

View File

@ -0,0 +1,233 @@
hlsl.loopattr.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: @main( ( temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child ( temp int)
0:5 'x' ( temp int)
0:5 Constant:
0:5 0 (const int)
0:5 Loop with condition tested first
0:5 Loop Condition
0:5 Compare Less Than ( temp bool)
0:5 'x' ( temp int)
0:5 Constant:
0:5 5 (const int)
0:5 No loop body
0:5 Loop Terminal Expression
0:5 Pre-Increment ( temp int)
0:5 'x' ( temp int)
0:8 Sequence
0:8 move second child to first child ( temp int)
0:8 'y' ( temp int)
0:8 Constant:
0:8 0 (const int)
0:8 Loop with condition tested first
0:8 Loop Condition
0:8 Compare Less Than ( temp bool)
0:8 'y' ( temp int)
0:8 Constant:
0:8 5 (const int)
0:8 No loop body
0:8 Loop Terminal Expression
0:8 Pre-Increment ( temp int)
0:8 'y' ( temp int)
0:11 Sequence
0:11 move second child to first child ( temp int)
0:11 'z' ( temp int)
0:11 Constant:
0:11 0 (const int)
0:11 Loop with condition tested first
0:11 Loop Condition
0:11 Compare Less Than ( temp bool)
0:11 'z' ( temp int)
0:11 Constant:
0:11 5 (const int)
0:11 No loop body
0:11 Loop Terminal Expression
0:11 Pre-Increment ( temp int)
0:11 'z' ( temp int)
0:13 Branch: Return with expression
0:13 Constant:
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:3 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: @main( ( temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child ( temp int)
0:5 'x' ( temp int)
0:5 Constant:
0:5 0 (const int)
0:5 Loop with condition tested first
0:5 Loop Condition
0:5 Compare Less Than ( temp bool)
0:5 'x' ( temp int)
0:5 Constant:
0:5 5 (const int)
0:5 No loop body
0:5 Loop Terminal Expression
0:5 Pre-Increment ( temp int)
0:5 'x' ( temp int)
0:8 Sequence
0:8 move second child to first child ( temp int)
0:8 'y' ( temp int)
0:8 Constant:
0:8 0 (const int)
0:8 Loop with condition tested first
0:8 Loop Condition
0:8 Compare Less Than ( temp bool)
0:8 'y' ( temp int)
0:8 Constant:
0:8 5 (const int)
0:8 No loop body
0:8 Loop Terminal Expression
0:8 Pre-Increment ( temp int)
0:8 'y' ( temp int)
0:11 Sequence
0:11 move second child to first child ( temp int)
0:11 'z' ( temp int)
0:11 Constant:
0:11 0 (const int)
0:11 Loop with condition tested first
0:11 Loop Condition
0:11 Compare Less Than ( temp bool)
0:11 'z' ( temp int)
0:11 Constant:
0:11 5 (const int)
0:11 No loop body
0:11 Loop Terminal Expression
0:11 Pre-Increment ( temp int)
0:11 'z' ( temp int)
0:13 Branch: Return with expression
0:13 Constant:
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:13 0.000000
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:3 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 54
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 52
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 13 "x"
Name 27 "y"
Name 37 "z"
Name 52 "@entryPointOutput"
Decorate 52(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypeInt 32 1
12: TypePointer Function 11(int)
14: 11(int) Constant 0
21: 11(int) Constant 5
22: TypeBool
25: 11(int) Constant 1
47: 6(float) Constant 0
48: 7(fvec4) ConstantComposite 47 47 47 47
51: TypePointer Output 7(fvec4)
52(@entryPointOutput): 51(ptr) Variable Output
4(main): 2 Function None 3
5: Label
53: 7(fvec4) FunctionCall 9(@main()
Store 52(@entryPointOutput) 53
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
13(x): 12(ptr) Variable Function
27(y): 12(ptr) Variable Function
37(z): 12(ptr) Variable Function
Store 13(x) 14
Branch 15
15: Label
LoopMerge 17 18 Unroll
Branch 19
19: Label
20: 11(int) Load 13(x)
23: 22(bool) SLessThan 20 21
BranchConditional 23 16 17
16: Label
Branch 18
18: Label
24: 11(int) Load 13(x)
26: 11(int) IAdd 24 25
Store 13(x) 26
Branch 15
17: Label
Store 27(y) 14
Branch 28
28: Label
LoopMerge 30 31 DontUnroll
Branch 32
32: Label
33: 11(int) Load 27(y)
34: 22(bool) SLessThan 33 21
BranchConditional 34 29 30
29: Label
Branch 31
31: Label
35: 11(int) Load 27(y)
36: 11(int) IAdd 35 25
Store 27(y) 36
Branch 28
30: Label
Store 37(z) 14
Branch 38
38: Label
LoopMerge 40 41 None
Branch 42
42: Label
43: 11(int) Load 37(z)
44: 22(bool) SLessThan 43 21
BranchConditional 44 39 40
39: Label
Branch 41
41: Label
45: 11(int) Load 37(z)
46: 11(int) IAdd 45 25
Store 37(z) 46
Branch 38
40: Label
ReturnValue 48
FunctionEnd

View File

@ -171,7 +171,7 @@ gl_FragCoord origin is upper left
28: Label
Branch 32
32: Label
LoopMerge 34 35 None
LoopMerge 34 35 Unroll
Branch 36
36: Label
BranchConditional 31 33 34

View File

@ -6,6 +6,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Id's are bound by 31
Capability Shader
Extension "SPV_KHR_storage_buffer_storage_class"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 13

View File

@ -29,6 +29,10 @@ PS_OUTPUT main()
// no 1D gathers
float4 txval80 = g_tTex2df4a . GatherCmp(g_sSampCmp, c3, .75);
int4 txval81 = g_tTex2di4a . GatherCmp(g_sSampCmp, c3, .75);
uint4 txval82 = g_tTex2du4a . GatherCmp(g_sSampCmp, c3, .75);
float4 txval00 = g_tTex2df4a . GatherCmpRed(g_sSampCmp, c3, .75);
int4 txval01 = g_tTex2di4a . GatherCmpRed(g_sSampCmp, c3, .75);
uint4 txval02 = g_tTex2du4a . GatherCmpRed(g_sSampCmp, c3, .75);

View File

@ -51,6 +51,10 @@ PS_OUTPUT main()
int4 txval31 = g_tTex2di4 . GatherCmpAlpha(g_sSampCmp, c2, 0.75);
uint4 txval32 = g_tTex2du4 . GatherCmpAlpha(g_sSampCmp, c2, 0.75);
float4 txval80 = g_tTex2df4 . GatherCmp(g_sSampCmp, c2, 0.75);
int4 txval81 = g_tTex2di4 . GatherCmp(g_sSampCmp, c2, 0.75);
uint4 txval82 = g_tTex2du4 . GatherCmp(g_sSampCmp, c2, 0.75);
// no 3D gathers
float4 txval40 = g_tTexcdf4 . GatherCmpRed(g_sSampCmp, c3, 0.75);
@ -69,6 +73,10 @@ PS_OUTPUT main()
int4 txval71 = g_tTexcdi4 . GatherCmpAlpha(g_sSampCmp, c3, 0.75);
uint4 txval72 = g_tTexcdu4 . GatherCmpAlpha(g_sSampCmp, c3, 0.75);
float4 txval90 = g_tTexcdf4 . GatherCmp(g_sSampCmp, c3, 0.75);
int4 txval91 = g_tTexcdi4 . GatherCmp(g_sSampCmp, c3, 0.75);
uint4 txval92 = g_tTexcdu4 . GatherCmp(g_sSampCmp, c3, 0.75);
psout.Color = 1.0;
psout.Depth = 1.0;

View File

@ -50,13 +50,9 @@ PS_OUTPUT main()
int4 txval014 = g_tTex2di4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,-1), int2(1,-1), int2(1,-1), int2(1,-1));
uint4 txval024 = g_tTex2du4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,1), int2(1,1), int2(1,1), int2(1,1));
// float4 txval00s = g_tTex2df4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), status);
// int4 txval01s = g_tTex2di4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), status);
// uint4 txval02s = g_tTex2du4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), status);
// float4 txval004s = g_tTex2df4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), int2(1,0), int2(1,0), int2(1,0), status);
// int4 txval014s = g_tTex2di4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), int2(1,0), int2(1,0), int2(1,0), status);
// uint4 txval024s = g_tTex2du4 . GatherCmpRed(g_sSampCmp, c2, 0.75, int2(1,0), int2(1,0), int2(1,0), int2(1,0), status);
float4 txval401 = g_tTex2df4 . GatherCmp(g_sSampCmp, c2, 0.75, int2(1,0));
int4 txval411 = g_tTex2di4 . GatherCmp(g_sSampCmp, c2, 0.75, int2(1,-1));
uint4 txval421 = g_tTex2du4 . GatherCmp(g_sSampCmp, c2, 0.75, int2(1,1));
// GatherCmpGreen not implemented pending OpImageDrefGather component input
// float4 txval101 = g_tTex2df4 . GatherCmpGreen(g_sSampCmp, c2, 0.75, int2(1,0));

View File

@ -36,6 +36,10 @@ PS_OUTPUT main()
// no 1D gathers
float4 txval401 = g_tTex2df4a . GatherCmp(g_sSampCmp, c3, 0.75, o2);
int4 txval411 = g_tTex2di4a . GatherCmp(g_sSampCmp, c3, 0.75, o2);
uint4 txval421 = g_tTex2du4a . GatherCmp(g_sSampCmp, c3, 0.75, o2);
float4 txval001 = g_tTex2df4a . GatherCmpRed(g_sSampCmp, c3, 0.75, o2);
int4 txval011 = g_tTex2di4a . GatherCmpRed(g_sSampCmp, c3, 0.75, o2);
uint4 txval021 = g_tTex2du4a . GatherCmpRed(g_sSampCmp, c3, 0.75, o2);

View File

@ -0,0 +1,14 @@
float4 main() : SV_Target0
{
// Unroll hint
[unroll(5) ] for (int x=0; x<5; ++x);
// Don't unroll hint
[loop] for (int y=0; y<5; ++y);
// No hint
for (int z=0; z<5; ++z);
return 0;
}

View File

@ -81,10 +81,10 @@ set(HEADERS
# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp)
add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
set_property(TARGET glslang PROPERTY FOLDER glslang)
set_property(TARGET glslang PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
target_link_libraries(glslang OGLCompiler OSDependent)
if(ENABLE_HLSL)
target_link_libraries(glslang HLSL)
target_link_libraries(glslang HLSL)
endif()
if(WIN32)
@ -95,10 +95,10 @@ if(WIN32)
source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*")
endif(WIN32)
install(TARGETS glslang
ARCHIVE DESTINATION lib)
install(TARGETS glslang
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
foreach(file ${HEADERS})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${file} DESTINATION include/glslang/${dir})
install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
endforeach()

View File

@ -758,6 +758,15 @@ protected:
TType type;
};
//
// Loop control hints
//
enum TLoopControl {
ELoopControlNone,
ELoopControlUnroll,
ELoopControlDontUnroll,
};
//
// Handle for, do-while, and while loops.
//
@ -767,17 +776,25 @@ public:
body(aBody),
test(aTest),
terminal(aTerminal),
first(testFirst) { }
first(testFirst),
control(ELoopControlNone)
{ }
virtual void traverse(TIntermTraverser*);
TIntermNode* getBody() const { return body; }
TIntermTyped* getTest() const { return test; }
TIntermTyped* getTerminal() const { return terminal; }
bool testFirst() const { return first; }
void setLoopControl(TLoopControl c) { control = c; }
TLoopControl getLoopControl() const { return control; }
protected:
TIntermNode* body; // code to loop over
TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops
TIntermTyped* terminal; // exists for for-loops
bool first; // true for while and for, not for do-while
TLoopControl control; // loop control hint
};
//

View File

@ -1630,10 +1630,11 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool
//
// Create while and do-while loop nodes.
//
TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc)
TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control)
{
TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst);
node->setLoc(loc);
node->setLoopControl(control);
return node;
}
@ -1641,10 +1642,11 @@ TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TInte
//
// Create a for-loop sequence.
//
TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc)
TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control)
{
TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst);
node->setLoc(loc);
node->setLoopControl(control);
// make a sequence of the initializer and statement
TIntermAggregate* loopSequence = makeAggregate(initializer, loc);

View File

@ -413,8 +413,8 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
return -1;
}
void notifyBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) override {}
void notifyInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) override {}
void notifyBinding(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {}
void notifyInOut(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {}
void endNotifications() override {}
protected:

View File

@ -283,8 +283,8 @@ public:
TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const;
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const;
bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false);
TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&);
TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&);
TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone);
TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone);
TIntermBranch* addBranch(TOperator, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
template<typename selectorType> TIntermTyped* addSwizzle(TSwizzleSelectors<selectorType>&, const TSourceLoc&);

View File

@ -1,5 +1,5 @@
add_library(OSDependent STATIC ossource.cpp ../osinclude.h)
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
set_property(TARGET OSDependent PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
install(TARGETS OSDependent
ARCHIVE DESTINATION lib)
install(TARGETS OSDependent
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -1,17 +1,17 @@
set(SOURCES ossource.cpp ../osinclude.h)
add_library(OSDependent STATIC ${SOURCES})
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
set_property(TARGET OSDependent PROPERTY FOLDER glslang POSITION_INDEPENDENT_CODE ON)
# MinGW GCC complains about function pointer casts to void*.
# Turn that off with -fpermissive.
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
target_compile_options(OSDependent PRIVATE -fpermissive)
target_compile_options(OSDependent PRIVATE -fpermissive)
endif()
if(WIN32)
source_group("Source" FILES ${SOURCES})
endif(WIN32)
install(TARGETS OSDependent
ARCHIVE DESTINATION lib)
install(TARGETS OSDependent
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -1,55 +1,57 @@
if (TARGET gmock)
message(STATUS "Google Mock found - building tests")
if(BUILD_TESTING)
if(TARGET gmock)
message(STATUS "Google Mock found - building tests")
set(TEST_SOURCES
# Framework related source files
${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Settings.h
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h
set(TEST_SOURCES
# Framework related source files
${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Settings.h
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h
# Test related source files
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp
# -- Remapper tests
${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp
)
# Test related source files
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp
add_executable(glslangtests ${TEST_SOURCES})
set_property(TARGET glslangtests PROPERTY FOLDER tests)
glslang_set_link_args(glslangtests)
install(TARGETS glslangtests
RUNTIME DESTINATION bin)
# -- Remapper tests
${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp)
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
# Supply a default test root directory, so that manual testing
# doesn't have to specify the --test-root option in the normal
# case that you want to use the tests from the same source tree.
target_compile_definitions(glslangtests
PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}")
target_include_directories(glslangtests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}
${gmock_SOURCE_DIR}/include
${gtest_SOURCE_DIR}/include)
add_executable(glslangtests ${TEST_SOURCES})
set_property(TARGET glslangtests PROPERTY FOLDER tests)
glslang_set_link_args(glslangtests)
install(TARGETS glslangtests
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
set(LIBRARIES
SPVRemapper glslang OSDependent OGLCompiler glslang
SPIRV glslang-default-resource-limits)
if(ENABLE_HLSL)
set(LIBRARIES ${LIBRARIES} HLSL)
endif(ENABLE_HLSL)
target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock)
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
# Supply a default test root directory, so that manual testing
# doesn't have to specify the --test-root option in the normal
# case that you want to use the tests from the same source tree.
target_compile_definitions(glslangtests
PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}")
target_include_directories(glslangtests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}
${gmock_SOURCE_DIR}/include
${gtest_SOURCE_DIR}/include)
add_test(NAME glslang-gtests
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
set(LIBRARIES
SPVRemapper glslang OSDependent OGLCompiler glslang
SPIRV glslang-default-resource-limits)
if(ENABLE_HLSL)
set(LIBRARIES ${LIBRARIES} HLSL)
endif(ENABLE_HLSL)
target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock)
add_test(NAME glslang-gtests
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
endif()
endif()

View File

@ -175,6 +175,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.logical.binary.vec.frag", "main"},
{"hlsl.logicalConvert.frag", "main"},
{"hlsl.logical.unary.frag", "main"},
{"hlsl.loopattr.frag", "main"},
{"hlsl.namespace.frag", "main"},
{"hlsl.nonint-index.frag", "main"},
{"hlsl.matNx1.frag", "main"},

View File

@ -7,7 +7,7 @@ set(SOURCES
hlslGrammar.cpp
hlslParseables.cpp)
set(HEADERS
set(HEADERS
hlslAttributes.h
hlslParseHelper.h
hlslTokens.h
@ -18,11 +18,11 @@ set(SOURCES
hlslParseables.h)
add_library(HLSL STATIC ${SOURCES} ${HEADERS})
set_property(TARGET HLSL PROPERTY FOLDER hlsl)
set_property(TARGET HLSL PROPERTY FOLDER hlsl POSITION_INDEPENDENT_CODE ON)
if(WIN32)
source_group("Source" FILES ${SOURCES} ${HEADERS})
endif(WIN32)
install(TARGETS HLSL
ARCHIVE DESTINATION lib)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -80,6 +80,8 @@ namespace glslang {
return EatPatchConstantFunc;
else if (lowername == "unroll")
return EatUnroll;
else if (lowername == "loop")
return EatLoop;
else
return EatNone;
}
@ -107,4 +109,10 @@ namespace glslang {
return (entry == attributes.end()) ? nullptr : entry->second;
}
// True if entry exists in map (even if value is nullptr)
bool TAttributeMap::contains(TAttributeType attr) const
{
return attributes.find(attr) != attributes.end();
}
} // end namespace glslang

View File

@ -62,6 +62,7 @@ namespace glslang {
EatPatchConstantFunc,
EatPatchSize,
EatUnroll,
EatLoop,
};
}
@ -86,6 +87,9 @@ namespace glslang {
// Const lookup: search for (but do not modify) the attribute in the map.
const TIntermAggregate* operator[](TAttributeType) const;
// True if entry exists in map (even if value is nullptr)
bool contains(TAttributeType) const;
protected:
// Find an attribute enum given its name.
static TAttributeType attributeFromName(const TString&);

View File

@ -3127,7 +3127,7 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement)
case EHTokFor:
case EHTokDo:
case EHTokWhile:
return acceptIterationStatement(statement);
return acceptIterationStatement(statement, attributes);
case EHTokContinue:
case EHTokBreak:
@ -3336,7 +3336,7 @@ bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement)
// | FOR LEFT_PAREN for_init_statement for_rest_statement RIGHT_PAREN statement
//
// Non-speculative, only call if it needs to be found; WHILE or DO or FOR already seen.
bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttributeMap& attributes)
{
TSourceLoc loc = token.loc;
TIntermTyped* condition = nullptr;
@ -3346,6 +3346,8 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
// WHILE or DO or FOR
advanceToken();
const TLoopControl control = parseContext.handleLoopControl(attributes);
switch (loop) {
case EHTokWhile:
@ -3370,7 +3372,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
parseContext.unnestLooping();
parseContext.popScope();
statement = intermediate.addLoop(statement, condition, nullptr, true, loc);
statement = intermediate.addLoop(statement, condition, nullptr, true, loc, control);
return true;
@ -3402,7 +3404,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
parseContext.unnestLooping();
statement = intermediate.addLoop(statement, condition, 0, false, loc);
statement = intermediate.addLoop(statement, condition, 0, false, loc, control);
return true;
@ -3451,7 +3453,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
return false;
}
statement = intermediate.addForLoop(statement, initNode, condition, iterator, true, loc);
statement = intermediate.addForLoop(statement, initNode, condition, iterator, true, loc, control);
parseContext.popScope();
parseContext.unnestLooping();

View File

@ -116,7 +116,7 @@ namespace glslang {
void acceptAttributes(TAttributeMap&);
bool acceptSelectionStatement(TIntermNode*&);
bool acceptSwitchStatement(TIntermNode*&);
bool acceptIterationStatement(TIntermNode*&);
bool acceptIterationStatement(TIntermNode*&, const TAttributeMap&);
bool acceptJumpStatement(TIntermNode*&);
bool acceptCaseLabel(TIntermNode*&);
bool acceptDefaultLabel(TIntermNode*&);

View File

@ -7568,6 +7568,20 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout
return true;
}
//
// Loop hints
//
TLoopControl HlslParseContext::handleLoopControl(const TAttributeMap& attributes) const
{
if (attributes.contains(EatUnroll))
return ELoopControlUnroll;
else if (attributes.contains(EatLoop))
return ELoopControlDontUnroll;
else
return ELoopControlNone;
}
//
// Updating default qualifier for the case of a declaration with just a qualifier,
// no type, block, or identifier.

View File

@ -192,6 +192,9 @@ public:
bool handleOutputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
// Determine loop control from attributes
TLoopControl handleLoopControl(const TAttributeMap& attributes) const;
// Potentially rename shader entry point function
void renameShaderFunction(const TString*& name) const;

View File

@ -111,7 +111,8 @@ bool IsIllegalSample(const glslang::TString& name, const char* argOrder, int dim
name == "GatherAlpha");
const bool isGatherCmp =
(name == "GatherCmpRed" ||
(name == "GatherCmp" ||
name == "GatherCmpRed" ||
name == "GatherCmpGreen" ||
name == "GatherCmpBlue" ||
name == "GatherCmpAlpha");
@ -824,6 +825,12 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
{ "GatherAlpha", /* O-4 */ "V4", nullptr, "%@,S,V,,,,", "FIU,S,F,I,,,", EShLangAll, true },
{ "GatherAlpha", /* O-4, status */"V4", nullptr, "%@,S,V,,,,,S", "FIU,S,F,I,,,,U", EShLangAll, true },
{ "GatherCmp", /*!O*/ "V4", nullptr, "%@,S,V,S", "FIU,s,F,", EShLangAll, true },
{ "GatherCmp", /* O*/ "V4", nullptr, "%@,S,V,S,V", "FIU,s,F,,I", EShLangAll, true },
{ "GatherCmp", /* O, status*/ "V4", nullptr, "%@,S,V,S,V,>S", "FIU,s,F,,I,U", EShLangAll, true },
{ "GatherCmp", /* O-4 */ "V4", nullptr, "%@,S,V,S,V,,,", "FIU,s,F,,I,,,", EShLangAll, true },
{ "GatherCmp", /* O-4, status */"V4", nullptr, "%@,S,V,S,V,,V,S","FIU,s,F,,I,,,,U",EShLangAll, true },
{ "GatherCmpRed", /*!O*/ "V4", nullptr, "%@,S,V,S", "FIU,s,F,", EShLangAll, true },
{ "GatherCmpRed", /* O*/ "V4", nullptr, "%@,S,V,S,V", "FIU,s,F,,I", EShLangAll, true },
{ "GatherCmpRed", /* O, status*/ "V4", nullptr, "%@,S,V,S,V,>S", "FIU,s,F,,I,U", EShLangAll, true },
@ -1203,6 +1210,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherGreen", EOpMethodGatherGreen);
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherBlue", EOpMethodGatherBlue);
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherAlpha", EOpMethodGatherAlpha);
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherCmp", EOpMethodGatherCmpRed); // alias
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherCmpRed", EOpMethodGatherCmpRed);
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherCmpGreen", EOpMethodGatherCmpGreen);
symbolTable.relateToOperator(BUILTIN_PREFIX "GatherCmpBlue", EOpMethodGatherCmpBlue);