make dynamic uniforms work in metal (kinda)
This commit is contained in:
@@ -19,8 +19,10 @@ gnUniform* allocateMetalUniforms(gnUniformPool pool, const gnUniformAllocationIn
|
||||
|
||||
for (int c = 0; c < allocInfo.sets[i].uniformBindingCount; c++) {
|
||||
gnUniformBinding binding = allocInfo.sets[i].uniformBindings[c];
|
||||
if (binding.type == GN_UNIFORM_BUFFER_DESCRIPTOR ||
|
||||
binding.type == GN_SHADER_STORE_BUFFER_DESCRIPTOR) {
|
||||
switch (binding.type) {
|
||||
case GN_UNIFORM_BUFFER_DESCRIPTOR:
|
||||
case GN_DYNAMIC_UNIFORM_BUFFER_DESCRIPTOR:
|
||||
case GN_SHADER_STORE_BUFFER_DESCRIPTOR: {
|
||||
MTLArgumentDescriptor* descriptor = [[MTLArgumentDescriptor alloc] init];
|
||||
descriptor.dataType = MTLDataTypePointer;
|
||||
descriptor.index = 0;
|
||||
@@ -33,7 +35,9 @@ gnUniform* allocateMetalUniforms(gnUniformPool pool, const gnUniformAllocationIn
|
||||
|
||||
uniforms[i]->uniform->index[allocInfo.sets[i].uniformBindings[c].binding] = currentIndex;
|
||||
currentIndex++;
|
||||
} else if (allocInfo.sets[i].uniformBindings[c].type == GN_COMBINED_IMAGE_SAMPLER_DESCRIPTOR) {
|
||||
break;
|
||||
}
|
||||
case GN_COMBINED_IMAGE_SAMPLER_DESCRIPTOR: {
|
||||
MTLArgumentDescriptor* textureDescriptor = [[MTLArgumentDescriptor alloc] init];
|
||||
textureDescriptor.dataType = MTLDataTypeTexture;
|
||||
textureDescriptor.index = 1;
|
||||
@@ -53,6 +57,9 @@ gnUniform* allocateMetalUniforms(gnUniformPool pool, const gnUniformAllocationIn
|
||||
[totalArguments addObject:samplerDescriptor];
|
||||
uniforms[i]->uniform->index[binding.binding] = currentIndex;
|
||||
currentIndex += 2;
|
||||
break;
|
||||
}
|
||||
case GN_UNIFORM_TYPE_MAX: break;
|
||||
}
|
||||
uniforms[i]->uniform->stageUsed[binding.binding] = binding.stage;
|
||||
}
|
||||
|
Reference in New Issue
Block a user