Skip to content

Commit

Permalink
Merge branch 'KhronosGroup-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Madman10K committed Feb 8, 2025
2 parents ac29798 + 8c055d7 commit 639ef4b
Show file tree
Hide file tree
Showing 22 changed files with 5,006 additions and 4,556 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.a
*.so
*.exe
.cache/
.vscode/
tags
TAGS
Expand Down
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023 The Khronos Group Inc.
# Copyright (C) 2020-2025 The Khronos Group Inc.
#
# All rights reserved.
#
Expand Down Expand Up @@ -175,12 +175,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
endif()
elseif(MSVC)
if(NOT ENABLE_RTTI)
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
if(MSVC_HAS_GR)
string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
add_compile_options(/GR-) # Disable RTTI
endif()
add_compile_options(/GR-) # Disable RTTI
endif()
if(ENABLE_EXCEPTIONS)
add_compile_options(/EHsc) # Enable Exceptions
Expand Down Expand Up @@ -224,7 +219,7 @@ function(glslang_set_link_args TARGET)
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "-static -static-libgcc -static-libstdc++")
endif()
endfunction(glslang_set_link_args)
endfunction()

# Root directory for build-time generated include files
set(GLSLANG_GENERATED_INCLUDEDIR "${CMAKE_BINARY_DIR}/include")
Expand Down Expand Up @@ -354,7 +349,7 @@ if(GLSLANG_TESTS)
set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:spirv-remap>,\;>")
endif()
endif()
endif(GLSLANG_TESTS)
endif()

if (GLSLANG_ENABLE_INSTALL)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/glslang-config.cmake.in" [=[
Expand Down Expand Up @@ -400,4 +395,4 @@ if (GLSLANG_ENABLE_INSTALL)
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
endif(GLSLANG_ENABLE_INSTALL)
endif()
2 changes: 2 additions & 0 deletions SPIRV/GLSL.ext.NV.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ const char* const E_SPV_NV_cooperative_matrix2 = "SPV_NV_cooperative_matrix2";
//SPV_NV_cluster_acceleration_structure
const char* const E_SPV_NV_cluster_acceleration_structure = "SPV_NV_cluster_acceleration_structure";

//SPV_NV_linear_swept_spheres
const char* const E_SPV_NV_linear_swept_spheres = "SPV_NV_linear_swept_spheres";
#endif // #ifndef GLSLextNV_H
214 changes: 213 additions & 1 deletion SPIRV/GlslangToSpv.cpp

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions SPIRV/SpvBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3185,6 +3185,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
if (parameters.volatil) {
mask = mask | ImageOperandsVolatileTexelKHRMask;
}
if (parameters.nontemporal) {
mask = mask | ImageOperandsNontemporalMask;
}
mask = mask | signExtensionMask;
// insert the operand for the mask, if any bits were set.
if (mask != ImageOperandsMaskNone)
Expand Down
5 changes: 5 additions & 0 deletions SPIRV/SpvBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ typedef enum {
Spv_1_3 = (1 << 16) | (3 << 8),
Spv_1_4 = (1 << 16) | (4 << 8),
Spv_1_5 = (1 << 16) | (5 << 8),
Spv_1_6 = (1 << 16) | (6 << 8),
} SpvVersion;

