finish redo metal shader compilation

This commit is contained in:
Greg Wells
2025-07-19 14:31:49 -04:00
parent 7d4973e27d
commit aa729d3589
6 changed files with 68 additions and 29 deletions

View File

@@ -16,7 +16,8 @@ gnReturnCode createMetalShaderModule(gnShaderModule module, gnDevice device, gnS
};
if (shaderModuleInfo.stage == GN_FRAGMENT_SHADER_MODULE) options.stage = fragment;
const char* res = mtlCompileShader(shaderModuleInfo.code, shaderModuleInfo.size / 4, &options);
mtlShader shader = mtlCompileShader(shaderModuleInfo.code, shaderModuleInfo.size / 4, &options);
const char* res = shader.code;
if (res == NULL) return GN_FAILED_TO_CONVERT_SHADER_CODE;
NSError* error = nil;
@@ -45,10 +46,10 @@ gnReturnCode createMetalShaderModule(gnShaderModule module, gnDevice device, gnS
NSString* functionName = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
module->shaderModule->function = [shaderLib newFunctionWithName:functionName];
// printf("res %s\n", res);
[shaderLib release];
free((void*)res);
module->shaderModule->shaderMap = shader.map;
return GN_SUCCESS;
}