From b61235ae9f748de31e38070c995b7080eef39424 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 18 Jan 2017 17:34:41 -0500 Subject: [PATCH 1/2] spirv_msl: Put writable SSBOs in the 'device' address space --- spirv_msl.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 0e576253..330e5af6 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1253,7 +1253,16 @@ string CompilerMSL::entry_point_args(bool append_comma) case SPIRType::Struct: if (!ep_args.empty()) ep_args += ", "; - ep_args += "constant " + type_to_glsl(type) + "& " + to_name(var.self); + if ((meta[type.self].decoration.decoration_flags & (1ull << DecorationBufferBlock)) != 0 && + (meta[type.self].decoration.decoration_flags & (1ull << DecorationNonWritable)) == 0) + { + ep_args += "device "; + } + else + { + ep_args += "constant "; + } + ep_args += type_to_glsl(type) + "& " + to_name(var.self); ep_args += " [[buffer(" + convert_to_string(get_metal_resource_index(var, type.basetype)) + ")]]"; break; case SPIRType::Sampler: From 7b9036f402352f035ec68bec02e6ab518ffa3f95 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Fri, 20 Jan 2017 12:06:05 +0100 Subject: [PATCH 2/2] Fix small oversight in last PR. --- spirv_msl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 330e5af6..204467cd 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1254,7 +1254,7 @@ string CompilerMSL::entry_point_args(bool append_comma) if (!ep_args.empty()) ep_args += ", "; if ((meta[type.self].decoration.decoration_flags & (1ull << DecorationBufferBlock)) != 0 && - (meta[type.self].decoration.decoration_flags & (1ull << DecorationNonWritable)) == 0) + (meta[var.self].decoration.decoration_flags & (1ull << DecorationNonWritable)) == 0) { ep_args += "device "; }