diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 6453a838..6f11b40d 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -278,24 +278,16 @@ void CompilerMSL::build_implicit_builtins() SPIRType struct_type; struct_type.basetype = SPIRType::Struct; - if (msl_options.aux_buffer_features.vertex_count) - struct_type.member_types.push_back(type_id); // Vertex count - if (msl_options.aux_buffer_features.swizzle_const) - struct_type.member_types.push_back(type_arr_id); // Swizzle constants + struct_type.member_types.push_back(type_id); // Vertex count + struct_type.member_types.push_back(type_arr_id); // Swizzle constants auto &type = set(struct_id, struct_type); type.self = struct_id; set_decoration(struct_id, DecorationBlock); set_name(struct_id, "spvAux"); - if (msl_options.aux_buffer_features.vertex_count) - { - set_member_name(struct_id, k_aux_mbr_idx_vertex_count, "vertexCount"); - set_member_decoration(struct_id, k_aux_mbr_idx_vertex_count, DecorationOffset, 0); - } - if (msl_options.aux_buffer_features.swizzle_const) - { - set_member_name(struct_id, k_aux_mbr_idx_swizzle_const, "swizzleConst"); - set_member_decoration(struct_id, k_aux_mbr_idx_swizzle_const, DecorationOffset, 4); - } + set_member_name(struct_id, k_aux_mbr_idx_vertex_count, "vertexCount"); + set_member_decoration(struct_id, k_aux_mbr_idx_vertex_count, DecorationOffset, 0); + set_member_name(struct_id, k_aux_mbr_idx_swizzle_const, "swizzleConst"); + set_member_decoration(struct_id, k_aux_mbr_idx_swizzle_const, DecorationOffset, 4); SPIRType struct_type_ptr = struct_type; struct_type_ptr.pointer = true; @@ -1522,8 +1514,6 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage) // copying that to the output buffer, we'll declare the output variable // as a reference to the final output element in the buffer. Then we can // avoid the extra copy. - if (!msl_options.aux_buffer_features.vertex_count) - SPIRV_CROSS_THROW("Capturing vertex output to a buffer requires the vertexCount feature."); entry_func.fixup_hooks_in.push_back([=]() { auto &aux_type = expression_type(aux_buffer_id); statement("device ", to_name(ir.default_entry_point), "_", ib_var_ref, "& ", ib_var_ref, " = ", @@ -4802,8 +4792,6 @@ void CompilerMSL::fix_up_shader_inputs_outputs() { if (msl_options.swizzle_texture_samples && has_sampled_images && is_sampled_image_type(type)) { - if (!msl_options.aux_buffer_features.swizzle_const) - SPIRV_CROSS_THROW("Swizzling sampled values from images requires the swizzleConst feature."); auto &entry_func = this->get(ir.default_entry_point); entry_func.fixup_hooks_in.push_back([this, &var, var_id]() { auto &aux_type = expression_type(aux_buffer_id); diff --git a/spirv_msl.hpp b/spirv_msl.hpp index b9fd42fb..f1b854cd 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -147,6 +147,10 @@ static const uint32_t kPushConstDescSet = ~(0u); // element to indicate the bindings for the push constants. static const uint32_t kPushConstBinding = 0; +// The current version of the aux buffer structure. It must be incremented any time a +// new field is added to the aux buffer. +#define SPIRV_CROSS_MSL_AUX_BUFFER_STRUCT_VERSION 2 + // Decompiles SPIR-V to Metal Shading Language class CompilerMSL : public CompilerGLSL { @@ -174,15 +178,6 @@ public: // Add support to explicit pad out components. bool pad_fragment_output_components = false; - // The current version of this structure. It must be incremented any time a - // new field is added to the aux buffer. -#define SPIRV_CROSS_MSL_AUX_BUFFER_STRUCT_VERSION 2 - struct AuxBufferFeatures - { - bool vertex_count = true; - bool swizzle_const = true; - } aux_buffer_features; - bool is_ios() { return platform == iOS;