Merge pull request #15 from raphaelthegreat/master

Add recent changes
This commit is contained in:
wheremyfoodat
2025-07-15 03:15:14 +03:00
committed by GitHub
4 changed files with 32 additions and 2 deletions

View File

@@ -1270,6 +1270,11 @@ public:
/// TBD
Id OpSubgroupAllEqualKHR(Id result_type, Id predicate);
// Find the least significant bit set to 1 in Value, considering only the bits in Value required
// to represent all bits of the scope restricted tangle. If none of the considered bits is set to 1,
// the resulting value is undefined.
Id OpGroupNonUniformBallotFindLSB(Id result_type, Id scope, Id value);
// Result is the Value of the invocation identified by the id Id to all active invocations in
// the group.
Id OpGroupNonUniformBroadcast(Id result_type, Id scope, Id value, Id id);
@@ -1423,8 +1428,8 @@ public:
/// 3) store the New Value back through Pointer.
Id OpAtomicXor(Id result_type, Id pointer, Id memory, Id semantics, Id value);
// Print a message for vulkan layers to use, e.g. renderdoc
// Usage is like C printf
/// Print a message for vulkan layers to use, e.g. renderdoc
/// Usage is like C printf
Id OpDebugPrintf(Id fmt, std::span<const Id> fmt_args);
/// Returns a two-component floating point vector that represents the 2D texture coordinates
@@ -1471,11 +1476,15 @@ public:
/// Result is the middle of x, y, and z, interpreted as signed integers.
Id OpSMid3AMD(Id result_type, Id x, Id y, Id z);
/// Returns the value of the input <interpolant> without any interpolation, i.e. the raw output value of previous shader stage.
Id OpInterpolateAtVertexAMD(Id result_type, Id interpolant, Id vertex_index);
private:
Id GetGLSLstd450();
Id GetNonSemanticDebugPrintf();
Id GetAmdGcnShader();
Id GetAmdShaderTrinaryMinMax();
Id GetAmdExplicitVertexParameter();
std::uint32_t version{};
std::uint32_t bound{};
@@ -1486,6 +1495,7 @@ private:
std::optional<Id> non_semantic_debug_printf;
std::optional<Id> amd_gcn_shader;
std::optional<Id> amd_shader_trinary_minmax;
std::optional<Id> amd_explicit_vertex_parameter;
spv::AddressingModel addressing_model{spv::AddressingModel::Logical};
spv::MemoryModel memory_model{spv::MemoryModel::GLSL450};

View File

@@ -7,6 +7,7 @@
#include <iterator>
#include <spirv/unified1/AMD_gcn_shader.h>
#include <spirv/unified1/AMD_shader_trinary_minmax.h>
#include <spirv/unified1/AMD_shader_explicit_vertex_parameter.h>
#include <spirv/unified1/GLSL.std.450.h>
#include <spirv/unified1/NonSemanticDebugPrintf.h>
@@ -110,6 +111,8 @@ DEFINE_UNARY(GetAmdGcnShader(), OpCubeFaceCoordAMD, AMD_gcn_shaderCubeFaceCoordA
DEFINE_UNARY(GetAmdGcnShader(), OpCubeFaceIndexAMD, AMD_gcn_shaderCubeFaceIndexAMD)
DEFINE_NULLARY(GetAmdGcnShader(), OpTimeAMD, AMD_gcn_shaderTimeAMD)
DEFINE_BINARY(GetAmdExplicitVertexParameter(), OpInterpolateAtVertexAMD, AMD_shader_explicit_vertex_parameterInterpolateAtVertexAMD)
DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpFMin3AMD, AMD_shader_trinary_minmaxFMin3AMD)
DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpUMin3AMD, AMD_shader_trinary_minmaxUMin3AMD)
DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpSMin3AMD, AMD_shader_trinary_minmaxSMin3AMD)
@@ -120,4 +123,5 @@ DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpFMid3AMD, AMD_shader_trinary_minma
DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpUMid3AMD, AMD_shader_trinary_minmaxUMid3AMD)
DEFINE_TRINARY(GetAmdShaderTrinaryMinMax(), OpSMid3AMD, AMD_shader_trinary_minmaxSMid3AMD)
} // namespace Sirit

View File

@@ -79,4 +79,9 @@ Id Module::OpGroupNonUniformQuadBroadcast(Id result_type, Id scope, Id value, Id
return *code << OpId{spv::Op::OpGroupNonUniformQuadBroadcast, result_type} << scope << value << index << EndOp{};
}
Id Module::OpGroupNonUniformBallotFindLSB(Id result_type, Id scope, Id value) {
code->Reserve(5);
return *code << OpId{spv::Op::OpGroupNonUniformBallotFindLSB, result_type} << scope << value << EndOp{};
}
} // namespace Sirit

View File

@@ -175,4 +175,15 @@ Id Module::GetAmdShaderTrinaryMinMax() {
return *amd_shader_trinary_minmax;
}
Id Module::GetAmdExplicitVertexParameter() {
const char* extname = "SPV_AMD_shader_explicit_vertex_parameter";
size_t len = WordsInString(extname);
if (!amd_explicit_vertex_parameter) {
ext_inst_imports->Reserve(3 + len);
amd_explicit_vertex_parameter = *ext_inst_imports << OpId{spv::Op::OpExtInstImport} << extname << EndOp{};
}
return *amd_explicit_vertex_parameter;
}
} // namespace Sirit