Fix T31546 fragment program gets created every frame
That was really crappy indeed. Now we have a separate API for low level OpenGL programs, plus a nice interface for GPU, also removes some GL calls from main code as a plus :) The source for the programs is also moved to nice external .glsl files (not sure which extension convention GPU assemply uses)
This commit is contained in:
@@ -52,6 +52,9 @@ typedef struct GPUOffScreen GPUOffScreen;
|
||||
struct GPUShader;
|
||||
typedef struct GPUShader GPUShader;
|
||||
|
||||
struct GPUProgram;
|
||||
typedef struct GPUProgram GPUProgram;
|
||||
|
||||
/* GPU extensions support */
|
||||
|
||||
void GPU_extensions_disable(void);
|
||||
@@ -181,6 +184,18 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
|
||||
int GPU_offscreen_width(const GPUOffScreen *ofs);
|
||||
int GPU_offscreen_height(const GPUOffScreen *ofs);
|
||||
|
||||
/* Builtin/Non-generated shaders */
|
||||
typedef enum GPUProgramType {
|
||||
GPU_PROGRAM_TYPE_FRAGMENT = 0
|
||||
} GPUProgramType;
|
||||
|
||||
|
||||
GPUProgram *GPU_program_shader_create(GPUProgramType type, const char *code);
|
||||
void GPU_program_free(GPUProgram *program);
|
||||
void GPU_program_parameter_4f(GPUProgram *program, unsigned int location, float x, float y, float z, float w);
|
||||
void GPU_program_bind(GPUProgram *);
|
||||
void GPU_program_unbind(GPUProgram *);
|
||||
|
||||
/* GPU Shader
|
||||
* - only for fragment shaders now
|
||||
* - must call texture bind before setting a texture as uniform! */
|
||||
@@ -205,11 +220,17 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name);
|
||||
|
||||
/* Builtin/Non-generated shaders */
|
||||
typedef enum GPUBuiltinShader {
|
||||
GPU_SHADER_VSM_STORE = (1<<0),
|
||||
GPU_SHADER_SEP_GAUSSIAN_BLUR = (1<<1),
|
||||
GPU_SHADER_VSM_STORE = 0,
|
||||
GPU_SHADER_SEP_GAUSSIAN_BLUR = 1,
|
||||
} GPUBuiltinShader;
|
||||
|
||||
typedef enum GPUBuiltinProgram {
|
||||
GPU_PROGRAM_SMOKE = 0,
|
||||
GPU_PROGRAM_SMOKE_COLORED = 1,
|
||||
} GPUBuiltinProgram;
|
||||
|
||||
GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
|
||||
GPUProgram *GPU_shader_get_builtin_program(GPUBuiltinProgram program);
|
||||
GPUShader *GPU_shader_get_builtin_fx_shader(int effects, bool persp);
|
||||
|
||||
void GPU_shader_free_builtin_shaders(void);
|
||||
|
||||
Reference in New Issue
Block a user