MSVC 2013: Work around another compiler bug with array init.

This commit is contained in:
Hans-Kristian Arntzen 2019-07-09 15:31:01 +02:00
parent 53ab2144b9
commit 909040e2eb
2 changed files with 7 additions and 1 deletions

View File

@ -776,6 +776,10 @@ string CompilerMSL::compile()
capture_output_to_buffer = msl_options.capture_output_to_buffer;
is_rasterization_disabled = msl_options.disable_rasterization || capture_output_to_buffer;
// Initialize array here rather than constructor, MSVC 2013 workaround.
for (auto &id : next_metal_resource_ids)
id = 0;
fixup_type_alias();
replace_illegal_names();

View File

@ -593,10 +593,12 @@ protected:
};
std::unordered_map<StageSetBinding, std::pair<MSLResourceBinding, bool>, InternalHasher> resource_bindings;
uint32_t next_metal_resource_index_buffer = 0;
uint32_t next_metal_resource_index_texture = 0;
uint32_t next_metal_resource_index_sampler = 0;
uint32_t next_metal_resource_ids[kMaxArgumentBuffers] = {};
// Intentionally uninitialized, works around MSVC 2013 bug.
uint32_t next_metal_resource_ids[kMaxArgumentBuffers];
uint32_t stage_in_var_id = 0;
uint32_t stage_out_var_id = 0;