MSL: Support querying and modifying generated combined sampler suffix.
This commit is contained in:
parent
7332b44c3c
commit
bd1ee4344e
@ -323,7 +323,7 @@ if (SPIRV_CROSS_STATIC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(spirv-cross-abi-major 0)
|
set(spirv-cross-abi-major 0)
|
||||||
set(spirv-cross-abi-minor 40)
|
set(spirv-cross-abi-minor 41)
|
||||||
set(spirv-cross-abi-patch 0)
|
set(spirv-cross-abi-patch 0)
|
||||||
|
|
||||||
if (SPIRV_CROSS_SHARED)
|
if (SPIRV_CROSS_SHARED)
|
||||||
|
@ -1247,6 +1247,42 @@ spvc_bool spvc_compiler_msl_is_resource_used(spvc_compiler compiler, SpvExecutio
|
|||||||
#endif
|
#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
|
#if SPIRV_CROSS_C_API_MSL
|
||||||
static void spvc_convert_msl_sampler(MSLConstexprSampler &samp, const spvc_msl_constexpr_sampler *sampler)
|
static void spvc_convert_msl_sampler(MSLConstexprSampler &samp, const spvc_msl_constexpr_sampler *sampler)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||||||
/* Bumped if ABI or API breaks backwards compatibility. */
|
/* Bumped if ABI or API breaks backwards compatibility. */
|
||||||
#define SPVC_C_API_VERSION_MAJOR 0
|
#define SPVC_C_API_VERSION_MAJOR 0
|
||||||
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
|
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
|
||||||
#define SPVC_C_API_VERSION_MINOR 40
|
#define SPVC_C_API_VERSION_MINOR 41
|
||||||
/* Bumped if internal implementation details change. */
|
/* Bumped if internal implementation details change. */
|
||||||
#define SPVC_C_API_VERSION_PATCH 0
|
#define SPVC_C_API_VERSION_PATCH 0
|
||||||
|
|
||||||
@ -769,6 +769,9 @@ SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_dynamic_buffer(spvc_compiler c
|
|||||||
|
|
||||||
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_inline_uniform_block(spvc_compiler compiler, unsigned desc_set, unsigned binding);
|
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_add_inline_uniform_block(spvc_compiler compiler, unsigned desc_set, unsigned binding);
|
||||||
|
|
||||||
|
SPVC_PUBLIC_API spvc_result spvc_compiler_msl_set_combined_sampler_suffix(spvc_compiler compiler, const char *suffix);
|
||||||
|
SPVC_PUBLIC_API const char *spvc_compiler_msl_get_combined_sampler_suffix(spvc_compiler compiler);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reflect resources.
|
* Reflect resources.
|
||||||
* Maps almost 1:1 to C++ API.
|
* Maps almost 1:1 to C++ API.
|
||||||
|
@ -13771,3 +13771,13 @@ bool CompilerMSL::using_builtin_array() const
|
|||||||
{
|
{
|
||||||
return msl_options.force_native_arrays || is_using_builtin_array;
|
return msl_options.force_native_arrays || is_using_builtin_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CompilerMSL::set_combined_sampler_suffix(const char *suffix)
|
||||||
|
{
|
||||||
|
sampler_name_suffix = suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CompilerMSL::get_combined_sampler_suffix() const
|
||||||
|
{
|
||||||
|
return sampler_name_suffix.c_str();
|
||||||
|
}
|
||||||
|
@ -558,6 +558,9 @@ public:
|
|||||||
// to use for a particular location. The default is 4 if number of components is not overridden.
|
// to use for a particular location. The default is 4 if number of components is not overridden.
|
||||||
void set_fragment_output_components(uint32_t location, uint32_t components);
|
void set_fragment_output_components(uint32_t location, uint32_t components);
|
||||||
|
|
||||||
|
void set_combined_sampler_suffix(const char *suffix);
|
||||||
|
const char *get_combined_sampler_suffix() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// An enum of SPIR-V functions that are implemented in additional
|
// An enum of SPIR-V functions that are implemented in additional
|
||||||
// source code that is added to the shader if necessary.
|
// source code that is added to the shader if necessary.
|
||||||
|
Loading…
Reference in New Issue
Block a user