Revert "Make argument buffer padding testable"
This reverts commit 275e4d7e88
.
This commit is contained in:
parent
275e4d7e88
commit
4c622ce030
63
main.cpp
63
main.cpp
@ -645,7 +645,6 @@ struct CLIArguments
|
||||
bool msl_pad_fragment_output = false;
|
||||
bool msl_domain_lower_left = false;
|
||||
bool msl_argument_buffers = false;
|
||||
SmallVector<MSLResourceBinding> msl_resource_bindings;
|
||||
uint32_t msl_argument_buffers_tier = 0; // Tier 1
|
||||
bool msl_texture_buffer_native = false;
|
||||
bool msl_framebuffer_fetch = false;
|
||||
@ -861,7 +860,6 @@ static void print_help_msl()
|
||||
"\t[--msl-domain-lower-left]:\n\t\tUse a lower-left tessellation domain.\n"
|
||||
"\t[--msl-argument-buffers]:\n\t\tEmit Metal argument buffers instead of discrete resource bindings.\n"
|
||||
"\t\tRequires MSL 2.0 to be enabled.\n"
|
||||
"\t[--msl-argument-buffer-pad <stage> <base type> <set index> <binding> <count>]:\n\t\tSpecify resource binding types used to pad argument buffer entries used by other stages.\n"
|
||||
"\t[--msl-argument-buffer-tier]:\n\t\tWhen using Metal argument buffers, indicate the Metal argument buffer tier level supported by the Metal platform.\n"
|
||||
"\t\tUses same values as Metal MTLArgumentBuffersTier enumeration (0 = Tier1, 1 = Tier2).\n"
|
||||
"\t\tSetting this value also enables msl-argument-buffers.\n"
|
||||
@ -1145,52 +1143,6 @@ static ExecutionModel stage_to_execution_model(const std::string &stage)
|
||||
SPIRV_CROSS_THROW("Invalid stage.");
|
||||
}
|
||||
|
||||
static SPIRType::BaseType str_to_spir_base_type(const std::string &base_type)
|
||||
{
|
||||
if (base_type == "Void")
|
||||
return SPIRType::BaseType::Void;
|
||||
else if (base_type == "Boolean")
|
||||
return SPIRType::BaseType::Boolean;
|
||||
else if (base_type == "SByte")
|
||||
return SPIRType::BaseType::SByte;
|
||||
else if (base_type == "UByte")
|
||||
return SPIRType::BaseType::UByte;
|
||||
else if (base_type == "Short")
|
||||
return SPIRType::BaseType::Short;
|
||||
else if (base_type == "UShort")
|
||||
return SPIRType::BaseType::UShort;
|
||||
else if (base_type == "Int")
|
||||
return SPIRType::BaseType::Int;
|
||||
else if (base_type == "UInt")
|
||||
return SPIRType::BaseType::UInt;
|
||||
else if (base_type == "Int64")
|
||||
return SPIRType::BaseType::Int64;
|
||||
else if (base_type == "UInt64")
|
||||
return SPIRType::BaseType::UInt64;
|
||||
else if (base_type == "AtomicCounter")
|
||||
return SPIRType::BaseType::AtomicCounter;
|
||||
else if (base_type == "Half")
|
||||
return SPIRType::BaseType::Half;
|
||||
else if (base_type == "Float")
|
||||
return SPIRType::BaseType::Float;
|
||||
else if (base_type == "Double")
|
||||
return SPIRType::BaseType::Double;
|
||||
else if (base_type == "Struct")
|
||||
return SPIRType::BaseType::Struct;
|
||||
else if (base_type == "Image")
|
||||
return SPIRType::BaseType::Image;
|
||||
else if (base_type == "SampledImage")
|
||||
return SPIRType::BaseType::SampledImage;
|
||||
else if (base_type == "Sampler")
|
||||
return SPIRType::BaseType::Sampler;
|
||||
else if (base_type == "AccelerationStructure")
|
||||
return SPIRType::BaseType::AccelerationStructure;
|
||||
else if (base_type == "RayQuery")
|
||||
return SPIRType::BaseType::RayQuery;
|
||||
else
|
||||
SPIRV_CROSS_THROW("Invalid base type.");
|
||||
}
|
||||
|
||||
static HLSLBindingFlags hlsl_resource_type_to_flag(const std::string &arg)
|
||||
{
|
||||
if (arg == "push")
|
||||
@ -1247,7 +1199,6 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
|
||||
msl_opts.pad_fragment_output_components = args.msl_pad_fragment_output;
|
||||
msl_opts.tess_domain_origin_lower_left = args.msl_domain_lower_left;
|
||||
msl_opts.argument_buffers = args.msl_argument_buffers;
|
||||
msl_opts.pad_argument_buffer_resources = !args.msl_resource_bindings.empty();
|
||||
msl_opts.argument_buffers_tier = static_cast<CompilerMSL::Options::ArgumentBuffersTier>(args.msl_argument_buffers_tier);
|
||||
msl_opts.texture_buffer_native = args.msl_texture_buffer_native;
|
||||
msl_opts.multiview = args.msl_multiview;
|
||||
@ -1293,8 +1244,6 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
|
||||
msl_comp->add_msl_shader_output(v);
|
||||
if (args.msl_combined_sampler_suffix)
|
||||
msl_comp->set_combined_sampler_suffix(args.msl_combined_sampler_suffix);
|
||||
for (auto &v : args.msl_resource_bindings)
|
||||
msl_comp->add_msl_resource_binding(v);
|
||||
}
|
||||
else if (args.hlsl)
|
||||
compiler.reset(new CompilerHLSL(std::move(spirv_parser.get_parsed_ir())));
|
||||
@ -1683,18 +1632,6 @@ static int main_inner(int argc, char *argv[])
|
||||
cbs.add("--msl-pad-fragment-output", [&args](CLIParser &) { args.msl_pad_fragment_output = true; });
|
||||
cbs.add("--msl-domain-lower-left", [&args](CLIParser &) { args.msl_domain_lower_left = true; });
|
||||
cbs.add("--msl-argument-buffers", [&args](CLIParser &) { args.msl_argument_buffers = true; });
|
||||
cbs.add("--msl-argument-buffer-pad",
|
||||
[&args](CLIParser &parser)
|
||||
{
|
||||
MSLResourceBinding rez_bind;
|
||||
rez_bind.stage = stage_to_execution_model(parser.next_string());
|
||||
rez_bind.basetype = str_to_spir_base_type(parser.next_string());
|
||||
rez_bind.desc_set = parser.next_uint();
|
||||
rez_bind.binding = parser.next_uint();
|
||||
rez_bind.count = parser.next_uint();
|
||||
args.msl_resource_bindings.push_back(std::move(rez_bind));
|
||||
args.msl_argument_buffers = true;
|
||||
});
|
||||
cbs.add("--msl-argument-buffer-tier", [&args](CLIParser &parser) {
|
||||
args.msl_argument_buffers_tier = parser.next_uint();
|
||||
args.msl_argument_buffers = true;
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Buf16
|
||||
{
|
||||
ushort u16s[1];
|
||||
};
|
||||
|
||||
struct Buf32
|
||||
{
|
||||
uint u32s[1];
|
||||
};
|
||||
|
||||
struct Float32
|
||||
{
|
||||
float f32s[1];
|
||||
};
|
||||
|
||||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u);
|
||||
|
||||
struct spvDescriptorSetBuffer0
|
||||
{
|
||||
device Buf16* m_10 [[id(0)]];
|
||||
};
|
||||
|
||||
kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]])
|
||||
{
|
||||
device auto& _21 = (device Buf32&)(*spvDescriptorSet0.m_10);
|
||||
device auto& _30 = (device Float32&)(*spvDescriptorSet0.m_10);
|
||||
(*spvDescriptorSet0.m_10).u16s[0] = ushort(1u);
|
||||
_21.u32s[2] = 2u;
|
||||
_30.f32s[3] = 4.0;
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Buf16
|
||||
{
|
||||
ushort u16s[1];
|
||||
};
|
||||
|
||||
struct Buf32
|
||||
{
|
||||
uint u32s[1];
|
||||
};
|
||||
|
||||
struct Float32
|
||||
{
|
||||
float f32s[1];
|
||||
};
|
||||
|
||||
struct spvDescriptorSetBuffer0
|
||||
{
|
||||
device Buf16* m_13 [[id(0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
uint u16o [[user(locn0)]];
|
||||
uint u32o [[user(locn1)]];
|
||||
float f32o [[user(locn2)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]])
|
||||
{
|
||||
device auto& _24 = (device Buf32&)(*spvDescriptorSet0.m_13);
|
||||
device auto& _35 = (device Float32&)(*spvDescriptorSet0.m_13);
|
||||
main0_out out = {};
|
||||
out.u16o = uint((*spvDescriptorSet0.m_13).u16s[0]);
|
||||
out.u32o = _24.u32s[2];
|
||||
out.f32o = _35.f32s[3];
|
||||
out.gl_Position = float4(0.0);
|
||||
return out;
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
#version 450
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
layout(local_size_x = 64) in;
|
||||
|
||||
layout(binding = 2) buffer Buf16
|
||||
{
|
||||
uint16_t u16s[];
|
||||
};
|
||||
|
||||
layout(binding = 2) buffer Buf32
|
||||
{
|
||||
uint u32s[];
|
||||
};
|
||||
|
||||
layout(binding = 2) buffer Float32
|
||||
{
|
||||
float f32s[];
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
u16s[0] = uint16_t(1);
|
||||
u32s[2] = 2;
|
||||
f32s[3] = 4.0;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#version 450
|
||||
#extension GL_EXT_shader_16bit_storage : require
|
||||
|
||||
layout(binding = 2) buffer Buf16
|
||||
{
|
||||
uint16_t u16s[];
|
||||
};
|
||||
|
||||
layout(binding = 2) buffer Buf32
|
||||
{
|
||||
uint u32s[];
|
||||
};
|
||||
|
||||
layout(binding = 2) buffer Float32
|
||||
{
|
||||
float f32s[];
|
||||
};
|
||||
|
||||
layout(location = 0) flat out uint u16o;
|
||||
layout(location = 1) flat out uint u32o;
|
||||
layout(location = 2) flat out float f32o;
|
||||
|
||||
void main()
|
||||
{
|
||||
u16o = uint(u16s[0]);
|
||||
u32o = u32s[2];
|
||||
f32o = f32s[3];
|
||||
|
||||
gl_Position = vec4(0);
|
||||
}
|
@ -246,14 +246,6 @@ def cross_compile_msl(shader, spirv, opt, iterations, paths):
|
||||
msl_args.append('--msl-domain-lower-left')
|
||||
if '.argument.' in shader:
|
||||
msl_args.append('--msl-argument-buffers')
|
||||
if '.argument-pad.' in shader:
|
||||
# Arbitrary for testing purposes.
|
||||
msl_args.append('--msl-argument-buffer-pad')
|
||||
msl_args.append('frag')
|
||||
msl_args.append('Void')
|
||||
msl_args.append('0')
|
||||
msl_args.append('0')
|
||||
msl_args.append('1')
|
||||
if '.texture-buffer-native.' in shader:
|
||||
msl_args.append('--msl-texture-buffer-native')
|
||||
if '.framebuffer-fetch.' in shader:
|
||||
|
Loading…
Reference in New Issue
Block a user