Fix some issues on certain compilers.

This commit is contained in:
Hans-Kristian Arntzen 2019-09-06 10:11:18 +02:00
parent f1e0dd9a5c
commit 1935f1a8e3
2 changed files with 12 additions and 4 deletions

View File

@ -1093,7 +1093,9 @@ static int main_inner(int argc, char *argv[])
cbs.add("--msl-dispatch-base", [&args](CLIParser &) { args.msl_dispatch_base = true; });
cbs.add("--msl-dynamic-buffer", [&args](CLIParser &parser) {
args.msl_argument_buffers = true;
args.msl_dynamic_buffers.push_back(make_pair(parser.next_uint(), parser.next_uint()));
uint32_t desc_set = parser.next_uint();
uint32_t binding = parser.next_uint();
args.msl_dynamic_buffers.push_back(make_pair(desc_set, binding));
});
cbs.add("--extension", [&args](CLIParser &parser) { args.extensions.push_back(parser.next_string()); });
cbs.add("--rename-entry-point", [&args](CLIParser &parser) {

View File

@ -805,15 +805,21 @@ void CompilerMSL::emit_entry_point_declarations()
}
// Emit dynamic buffers here.
for (auto &buffer : buffers_requiring_dynamic_offset)
for (auto &dynamic_buffer : buffers_requiring_dynamic_offset)
{
const auto &var = get<SPIRVariable>(buffer.second.second);
if (!dynamic_buffer.second.second)
{
// Could happen if no buffer was used at requested binding point.
continue;
}
const auto &var = get<SPIRVariable>(dynamic_buffer.second.second);
uint32_t var_id = var.self;
const auto &type = get_variable_data_type(var);
string name = to_name(var.self);
uint32_t desc_set = get_decoration(var.self, DecorationDescriptorSet);
uint32_t arg_id = argument_buffer_ids[desc_set];
uint32_t base_index = buffer.second.first;
uint32_t base_index = dynamic_buffer.second.first;
if (!type.array.empty())
{