Merge pull request #1195 from KhronosGroup/fix-1190

C API updates
This commit is contained in:
Hans-Kristian Arntzen 2019-11-04 12:50:36 +01:00 committed by GitHub
commit 24f209eb93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 2 deletions

View File

@ -308,7 +308,7 @@ if (SPIRV_CROSS_STATIC)
endif()
set(spirv-cross-abi-major 0)
set(spirv-cross-abi-minor 19)
set(spirv-cross-abi-minor 20)
set(spirv-cross-abi-patch 0)
if (SPIRV_CROSS_SHARED)

View File

@ -569,6 +569,30 @@ spvc_result spvc_compiler_options_set_uint(spvc_compiler_options options, spvc_c
case SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX:
options->msl.dynamic_offsets_buffer_index = value;
break;
case SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D:
options->msl.texture_1D_as_2D = value != 0;
break;
case SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO:
options->msl.enable_base_index_zero = value != 0;
break;
case SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS:
options->msl.ios_use_framebuffer_fetch_subpasses = value != 0;
break;
case SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH:
options->msl.invariant_float_math = value != 0;
break;
case SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY:
options->msl.emulate_cube_array = value != 0;
break;
case SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING:
options->msl.enable_decoration_binding = value != 0;
break;
#endif
default:
@ -1639,6 +1663,11 @@ spvc_type spvc_compiler_get_type_handle(spvc_compiler compiler, spvc_type_id id)
SPVC_END_SAFE_SCOPE(compiler->context, nullptr)
}
spvc_type_id spvc_type_get_base_type_id(spvc_type type)
{
return type->self;
}
static spvc_basetype convert_basetype(SPIRType::BaseType type)
{
// For now the enums match up.

View File

@ -33,7 +33,7 @@ extern "C" {
/* Bumped if ABI or API breaks backwards compatibility. */
#define SPVC_C_API_VERSION_MAJOR 0
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
#define SPVC_C_API_VERSION_MINOR 19
#define SPVC_C_API_VERSION_MINOR 20
/* Bumped if internal implementation details change. */
#define SPVC_C_API_VERSION_PATCH 0
@ -527,6 +527,12 @@ typedef enum spvc_compiler_option
SPVC_COMPILER_OPTION_MSL_VIEW_INDEX_FROM_DEVICE_INDEX = 41 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_DISPATCH_BASE = 42 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_DYNAMIC_OFFSETS_BUFFER_INDEX = 43 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_TEXTURE_1D_AS_2D = 44 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_ENABLE_BASE_INDEX_ZERO = 45 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_IOS_FRAMEBUFFER_FETCH_SUBPASS = 46 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_INVARIANT_FP_MATH = 47 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_EMULATE_CUBEMAP_ARRAY = 48 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_MSL_ENABLE_DECORATION_BINDING = 49 | SPVC_COMPILER_OPTION_MSL_BIT,
SPVC_COMPILER_OPTION_INT_MAX = 0x7fffffff
} spvc_compiler_option;
@ -713,6 +719,12 @@ SPVC_PUBLIC_API SpvExecutionModel spvc_compiler_get_execution_model(spvc_compile
*/
SPVC_PUBLIC_API spvc_type spvc_compiler_get_type_handle(spvc_compiler compiler, spvc_type_id id);
/* Pulls out SPIRType::self. This effectively gives the type ID without array or pointer qualifiers.
* This is necessary when reflecting decoration/name information on members of a struct,
* which are placed in the base type, not the qualified type.
* This is similar to spvc_reflected_resource::base_type_id. */
SPVC_PUBLIC_API spvc_type_id spvc_type_get_base_type_id(spvc_type type);
SPVC_PUBLIC_API spvc_basetype spvc_type_get_basetype(spvc_type type);
SPVC_PUBLIC_API unsigned spvc_type_get_bit_width(spvc_type type);
SPVC_PUBLIC_API unsigned spvc_type_get_vector_size(spvc_type type);