Commit 80351602 authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund

microsoft/clc: Use kernel input variable locations instead of a loop counter

parent 44307792
......@@ -1265,9 +1265,13 @@ clc_to_dxil(struct clc_context *ctx,
}
// Calculate input offsets/metadata.
unsigned i = 0, uav_id = 0, sampler_id = 0, offset = 0;
unsigned uav_id = 0, sampler_id = 0, offset = 0;
dxil_wrap_sampler_state int_sampler_states[PIPE_MAX_SHADER_SAMPLER_VIEWS] = {{{0}}};
nir_foreach_variable(var, &nir->inputs) {
int i = var->data.location;
if (i < 0)
continue;
unsigned size = glsl_get_cl_size(var->type);
offset = align(offset, glsl_get_cl_alignment(var->type));
var->data.driver_location = offset;
......@@ -1292,16 +1296,16 @@ clc_to_dxil(struct clc_context *ctx,
conf ? conf->args[i].sampler.linear_filtering : 0;
metadata->args[i].sampler.sampler_id = var->data.binding = sampler_id++;
}
i++;
offset += size;
}
assert(i == dxil->kernel->num_args);
// Second pass over inputs to calculate image bindings
unsigned srv_id = 0;
i = 0;
nir_foreach_variable(var, &nir->inputs) {
int i = var->data.location;
if (i < 0)
continue;
if (glsl_type_is_image(var->type)) {
if (var->data.access == ACCESS_NON_WRITEABLE) {
metadata->args[i].image.buf_ids[0] = srv_id++;
......@@ -1313,7 +1317,6 @@ clc_to_dxil(struct clc_context *ctx,
metadata->args[i].image.num_buf_ids = 1;
var->data.binding = metadata->args[i].image.buf_ids[0];
}
i++;
}
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment