Skip to content

Commit

Permalink
Expose setResourceSetBinding() method to the C API
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi authored and arcady-lunarg committed Sep 17, 2024
1 parent 02bc074 commit 9213cbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions glslang/CInterface/glslang_c_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions glslang/Include/glslang_c_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9213cbd

Please sign in to comment.