diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-14 16:20:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 22:30:09 +0300 |
commit | 216d78687d2b9468b05fb598d1cef0b8424a40d2 (patch) | |
tree | b6d53ddf17e27c2cc0805c46fe76764004109f81 /source/blender/gpu/GPU_shader.h | |
parent | df28d2c27e2bef54e5b4fc33d663125ac5ec83f7 (diff) |
GPUShader: GL backend isolation
Diffstat (limited to 'source/blender/gpu/GPU_shader.h')
-rw-r--r-- | source/blender/gpu/GPU_shader.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 0b9109fbd4b..603b6957860 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -27,14 +27,19 @@ extern "C" { #endif -typedef struct GPUShader GPUShader; struct GPUShaderInterface; struct GPUTexture; struct GPUUniformBuffer; +struct GPUVertBuf; -/* GPU Shader - * - only for fragment shaders now - * - must call texture bind before setting a texture as uniform! */ +/* TODO(fclem) These members should be private and the + * whole struct should just be an opaque pointer. */ +typedef struct GPUShader { + /** Uniform & attribute locations for shader. */ + struct GPUShaderInterface *interface; + /** For debugging purpose. */ + char name[64]; +} GPUShader; typedef enum eGPUShaderTFBType { GPU_SHADER_TFB_NONE = 0, /* Transform feedback unsupported. */ @@ -63,10 +68,7 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode, const char **tf_names, const int tf_count, const char *shader_name); -GPUShader *GPU_shader_load_from_binary(const char *binary, - const int binary_format, - const int binary_len, - const char *shname); + struct GPU_ShaderCreateFromArray_Params { const char **vert, **geom, **frag, **defs; }; @@ -81,12 +83,12 @@ void GPU_shader_bind(GPUShader *shader); void GPU_shader_unbind(void); /* Returns true if transform feedback was successfully enabled. */ -bool GPU_shader_transform_feedback_enable(GPUShader *shader, unsigned int vbo_id); +bool GPU_shader_transform_feedback_enable(GPUShader *shader, struct GPUVertBuf *vertbuf); void GPU_shader_transform_feedback_disable(GPUShader *shader); int GPU_shader_get_program(GPUShader *shader); -void GPU_shader_set_srgb_uniform(const struct GPUShaderInterface *interface); +void GPU_shader_set_srgb_uniform(GPUShader *shader); int GPU_shader_get_uniform(GPUShader *shader, const char *name); int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin); |