Added entrypoints to c interface; exports for resource limits; minor additions to buildsystem.
This commit is contained in:
parent
6b8daf4802
commit
f2f81cf089
7 changed files with 125 additions and 135 deletions
|
|
@ -329,6 +329,18 @@ GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* in
|
|||
shader->shader->setEnvTarget(c_shader_target_language(input->target_language),
|
||||
c_shader_target_language_version(input->target_language_version));
|
||||
|
||||
if (input->entrypoint != nullptr)
|
||||
shader->shader->setEntryPoint(input->entrypoint);
|
||||
|
||||
if (input->source_entrypoint != nullptr) {
|
||||
if (input->entrypoint == nullptr)
|
||||
printf("Warning: Setting source entry point name without setting an entry-point name.\n");
|
||||
|
||||
shader->shader->setSourceEntryPoint(input->source_entrypoint);
|
||||
}
|
||||
|
||||
shader->shader->setInvertY(input->invert_y);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,6 +206,9 @@ typedef struct glslang_input_s {
|
|||
glslang_target_language_version_t target_language_version;
|
||||
/** Shader source code */
|
||||
const char* code;
|
||||
const char* entrypoint; // This is what actually gets called by the GPU. Best to leave it at 'main' or something so opengl doesn't trip over itself.
|
||||
const char* source_entrypoint; // This just renames the source entrypoint in the code to 'entrypoint' and should be what is used to set different entrypoint names.
|
||||
bool invert_y;
|
||||
int default_version;
|
||||
glslang_profile_t default_profile;
|
||||
int force_default_version_and_profile;
|
||||
|
|
|
|||
|
|
@ -36,19 +36,19 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
// Returns a struct that can be use to create custom resource values.
|
||||
glslang_resource_t* glslang_resource(void);
|
||||
GLSLANG_EXPORT glslang_resource_t* glslang_resource(void);
|
||||
|
||||
// These are the default resources for TBuiltInResources, used for both
|
||||
// - parsing this string for the case where the user didn't supply one,
|
||||
// - dumping out a template for user construction of a config file.
|
||||
const glslang_resource_t* glslang_default_resource(void);
|
||||
GLSLANG_EXPORT const glslang_resource_t* glslang_default_resource(void);
|
||||
|
||||
// Returns the DefaultTBuiltInResource as a human-readable string.
|
||||
// NOTE: User is responsible for freeing this string.
|
||||
const char* glslang_default_resource_string();
|
||||
GLSLANG_EXPORT const char* glslang_default_resource_string();
|
||||
|
||||
// Decodes the resource limits from |config| to |resources|.
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
|
||||
GLSLANG_EXPORT void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,17 +32,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
glslang_resource_t* glslang_resource(void)
|
||||
GLSLANG_EXPORT glslang_resource_t* glslang_resource(void)
|
||||
{
|
||||
return reinterpret_cast<glslang_resource_t*>(GetResources());
|
||||
}
|
||||
|
||||
const glslang_resource_t* glslang_default_resource(void)
|
||||
GLSLANG_EXPORT const glslang_resource_t* glslang_default_resource(void)
|
||||
{
|
||||
return reinterpret_cast<const glslang_resource_t*>(GetDefaultResources());
|
||||
}
|
||||
|
||||
const char* glslang_default_resource_string()
|
||||
GLSLANG_EXPORT const char* glslang_default_resource_string()
|
||||
{
|
||||
std::string cpp_str = GetDefaultTBuiltInResourceString();
|
||||
char* c_str = (char*)malloc(cpp_str.length() + 1);
|
||||
|
|
@ -50,7 +50,7 @@ const char* glslang_default_resource_string()
|
|||
return c_str;
|
||||
}
|
||||
|
||||
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
||||
GLSLANG_EXPORT void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
|
||||
{
|
||||
DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue