Expose setResourceSetBinding() method to the C API

This commit is contained in:
Andrei Alexeyev 2024-09-15 18:21:38 +02:00 committed by arcady-lunarg
parent 02bc074ac4
commit 9213cbd310
2 changed files with 12 additions and 0 deletions

View file

@ -63,6 +63,7 @@ static_assert(sizeof(glslang_version_t) == sizeof(glslang::Version), "");
typedef struct glslang_shader_s {
glslang::TShader* shader;
std::string preprocessedGLSL;
std::vector<std::string> baseResourceSetBinding;
} glslang_shader_t;
typedef struct glslang_program_s {
@ -389,6 +390,16 @@ GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_name(glslang_shader
shader->shader->setGlobalUniformBlockName(name);
}
GLSLANG_EXPORT void glslang_shader_set_resource_set_binding(glslang_shader_t* shader, const char *const *bindings, unsigned int num_bindings) {
shader->baseResourceSetBinding.clear();
for (unsigned int i = 0; i < num_bindings; ++i) {
shader->baseResourceSetBinding.push_back(std::string(bindings[i]));
}
shader->shader->setResourceSetBinding(shader->baseResourceSetBinding);
}
GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t* shader)
{
return shader->preprocessedGLSL.c_str();

View file

@ -259,6 +259,7 @@ GLSLANG_EXPORT void glslang_shader_set_options(glslang_shader_t* shader, int opt
GLSLANG_EXPORT void glslang_shader_set_glsl_version(glslang_shader_t* shader, int version);
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_set_and_binding(glslang_shader_t* shader, unsigned int set, unsigned int binding);
GLSLANG_EXPORT void glslang_shader_set_default_uniform_block_name(glslang_shader_t* shader, const char *name);
GLSLANG_EXPORT void glslang_shader_set_resource_set_binding(glslang_shader_t* shader, const char *const *bindings, unsigned int num_bindings);
GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input);
GLSLANG_EXPORT int glslang_shader_parse(glslang_shader_t* shader, const glslang_input_t* input);
GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t* shader);