Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-10-03 14:32:07 +0300
committerGitHub <noreply@github.com>2022-10-03 14:32:07 +0300
commitf15d465a52bd2e90d1b38e00016e508ca4185d2d (patch)
tree92fa41247b59d31eb3f0f57b0c3550f630c0c8f7
parent799d8c9e35ae75bad9af4e68bd600b5583f433be (diff)
parent4ecdb24e597b43708d86087d697bbf9fbc7f4627 (diff)
Merge pull request #2034 from KhronosGroup/fix-2028
MSL: Expose way to query if a buffer needs array length.
-rw-r--r--spirv_msl.cpp10
-rw-r--r--spirv_msl.hpp5
2 files changed, 10 insertions, 5 deletions
diff --git a/spirv_msl.cpp b/spirv_msl.cpp
index f870444e..b974b669 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -856,7 +856,7 @@ void CompilerMSL::build_implicit_builtins()
swizzle_buffer_id = var_id;
}
- if (!buffers_requiring_array_length.empty())
+ if (needs_buffer_size_buffer())
{
uint32_t var_id = build_constant_uint_array_pointer();
set_name(var_id, "spvBufferSizeConstants");
@@ -10021,7 +10021,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &)
decl += join(", constant uint", arg_is_array ? "* " : "& ", to_swizzle_expression(arg.id));
}
- if (buffers_requiring_array_length.count(name_id))
+ if (buffer_requires_array_length(name_id))
{
bool arg_is_array = !arg_type.array.empty();
decl += join(", constant uint", arg_is_array ? "* " : "& ", to_buffer_size_expression(name_id));
@@ -11058,7 +11058,7 @@ string CompilerMSL::to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_
else if (msl_options.swizzle_texture_samples && has_sampled_images && is_sampled_image_type(type))
arg_str += ", " + to_swizzle_expression(var_id ? var_id : id);
- if (buffers_requiring_array_length.count(var_id))
+ if (buffer_requires_array_length(var_id))
arg_str += ", " + to_buffer_size_expression(var_id ? var_id : id);
if (is_dynamic_img_sampler)
@@ -12767,7 +12767,7 @@ void CompilerMSL::fix_up_shader_inputs_outputs()
else if ((var.storage == StorageClassStorageBuffer || (var.storage == StorageClassUniform && ssbo)) &&
!is_hidden_variable(var))
{
- if (buffers_requiring_array_length.count(var.self))
+ if (buffer_requires_array_length(var.self))
{
entry_func.fixup_hooks_in.push_back([this, &type, &var, var_id]() {
bool is_array_type = !type.array.empty();
@@ -16710,7 +16710,7 @@ void CompilerMSL::analyze_argument_buffers()
// Check if this descriptor set needs a swizzle buffer.
if (needs_swizzle_buffer_def && is_sampled_image_type(type))
set_needs_swizzle_buffer[desc_set] = true;
- else if (buffers_requiring_array_length.count(var_id) != 0)
+ else if (buffer_requires_array_length(var_id))
{
set_needs_buffer_sizes[desc_set] = true;
needs_buffer_sizes = true;
diff --git a/spirv_msl.hpp b/spirv_msl.hpp
index 1a7ee5c0..a848f9b5 100644
--- a/spirv_msl.hpp
+++ b/spirv_msl.hpp
@@ -504,6 +504,11 @@ public:
return !buffers_requiring_array_length.empty();
}
+ bool buffer_requires_array_length(VariableID id) const
+ {
+ return buffers_requiring_array_length.count(id) != 0;
+ }
+
// Provide feedback to calling API to allow it to pass a buffer
// containing the view mask for the current multiview subpass.
bool needs_view_mask_buffer() const