genesis-3d_engine/Engine/ExtIncludes/ShaderUtil/GlslOptimizer/glsl_optimizer.h
zhongdaohuan 6e8fbca745 genesis-3d engine version 1.3.
match the genesis editor version 1.3.0.653.
2014-05-05 14:50:33 +08:00

50 lines
1.4 KiB
C

#pragma once
#ifndef GLSL_OPTIMIZER_H
#define GLSL_OPTIMIZER_H
/*
Main GLSL optimizer interface.
See ../../README.md for more instructions.
General usage:
ctx = glslopt_initialize();
for (lots of shaders) {
shader = glslopt_optimize (ctx, shaderType, shaderSource, options);
if (glslopt_get_status (shader)) {
newSource = glslopt_get_output (shader);
} else {
errorLog = glslopt_get_log (shader);
}
glslopt_shader_delete (shader);
}
glslopt_cleanup (ctx);
*/
struct glslopt_shader;
struct glslopt_ctx;
enum glslopt_shader_type {
kGlslOptShaderVertex = 0,
kGlslOptShaderFragment,
};
// Options flags for glsl_optimize
enum glslopt_options {
kGlslOptionSkipPreprocessor = (1<<0), // Skip preprocessing shader source. Saves some time if you know you don't need it.
kGlslOptionNotFullShader = (1<<1), // Passed shader is not the full shader source. This makes some optimizations weaker.
};
glslopt_ctx* glslopt_initialize (bool openglES);
void glslopt_cleanup (glslopt_ctx* ctx);
glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, const char* shaderSource, unsigned options);
bool glslopt_get_status (glslopt_shader* shader);
const char* glslopt_get_output (glslopt_shader* shader);
const char* glslopt_get_raw_output (glslopt_shader* shader);
const char* glslopt_get_log (glslopt_shader* shader);
void glslopt_shader_delete (glslopt_shader* shader);
#endif /* GLSL_OPTIMIZER_H */