Merge pull request #1065 from KhronosGroup/msvc-2013-workaround

MSVC 2013: Work around another compiler bug with array init.
This commit is contained in:
Hans-Kristian Arntzen 2019-07-09 17:25:30 +02:00 committed by GitHub
commit 8aa6731925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;