Rearranged all 'UE Change' comments to match to project's coding style.
This commit is contained in:
parent
137e9d6d98
commit
50ac6862ac
@ -2718,12 +2718,11 @@ void Compiler::AnalyzeVariableScopeAccessHandler::notify_variable_access(uint32_
|
||||
if (id == 0)
|
||||
return;
|
||||
|
||||
/* UE Change Begin: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
// Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers.
|
||||
for (auto child_id : access_chain_children[id])
|
||||
{
|
||||
notify_variable_access(child_id, block);
|
||||
}
|
||||
/* UE Change End: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
|
||||
if (id_is_phi_variable(id))
|
||||
accessed_variables_to_block[id].insert(block);
|
||||
@ -2789,7 +2788,7 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3
|
||||
if (length < 3)
|
||||
return false;
|
||||
|
||||
/* UE Change Begin: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
// Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers.
|
||||
uint32_t ptr = args[2];
|
||||
auto *var = compiler.maybe_get<SPIRVariable>(ptr);
|
||||
if (var)
|
||||
@ -2804,7 +2803,6 @@ bool Compiler::AnalyzeVariableScopeAccessHandler::handle(spv::Op op, const uint3
|
||||
notify_variable_access(args[i], current_block->self);
|
||||
access_chain_children[args[1]].insert(args[i]);
|
||||
}
|
||||
/* UE Change End: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
|
||||
// Also keep track of the access chain pointer itself.
|
||||
// In exceptionally rare cases, we can end up with a case where
|
||||
@ -3914,7 +3912,7 @@ void Compiler::CombinedImageSamplerUsageHandler::add_hierarchy_to_comparison_ids
|
||||
// Traverse the variable dependency hierarchy and tag everything in its path with comparison ids.
|
||||
comparison_ids.insert(id);
|
||||
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
// If the underlying resource has been used for comparison then duplicate loads of that resource must be too.
|
||||
if (!compiler.supports_combined_samplers())
|
||||
{
|
||||
for (auto it = dependency_hierarchy.begin(); it != dependency_hierarchy.end(); ++it)
|
||||
@ -3923,13 +3921,12 @@ void Compiler::CombinedImageSamplerUsageHandler::add_hierarchy_to_comparison_ids
|
||||
comparison_ids.insert(it->first);
|
||||
}
|
||||
}
|
||||
/* UE Change End: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
|
||||
for (auto &dep_id : dependency_hierarchy[id])
|
||||
add_hierarchy_to_comparison_ids(dep_id);
|
||||
}
|
||||
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
// If the underlying resource has been used for comparison then duplicate loads of that resource must be too.
|
||||
bool Compiler::CombinedImageSamplerUsageHandler::dependent_used_for_comparison(uint32_t id) const
|
||||
{
|
||||
if (compiler.supports_combined_samplers())
|
||||
@ -3947,7 +3944,6 @@ bool Compiler::CombinedImageSamplerUsageHandler::dependent_used_for_comparison(u
|
||||
|
||||
return false;
|
||||
}
|
||||
/* UE Change End: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
|
||||
bool Compiler::CombinedImageSamplerUsageHandler::handle(Op opcode, const uint32_t *args, uint32_t length)
|
||||
{
|
||||
@ -3983,7 +3979,7 @@ bool Compiler::CombinedImageSamplerUsageHandler::handle(Op opcode, const uint32_
|
||||
uint32_t result_id = args[1];
|
||||
auto &type = compiler.get<SPIRType>(result_type);
|
||||
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
// If the underlying resource has been used for comparison then duplicate loads of that resource must be too.
|
||||
// This image must be a depth image.
|
||||
uint32_t image = args[2];
|
||||
uint32_t sampler = args[3];
|
||||
@ -4000,7 +3996,6 @@ bool Compiler::CombinedImageSamplerUsageHandler::handle(Op opcode, const uint32_
|
||||
// Mark the OpSampledImage itself as being comparison state.
|
||||
comparison_ids.insert(result_id);
|
||||
}
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -883,10 +883,9 @@ protected:
|
||||
void add_hierarchy_to_comparison_ids(uint32_t ids);
|
||||
bool need_subpass_input = false;
|
||||
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
// If the underlying resource has been used for comparison then duplicate loads of that resource must be too.
|
||||
// Returns true if a dependent resource in the dependency hierarchy of the specified image or sampler has been used for comparison.
|
||||
bool dependent_used_for_comparison(uint32_t id) const;
|
||||
/* UE Change End: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
};
|
||||
|
||||
void build_function_control_flow_graphs_and_analyze();
|
||||
@ -923,9 +922,8 @@ protected:
|
||||
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> complete_write_variables_to_block;
|
||||
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> partial_write_variables_to_block;
|
||||
std::unordered_set<uint32_t> access_chain_expressions;
|
||||
/* UE Change Begin: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
// Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers.
|
||||
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> access_chain_children;
|
||||
/* UE Change End: Access chains used in multiple blocks mean hoisting all the variables used to construct the access chain as not all backends can use pointers. */
|
||||
const SPIRBlock *current_block = nullptr;
|
||||
};
|
||||
|
||||
|
@ -324,9 +324,8 @@ void CompilerGLSL::reset()
|
||||
forwarded_temporaries.clear();
|
||||
suppressed_usage_tracking.clear();
|
||||
|
||||
/* UE Change Begin: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
// Ensure that we declare phi-variable copies even if the original declaration isn't deferred
|
||||
flushed_phi_variables.clear();
|
||||
/* UE Change End: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
|
||||
reset_name_caches();
|
||||
|
||||
@ -337,8 +336,8 @@ void CompilerGLSL::reset()
|
||||
|
||||
ir.for_each_typed_id<SPIRVariable>([&](uint32_t, SPIRVariable &var) { var.dependees.clear(); });
|
||||
|
||||
/* UE Change Begin: Track write-throughs for loop variables - dxc likes to generate them */
|
||||
/* UE Change End: Track write-throughs for loop variables - dxc likes to generate them */
|
||||
// Track write-throughs for loop variables - dxc likes to generate them
|
||||
|
||||
ir.reset_all_of_type<SPIRAccessChain>();
|
||||
|
||||
statement_count = 0;
|
||||
@ -3347,7 +3346,7 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c)
|
||||
{
|
||||
// Handles Arrays and structures.
|
||||
string res;
|
||||
/* UE Change Begin: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
// Allow Metal to use the array<T> template to make arrays a value type
|
||||
bool bTrailingBracket = false;
|
||||
if (backend.use_initializer_list && backend.use_typed_initializer_list && type.basetype == SPIRType::Struct &&
|
||||
type.array.empty())
|
||||
@ -3384,7 +3383,6 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c)
|
||||
res += backend.use_initializer_list ? " }" : ")";
|
||||
if (bTrailingBracket)
|
||||
res += ")";
|
||||
/* UE Change End: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -3970,7 +3968,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
}
|
||||
break;
|
||||
|
||||
/* UE Change Begin: Metal tessellation likes empty structs which are then constant expressions. */
|
||||
// Metal tessellation likes empty structs which are then constant expressions.
|
||||
case SPIRType::Struct:
|
||||
if (type.member_types.size() == 0)
|
||||
{
|
||||
@ -3981,7 +3979,6 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
|
||||
SPIRV_CROSS_THROW("Invalid constant struct initialisation missing member initializers.");
|
||||
}
|
||||
break;
|
||||
/* UE Change End: Metal tessellation likes empty structs which are then constant expressions. */
|
||||
|
||||
default:
|
||||
SPIRV_CROSS_THROW("Invalid constant expression basetype.");
|
||||
@ -7444,7 +7441,7 @@ string CompilerGLSL::variable_decl_function_local(SPIRVariable &var)
|
||||
|
||||
void CompilerGLSL::emit_variable_temporary_copies(const SPIRVariable &var)
|
||||
{
|
||||
/* UE Change Begin: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
// Ensure that we declare phi-variable copies even if the original declaration isn't deferred
|
||||
if (var.allocate_temporary_copy && flushed_phi_variables.find(var.self) == flushed_phi_variables.end())
|
||||
{
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
@ -7452,12 +7449,11 @@ void CompilerGLSL::emit_variable_temporary_copies(const SPIRVariable &var)
|
||||
statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, join("_", var.self, "_copy")), ";");
|
||||
flushed_phi_variables.insert(var.self);
|
||||
}
|
||||
/* UE Change End: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
}
|
||||
|
||||
void CompilerGLSL::flush_variable_declaration(uint32_t id)
|
||||
{
|
||||
/* UE Change Begin: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
// Ensure that we declare phi-variable copies even if the original declaration isn't deferred
|
||||
auto *var = maybe_get<SPIRVariable>(id);
|
||||
if (var && var->deferred_declaration)
|
||||
{
|
||||
@ -7468,7 +7464,6 @@ void CompilerGLSL::flush_variable_declaration(uint32_t id)
|
||||
{
|
||||
emit_variable_temporary_copies(*var);
|
||||
}
|
||||
/* UE Change End: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
}
|
||||
|
||||
bool CompilerGLSL::remove_duplicate_swizzle(string &op)
|
||||
|
@ -340,15 +340,11 @@ protected:
|
||||
|
||||
Options options;
|
||||
|
||||
/* UE Change Begin: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
virtual std::string type_to_array_glsl(const SPIRType &type);
|
||||
/* UE Change End: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
virtual std::string type_to_array_glsl(const SPIRType &type); // Allow Metal to use the array<T> template to make arrays a value type
|
||||
std::string to_array_size(const SPIRType &type, uint32_t index);
|
||||
uint32_t to_array_size_literal(const SPIRType &type, uint32_t index) const;
|
||||
uint32_t to_array_size_literal(const SPIRType &type) const;
|
||||
/* UE Change Begin: Threadgroup arrays can't have a wrapper type */
|
||||
virtual std::string variable_decl(const SPIRVariable &variable);
|
||||
/* UE Change End: Threadgroup arrays can't have a wrapper type */
|
||||
virtual std::string variable_decl(const SPIRVariable &variable); // Threadgroup arrays can't have a wrapper type
|
||||
std::string variable_decl_function_local(SPIRVariable &variable);
|
||||
|
||||
void add_local_variable_name(uint32_t id);
|
||||
@ -493,10 +489,9 @@ protected:
|
||||
SPIRExpression &emit_op(uint32_t result_type, uint32_t result_id, const std::string &rhs, bool forward_rhs,
|
||||
bool suppress_usage_tracking = false);
|
||||
|
||||
/* UE Change Begin: Storage buffer robustness */
|
||||
// Storage buffer robustness
|
||||
virtual std::string access_chain_internal(uint32_t base, const uint32_t *indices, uint32_t count, AccessChainFlags flags,
|
||||
AccessChainMeta *meta);
|
||||
/* UE Change End: Storage buffer robustness */
|
||||
|
||||
std::string access_chain(uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type,
|
||||
AccessChainMeta *meta = nullptr, bool ptr_chain = false);
|
||||
@ -531,9 +526,10 @@ protected:
|
||||
std::string to_unpacked_expression(uint32_t id, bool register_expression_read = true);
|
||||
std::string to_unpacked_row_major_matrix_expression(uint32_t id);
|
||||
std::string to_enclosed_unpacked_expression(uint32_t id, bool register_expression_read = true);
|
||||
/* UE Change Begin: Metal expands float[]/float2[] members inside structs to float4[] so we must unpack */
|
||||
|
||||
// Metal expands float[]/float2[] members inside structs to float4[] so we must unpack
|
||||
virtual std::string to_dereferenced_expression(uint32_t id, bool register_expression_read = true);
|
||||
/* UE Change End: Metal expands float[]/float2[] members inside structs to float4[] so we must unpack */
|
||||
|
||||
std::string to_pointer_expression(uint32_t id, bool register_expression_read = true);
|
||||
std::string to_enclosed_pointer_expression(uint32_t id, bool register_expression_read = true);
|
||||
std::string to_extract_component_expression(uint32_t id, uint32_t index);
|
||||
@ -594,9 +590,9 @@ protected:
|
||||
uint32_t indent = 0;
|
||||
|
||||
std::unordered_set<uint32_t> emitted_functions;
|
||||
/* UE Change Begin: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
|
||||
// Ensure that we declare phi-variable copies even if the original declaration isn't deferred
|
||||
std::unordered_set<uint32_t> flushed_phi_variables;
|
||||
/* UE Change End: Ensure that we declare phi-variable copies even if the original declaration isn't deferred */
|
||||
|
||||
std::unordered_set<uint32_t> flattened_buffer_blocks;
|
||||
std::unordered_set<uint32_t> flattened_structs;
|
||||
|
443
spirv_msl.cpp
443
spirv_msl.cpp
File diff suppressed because it is too large
Load Diff
104
spirv_msl.hpp
104
spirv_msl.hpp
@ -253,10 +253,10 @@ public:
|
||||
macOS = 1
|
||||
} Platform;
|
||||
|
||||
/* UE Change Begin: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
// Provide the Metal bindings as part of the options structure as that is more convenient.
|
||||
std::vector<MSLVertexAttr> vtx_attrs;
|
||||
std::vector<MSLResourceBinding> res_bindings;
|
||||
/* UE Change End: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
|
||||
Platform platform = macOS;
|
||||
uint32_t msl_version = make_msl_version(1, 2);
|
||||
uint32_t texel_buffer_texture_width = 4096; // Width of 2D Metal textures used as 1D texel buffers
|
||||
@ -269,9 +269,7 @@ public:
|
||||
uint32_t view_mask_buffer_index = 24;
|
||||
uint32_t shader_input_wg_index = 0;
|
||||
uint32_t device_index = 0;
|
||||
/* UE Change Begin: Allow the caller to specify the Metal translation should use argument buffers */
|
||||
uint32_t argument_buffer_offset = 0;
|
||||
/* UE Change End: Allow the caller to specify the Metal translation should use argument buffers */
|
||||
uint32_t argument_buffer_offset = 0; // Allow the caller to specify the Metal translation should use argument buffers
|
||||
bool enable_point_size_builtin = true;
|
||||
bool disable_rasterization = false;
|
||||
bool capture_output_to_buffer = false;
|
||||
@ -288,26 +286,14 @@ public:
|
||||
// Fragment output in MSL must have at least as many components as the render pass.
|
||||
// Add support to explicit pad out components.
|
||||
bool pad_fragment_output_components = false;
|
||||
/* UE Change Begin: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
bool ios_support_base_vertex_instance = false;
|
||||
/* UE Change End: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
/* UE Change Begin: Use Metal's native frame-buffer fetch API for subpass inputs. */
|
||||
bool ios_use_framebuffer_fetch_subpasses = true;
|
||||
/* UE Change End: Use Metal's native frame-buffer fetch API for subpass inputs. */
|
||||
|
||||
/* UE Change Begin: Storage buffer robustness - clamps access to SSBOs to the size of the buffer */
|
||||
bool enforce_storge_buffer_bounds = false;
|
||||
/* UE Change End: Storage buffer robustness - clamps access to SSBOs to the size of the buffer */
|
||||
bool ios_support_base_vertex_instance = false; // Provide the Metal bindings as part of the options structure as that is more convenient.
|
||||
bool ios_use_framebuffer_fetch_subpasses = true; // Use Metal's native frame-buffer fetch API for subpass inputs.
|
||||
bool enforce_storge_buffer_bounds = false; // Storage buffer robustness - clamps access to SSBOs to the size of the buffer
|
||||
|
||||
bool invariant_float_math = false;
|
||||
|
||||
/* UE Change Begin: Emulate texturecube_array with texture2d_array for iOS where this type is not available */
|
||||
bool emulate_cube_array = false;
|
||||
/* UE Change End: Emulate texturecube_array with texture2d_array for iOS where this type is not available */
|
||||
|
||||
/* UE Change Begin: Allow user to enable decoration binding */
|
||||
bool enable_decoration_binding = false;
|
||||
/* UE Change End: Allow user to enable decoration binding */
|
||||
bool emulate_cube_array = false; // Emulate texturecube_array with texture2d_array for iOS where this type is not available
|
||||
bool enable_decoration_binding = false; // Allow user to enable decoration binding
|
||||
|
||||
// Requires MSL 2.1, use the native support for texel buffers.
|
||||
bool texture_buffer_native = false;
|
||||
@ -347,7 +333,7 @@ public:
|
||||
{
|
||||
msl_options = opts;
|
||||
|
||||
/* UE Change Begin: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
// Provide the Metal bindings as part of the options structure as that is more convenient.
|
||||
for (auto &va : msl_options.vtx_attrs)
|
||||
vtx_attrs_by_location[va.location] = va;
|
||||
|
||||
@ -358,7 +344,6 @@ public:
|
||||
std::pair<MSLResourceBinding, bool>(rb, true)
|
||||
});
|
||||
}
|
||||
/* UE Change End: Provide the Metal bindings as part of the options structure as that is more convenient. */
|
||||
}
|
||||
|
||||
// Provide feedback to calling API to allow runtime to disable pipeline
|
||||
@ -517,18 +502,12 @@ protected:
|
||||
SPVFuncImplArrayOfArrayCopy5Dim = SPVFuncImplArrayCopyMultidimBase + 5,
|
||||
SPVFuncImplArrayOfArrayCopy6Dim = SPVFuncImplArrayCopyMultidimBase + 6,
|
||||
SPVFuncImplTexelBufferCoords,
|
||||
/* UE Change Begin: Emulate texture2D atomic operations */
|
||||
SPVFuncImplImage2DAtomicCoords,
|
||||
/* UE Change End: Emulate texture2D atomic operations */
|
||||
/* UE Change Begin: Storage buffer robustness */
|
||||
SPVFuncImplStorageBufferCoords,
|
||||
/* UE Change End: Storage buffer robustness */
|
||||
/* UE Change Begin: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
SPVFuncImplImage2DAtomicCoords, // Emulate texture2D atomic operations
|
||||
SPVFuncImplStorageBufferCoords, // Storage buffer robustness
|
||||
SPVFuncImplFMul,
|
||||
SPVFuncImplFAdd,
|
||||
SPVFuncImplCubemapTo2DArrayFace,
|
||||
SPVFuncImplUnsafeArray,
|
||||
/* UE Change End: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
SPVFuncImplUnsafeArray, // Allow Metal to use the array<T> template to make arrays a value type
|
||||
SPVFuncImplInverse4x4,
|
||||
SPVFuncImplInverse3x3,
|
||||
SPVFuncImplInverse2x2,
|
||||
@ -579,11 +558,9 @@ protected:
|
||||
SPVFuncImplArrayCopyMultidimMax = 6
|
||||
};
|
||||
|
||||
/* UE Change Begin: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
/* UE Change Begin: Use Metal's native frame-buffer fetch API for subpass inputs. */
|
||||
// If the underlying resource has been used for comparison then duplicate loads of that resource must be too
|
||||
// Use Metal's native frame-buffer fetch API for subpass inputs.
|
||||
void emit_texture_op(const Instruction &i) override;
|
||||
/* UE Change End: Use Metal's native frame-buffer fetch API for subpass inputs. */
|
||||
/* UE Change End: If the underlying resource has been used for comparison then duplicate loads of that resource must be too */
|
||||
void emit_binary_unord_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op);
|
||||
void emit_instruction(const Instruction &instr) override;
|
||||
void emit_glsl_op(uint32_t result_type, uint32_t result_id, uint32_t op, const uint32_t *args,
|
||||
@ -603,12 +580,8 @@ protected:
|
||||
const std::string &qualifier = "", uint32_t base_offset = 0) override;
|
||||
void emit_struct_padding_target(const SPIRType &type) override;
|
||||
std::string type_to_glsl(const SPIRType &type, uint32_t id = 0) override;
|
||||
/* UE Change Begin: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
std::string type_to_array_glsl(const SPIRType &type) override;
|
||||
/* UE Change End: Allow Metal to use the array<T> template to make arrays a value type */
|
||||
/* UE Change Begin: Threadgroup arrays can't have a wrapper type */
|
||||
std::string variable_decl(const SPIRVariable &variable) override;
|
||||
/* UE Change End: Threadgroup arrays can't have a wrapper type */
|
||||
std::string type_to_array_glsl(const SPIRType &type) override; // Allow Metal to use the array<T> template to make arrays a value type
|
||||
std::string variable_decl(const SPIRVariable &variable) override; // Threadgroup arrays can't have a wrapper type
|
||||
std::string image_type_glsl(const SPIRType &type, uint32_t id = 0) override;
|
||||
std::string sampler_type(const SPIRType &type);
|
||||
std::string builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage) override;
|
||||
@ -622,9 +595,10 @@ protected:
|
||||
uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,
|
||||
uint32_t comp, uint32_t sample, uint32_t minlod, bool *p_forward) override;
|
||||
std::string to_initializer_expression(const SPIRVariable &var) override;
|
||||
/* UE Change Begin: Metal expands float[]/float2[] members inside structs to float4[] so we must unpack */
|
||||
|
||||
// Metal expands float[]/float2[] members inside structs to float4[] so we must unpack
|
||||
virtual std::string to_dereferenced_expression(uint32_t id, bool register_expression_read = true) override;
|
||||
/* UE Change End: Metal expands float[]/float2[] members inside structs to float4[] so we must unpack */
|
||||
|
||||
std::string unpack_expression_type(std::string expr_str, const SPIRType &type, uint32_t physical_type_id,
|
||||
bool is_packed, bool row_major) override;
|
||||
|
||||
@ -635,17 +609,19 @@ protected:
|
||||
void replace_illegal_names() override;
|
||||
void declare_undefined_values() override;
|
||||
void declare_constant_arrays();
|
||||
/* UE Change Begin: Constant arrays of non-primitive types (i.e. matrices) won't link properly into Metal libraries */
|
||||
|
||||
// Constant arrays of non-primitive types (i.e. matrices) won't link properly into Metal libraries
|
||||
void declare_complex_constant_arrays();
|
||||
/* UE Change End: Constant arrays of non-primitive types (i.e. matrices) won't link properly into Metal libraries */
|
||||
|
||||
bool is_patch_block(const SPIRType &type);
|
||||
bool is_non_native_row_major_matrix(uint32_t id) override;
|
||||
bool member_is_non_native_row_major_matrix(const SPIRType &type, uint32_t index) override;
|
||||
std::string convert_row_major_matrix(std::string exp_str, const SPIRType &exp_type, uint32_t physical_type_id,
|
||||
bool is_packed) override;
|
||||
/* UE Change Begin: Storage buffer robustness */
|
||||
|
||||
// Storage buffer robustness
|
||||
std::string access_chain_internal(uint32_t base, const uint32_t *indices, uint32_t count, AccessChainFlags flags, AccessChainMeta *meta) override;
|
||||
/* UE Change End: Storage buffer robustness */
|
||||
|
||||
void preprocess_op_codes();
|
||||
void localize_global_variables();
|
||||
void extract_global_variables_from_functions();
|
||||
@ -828,19 +804,13 @@ protected:
|
||||
uint32_t patch_stage_out_var_id = 0;
|
||||
uint32_t stage_in_ptr_var_id = 0;
|
||||
uint32_t stage_out_ptr_var_id = 0;
|
||||
/* UE Change Begin: Handle HLSL-style 0-based vertex/instance index. */
|
||||
int32_t needs_base_vertex_arg = 0;
|
||||
int32_t needs_base_instance_arg = 0;
|
||||
/* UE Change End: Handle HLSL-style 0-based vertex/instance index. */
|
||||
int32_t needs_base_vertex_arg = 0; // Handle HLSL-style 0-based vertex/instance index.
|
||||
int32_t needs_base_instance_arg = 0; // Handle HLSL-style 0-based vertex/instance index.
|
||||
bool has_sampled_images = false;
|
||||
bool needs_vertex_idx_arg = false;
|
||||
bool needs_instance_idx_arg = false;
|
||||
/* UE Change Begin: Handle HLSL-style 0-based vertex/instance index. */
|
||||
bool builtin_declaration = false;
|
||||
/* UE Change End: Handle HLSL-style 0-based vertex/instance index. */
|
||||
/* UE Change Begin: Force the use of C style array declaration. */
|
||||
bool use_builtin_array = false;
|
||||
/* UE Change End: Force the use of C style array declaration. */
|
||||
bool builtin_declaration = false; // Handle HLSL-style 0-based vertex/instance index.
|
||||
bool use_builtin_array = false; // Force the use of C style array declaration.
|
||||
bool is_rasterization_disabled = false;
|
||||
bool capture_output_to_buffer = false;
|
||||
bool needs_swizzle_buffer_def = false;
|
||||
@ -869,9 +839,7 @@ protected:
|
||||
|
||||
std::unordered_set<uint32_t> buffers_requiring_array_length;
|
||||
SmallVector<uint32_t> buffer_arrays;
|
||||
/* UE Change Begin: Emulate texture2D atomic operations */
|
||||
std::set<SPIRVariable *> atomic_vars;
|
||||
/* UE Change End: Emulate texture2D atomic operations */
|
||||
std::set<SPIRVariable *> atomic_vars; // Emulate texture2D atomic operations
|
||||
|
||||
uint32_t argument_buffer_ids[kMaxArgumentBuffers];
|
||||
uint32_t argument_buffer_discrete_mask = 0;
|
||||
@ -899,14 +867,10 @@ protected:
|
||||
|
||||
CompilerMSL &compiler;
|
||||
std::unordered_map<uint32_t, uint32_t> result_types;
|
||||
/* UE Change Begin: Emulate texture2D atomic operations */
|
||||
std::unordered_map<uint32_t, SPIRVariable*> image_pointers;
|
||||
/* UE Change End: Emulate texture2D atomic operations */
|
||||
/* UE Change Begin: Fix tessellation patch function processing */
|
||||
std::unordered_map<uint32_t, uint32_t> invocation_ids;
|
||||
std::unordered_set<uint32_t> variables_indexed_by_invocation;
|
||||
bool passed_control_barrier = false;
|
||||
/* UE Change End: Fix tessellation patch function processing */
|
||||
std::unordered_map<uint32_t, SPIRVariable*> image_pointers; // Emulate texture2D atomic operations
|
||||
std::unordered_map<uint32_t, uint32_t> invocation_ids; // Fix tessellation patch function processing
|
||||
std::unordered_set<uint32_t> variables_indexed_by_invocation; // Fix tessellation patch function processing
|
||||
bool passed_control_barrier = false; // Fix tessellation patch function processing
|
||||
bool suppress_missing_prototypes = false;
|
||||
bool uses_atomics = false;
|
||||
bool uses_resource_write = false;
|
||||
|
Loading…
Reference in New Issue
Block a user