diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-10-14 15:52:18 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-10-14 15:52:18 +0300 |
commit | bd1ee4344e8de1e7a1e421a03cfb18f9f2f88f96 (patch) | |
tree | 365ee28d4f29a69ff27422d560e73142ad1a95f8 /spirv_cross_c.cpp | |
parent | 7332b44c3cd0bb353de5b6301e1d128863aa6d38 (diff) |
MSL: Support querying and modifying generated combined sampler suffix.
Diffstat (limited to 'spirv_cross_c.cpp')
-rw-r--r-- | spirv_cross_c.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spirv_cross_c.cpp b/spirv_cross_c.cpp index 4fe7cbf3..cbe3a558 100644 --- a/spirv_cross_c.cpp +++ b/spirv_cross_c.cpp @@ -1247,6 +1247,42 @@ spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, SpvExecutio #endif } +spvc_result spvc_compiler_msl_set_combined_sampler_suffix(spvc_compiler compiler, const char *suffix) +{ +#if SPIRV_CROSS_C_API_MSL + if (compiler->backend != SPVC_BACKEND_MSL) + { + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; + } + + auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get()); + msl.set_combined_sampler_suffix(suffix); + return SPVC_SUCCESS; +#else + (void)suffix; + compiler->context->report_error("MSL function used on a non-MSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; +#endif +} + +const char *spvc_compiler_msl_get_combined_sampler_suffix(spvc_compiler compiler) +{ +#if SPIRV_CROSS_C_API_MSL + if (compiler->backend != SPVC_BACKEND_MSL) + { + compiler->context->report_error("MSL function used on a non-MSL backend."); + return ""; + } + + auto &msl = *static_cast<CompilerMSL *>(compiler->compiler.get()); + return msl.get_combined_sampler_suffix(); +#else + compiler->context->report_error("MSL function used on a non-MSL backend."); + return ""; +#endif +} + #if SPIRV_CROSS_C_API_MSL static void spvc_convert_msl_sampler(MSLConstexprSampler &samp, const spvc_msl_constexpr_sampler *sampler) { |