class Builder {
Expand Down Expand Up @@ -590,6 +591,7 @@ class Builder {
Id coarse;
bool nonprivate;
bool volatil;
bool nontemporal;
};

// Select the correct texture operation based on all inputs, and emit the correct instruction
Expand Down Expand Up @@ -758,6 +760,7 @@ class Builder {
unsigned shadercallcoherent : 1;
unsigned nonprivate : 1;
unsigned volatil : 1;
unsigned nontemporal : 1;
unsigned isImage : 1;
unsigned nonUniform : 1;

Expand All @@ -770,6 +773,7 @@ class Builder {
shadercallcoherent = 0;
nonprivate = 0;
volatil = 0;
nontemporal = 0;
isImage = 0;
nonUniform = 0;
}
Expand All @@ -783,6 +787,7 @@ class Builder {
shadercallcoherent |= other.shadercallcoherent;
nonprivate |= other.nonprivate;
volatil |= other.volatil;
nontemporal = other.nontemporal;
isImage |= other.isImage;
nonUniform |= other.nonUniform;
return *this;
Expand Down
69 changes: 68 additions & 1 deletion SPIRV/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ const char* BuiltInString(int builtIn)
case BuiltInHitMicroTriangleVertexBarycentricsNV: return "HitMicroTriangleVertexBarycentricsNV";
case BuiltInHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV";
case BuiltInHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV";
case BuiltInHitIsSphereNV: return "HitIsSphereNV";
case BuiltInHitIsLSSNV: return "HitIsLSSNV";
case BuiltInHitSpherePositionNV: return "HitSpherePositionNV";
case BuiltInHitSphereRadiusNV: return "HitSphereRadiusNV";
case BuiltInHitLSSPositionsNV: return "HitLSSPositionsNV";
case BuiltInHitLSSRadiiNV: return "HitLLSSRadiiNV";
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
Expand Down Expand Up @@ -631,7 +637,7 @@ const char* ImageChannelDataTypeString(int type)
}
}

const int ImageOperandsCeiling = 14;
const int ImageOperandsCeiling = 15;

const char* ImageOperandsString(int format)
{
Expand All @@ -650,6 +656,7 @@ const char* ImageOperandsString(int format)
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
case ImageOperandsSignExtendShift: return "SignExtend";
case ImageOperandsZeroExtendShift: return "ZeroExtend";
case ImageOperandsNontemporalShift: return "Nontemporal";

case ImageOperandsCeiling:
default:
Expand Down Expand Up @@ -1100,6 +1107,8 @@ const char* CapabilityString(int info)

case CapabilityRayTracingClusterAccelerationStructureNV: return "RayTracingClusterAccelerationStructureNV";

case CapabilityRayTracingSpheresGeometryNV: return "RayTracingSpheresGeometryNV";
case CapabilityRayTracingLinearSweptSpheresGeometryNV: return "RayTracingLinearSweptSpheresGeometryNV";
default: return "Bad";
}
}
Expand Down Expand Up @@ -1554,6 +1563,14 @@ const char* OpcodeString(int op)
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR";
case OpRayQueryGetIntersectionClusterIdNV: return "OpRayQueryGetIntersectionClusterIdNV";

case OpRayQueryGetIntersectionSpherePositionNV: return "OpRayQueryGetIntersectionSpherePositionNV";
case OpRayQueryGetIntersectionSphereRadiusNV: return "OpRayQueryGetIntersectionSphereRadiusNV";
case OpRayQueryGetIntersectionLSSHitValueNV: return "OpRayQueryGetIntersectionLSSHitValueNV";
case OpRayQueryGetIntersectionLSSPositionsNV: return "OpRayQueryGetIntersectionLSSPositionsNV";
case OpRayQueryGetIntersectionLSSRadiiNV: return "OpRayQueryGetIntersectionLSSRadiiNV";
case OpRayQueryIsSphereHitNV: return "OpRayQueryIsSphereHitNV";
case OpRayQueryIsLSSHitNV: return "OpRayQueryIsLSSHitNV";

case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV";
Expand Down Expand Up @@ -1631,6 +1648,12 @@ const char* OpcodeString(int op)
case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV";
case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV";
case OpHitObjectGetClusterIdNV: return "OpHitObjectGetClusterIdNV";
case OpHitObjectGetSpherePositionNV: return "OpHitObjectGetSpherePositionNV";
case OpHitObjectGetSphereRadiusNV: return "OpHitObjectGetSphereRadiusNV";
case OpHitObjectGetLSSPositionsNV: return "OpHitObjectGetLSSPositionsNV";
case OpHitObjectGetLSSRadiiNV: return "OpHitObjectGetLSSRadiiNV";
case OpHitObjectIsSphereHitNV: return "OpHitObjectIsSphereHitNV";
case OpHitObjectIsLSSHitNV: return "OpHitObjectIsLSSHitNV";

case OpFetchMicroTriangleVertexBarycentricNV: return "OpFetchMicroTriangleVertexBarycentricNV";
case OpFetchMicroTriangleVertexPositionNV: return "OpFetchMicroTriangleVertexPositionNV";
Expand Down Expand Up @@ -3221,6 +3244,33 @@ void Parameterize()
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionClusterIdNV].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionSpherePositionNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionSphereRadiusNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionLSSHitValueNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionLSSPositionsNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionLSSRadiiNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryIsSphereHitNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryIsSphereHitNV].setResultAndType(true, true);

InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryIsLSSHitNV].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryIsLSSHitNV].setResultAndType(true, true);

InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");
Expand Down Expand Up @@ -3543,6 +3593,23 @@ void Parameterize()

InstructionDesc[OpHitObjectGetClusterIdNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetClusterIdNV].setResultAndType(true, true);
InstructionDesc[OpHitObjectGetSpherePositionNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetSpherePositionNV].setResultAndType(true, true);

InstructionDesc[OpHitObjectGetSphereRadiusNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetSphereRadiusNV].setResultAndType(true, true);

InstructionDesc[OpHitObjectGetLSSPositionsNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetLSSPositionsNV].setResultAndType(true, true);

InstructionDesc[OpHitObjectGetLSSRadiiNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectGetLSSRadiiNV].setResultAndType(true, true);

InstructionDesc[OpHitObjectIsSphereHitNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectIsSphereHitNV].setResultAndType(true, true);

InstructionDesc[OpHitObjectIsLSSHitNV].operands.push(OperandId, "'HitObject'");
InstructionDesc[OpHitObjectIsLSSHitNV].setResultAndType(true, true);

InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Acceleration Structure'");
InstructionDesc[OpFetchMicroTriangleVertexBarycentricNV].operands.push(OperandId, "'Instance ID'");
Expand Down
21 changes: 21 additions & 0 deletions SPIRV/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,18 @@ enum BuiltIn {
BuiltInIncomingRayFlagsKHR = 5351,
BuiltInIncomingRayFlagsNV = 5351,
BuiltInRayGeometryIndexKHR = 5352,
BuiltInHitIsSphereNV = 5359,
BuiltInHitIsLSSNV = 5360,
BuiltInHitSpherePositionNV = 5361,
BuiltInWarpsPerSMNV = 5374,
BuiltInSMCountNV = 5375,
BuiltInWarpIDNV = 5376,
BuiltInSMIDNV = 5377,
BuiltInHitLSSPositionsNV = 5396,
BuiltInHitKindFrontFacingMicroTriangleNV = 5405,
BuiltInHitKindBackFacingMicroTriangleNV = 5406,
BuiltInHitSphereRadiusNV = 5420,
BuiltInHitLSSRadiiNV = 5421,
BuiltInClusterIDNV = 5436,
BuiltInCullMaskKHR = 6021,
BuiltInMax = 0x7fffffff,
Expand Down Expand Up @@ -1172,6 +1178,8 @@ enum Capability {
CapabilityAtomicFloat16VectorNV = 5404,
CapabilityRayTracingDisplacementMicromapNV = 5409,
CapabilityRawAccessChainsNV = 5414,
CapabilityRayTracingSpheresGeometryNV = 5418,
CapabilityRayTracingLinearSweptSpheresGeometryNV = 5419,
CapabilityCooperativeMatrixReductionsNV = 5430,
CapabilityCooperativeMatrixConversionsNV = 5431,
CapabilityCooperativeMatrixPerElementOperationsNV = 5432,
Expand Down Expand Up @@ -2033,6 +2041,19 @@ enum Op {
OpConvertSampledImageToUNV = 5396,
OpSamplerImageAddressingModeNV = 5397,
OpRawAccessChainNV = 5398,
OpRayQueryGetIntersectionSpherePositionNV = 5427,
OpRayQueryGetIntersectionSphereRadiusNV = 5428,
OpRayQueryGetIntersectionLSSPositionsNV = 5429,
OpRayQueryGetIntersectionLSSRadiiNV = 5430,
OpRayQueryGetIntersectionLSSHitValueNV = 5431,
OpHitObjectGetSpherePositionNV = 5432,
OpHitObjectGetSphereRadiusNV = 5433,
OpHitObjectGetLSSPositionsNV = 5434,
OpHitObjectGetLSSRadiiNV = 5435,
OpHitObjectIsSphereHitNV = 5436,
OpHitObjectIsLSSHitNV = 5437,
OpRayQueryIsSphereHitNV = 5438,
OpRayQueryIsLSSHitNV = 5439,
OpSubgroupShuffleINTEL = 5571,
OpSubgroupShuffleDownINTEL = 5572,
OpSubgroupShuffleUpINTEL = 5573,
Expand Down
14 changes: 14 additions & 0 deletions glslang/Include/BaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ enum TBuiltInVariable {
EbvHitKindFrontFacingMicroTriangleNV,
EbvHitKindBackFacingMicroTriangleNV,

EbvHitIsSphereNV,
EbvHitIsLSSNV,
EbvHitSpherePositionNV,
EbvHitSphereRadiusNV,
EbvHitLSSPositionsNV,
EbvHitLSSRadiiNV,

//GL_EXT_mesh_shader
EbvPrimitivePointIndicesEXT,
EbvPrimitiveLineIndicesEXT,
Expand Down Expand Up @@ -536,6 +543,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvHitKindFrontFacingMicroTriangleNV: return "HitKindFrontFacingMicroTriangleNV";
case EbvHitKindBackFacingMicroTriangleNV: return "HitKindBackFacingMicroTriangleNV";

case EbvHitIsSphereNV: return "HitIsSphereNV";
case EbvHitIsLSSNV: return "HitIsLSSNV";
case EbvHitSpherePositionNV: return "HitSpherePositionNV";
case EbvHitSphereRadiusNV: return "HitSphereRadiusNV";
case EbvHitLSSPositionsNV: return "HitSpherePositionsNV";
case EbvHitLSSRadiiNV: return "HitLSSRadiiNV";

default: return "unknown built-in variable";
}
}
Expand Down
9 changes: 7 additions & 2 deletions glslang/Include/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ class TQualifier {
shadercallcoherent = false;
nonprivate = false;
volatil = false;
nontemporal = false;
restrict = false;
readonly = false;
writeonly = false;
Expand Down Expand Up @@ -589,6 +590,7 @@ class TQualifier {
bool writeonly : 1;
bool coherent : 1;
bool volatil : 1;
bool nontemporal : 1;
bool devicecoherent : 1;
bool queuefamilycoherent : 1;
bool workgroupcoherent : 1;
Expand All @@ -603,14 +605,15 @@ class TQualifier {
bool isRestrict() const { return restrict; }
bool isCoherent() const { return coherent; }
bool isVolatile() const { return volatil; }
bool isNonTemporal() const { return nontemporal; }
bool isSample() const { return sample; }
bool isMemory() const
{
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly || nonprivate;
}
bool isMemoryQualifierImageAndSSBOOnly() const
{
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || nontemporal || restrict || readonly || writeonly;
}
bool bufferReferenceNeedsVulkanMemoryModel() const
{
Expand Down Expand Up @@ -2297,6 +2300,8 @@ class TType {
appendStr(" nonprivate");
if (qualifier.volatil)
appendStr(" volatile");
if (qualifier.nontemporal)
appendStr(" nontemporal");
if (qualifier.restrict)
appendStr(" restrict");
if (qualifier.readonly)
Expand Down
15 changes: 15 additions & 0 deletions glslang/Include/intermediate.h
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,21 @@ enum TOperator {
// GL_NV_cluster_acceleration_structure
EOpRayQueryGetIntersectionClusterIdNV,
EOpHitObjectGetClusterIdNV,

// GL_NV_linear_swept_spheres
EOpRayQueryGetIntersectionSpherePositionNV,
EOpRayQueryGetIntersectionSphereRadiusNV,
EOpRayQueryGetIntersectionLSSHitValueNV,
EOpRayQueryGetIntersectionLSSPositionsNV,
EOpRayQueryGetIntersectionLSSRadiiNV,
EOpRayQueryIsSphereHitNV,
EOpRayQueryIsLSSHitNV,
EOpHitObjectGetSpherePositionNV,
EOpHitObjectGetSphereRadiusNV,
EOpHitObjectGetLSSPositionsNV,
EOpHitObjectGetLSSRadiiNV,
EOpHitObjectIsSphereHitNV,
EOpHitObjectIsLSSHitNV,
};

inline bool IsOpNumericConv(const TOperator op) {
Expand Down
Loading

0 comments on commit 639ef4b

Please sign in to comment.