diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-17 04:20:43 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-18 04:43:51 +0300 |
commit | 99b424334d21fde412cf7bf49a877a1715ff7848 (patch) | |
tree | b459a7340167b58292db033f63fb78dcda8ec9a9 /source/blender | |
parent | 5b4a862f834eef798762660a73c6ae9881368460 (diff) |
GPU: Add immBindTexture and immBindTextureSampler
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/GPU_immediate.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate.c | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h index d1db1d5f3e7..698c4585d20 100644 --- a/source/blender/gpu/GPU_immediate.h +++ b/source/blender/gpu/GPU_immediate.h @@ -31,6 +31,7 @@ #include "GPU_primitive.h" #include "GPU_shader.h" #include "GPU_shader_interface.h" +#include "GPU_texture.h" #include "GPU_vertex_format.h" #ifdef __cplusplus @@ -115,6 +116,9 @@ void immUniform4fv(const char *name, const float data[4]); void immUniformArray4fv(const char *bare_name, const float *data, int count); void immUniformMatrix4fv(const char *name, const float data[4][4]); +void immBindTexture(const char *name, GPUTexture *tex); +void immBindTextureSampler(const char *name, GPUTexture *tex, eGPUSamplerState state); + /* Convenience functions for setting "uniform vec4 color". */ /* The rgb functions have implicit alpha = 1.0. */ void immUniformColor4f(float r, float g, float b, float a); diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c index 9ea273f33cf..4f5cb3fcc91 100644 --- a/source/blender/gpu/intern/gpu_immediate.c +++ b/source/blender/gpu/intern/gpu_immediate.c @@ -29,6 +29,7 @@ #include "GPU_attr_binding.h" #include "GPU_immediate.h" +#include "GPU_texture.h" #include "gpu_attr_binding_private.h" #include "gpu_context_private.h" @@ -853,6 +854,18 @@ void immUniform4iv(const char *name, const int data[4]) glUniform4iv(uniform->location, 1, data); } +void immBindTexture(const char *name, GPUTexture *tex) +{ + GET_UNIFORM + GPU_texture_bind(tex, uniform->binding); +} + +void immBindTextureSampler(const char *name, GPUTexture *tex, eGPUSamplerState state) +{ + GET_UNIFORM + GPU_texture_bind_ex(tex, state, uniform->binding, true); +} + /* --- convenience functions for setting "uniform vec4 color" --- */ void immUniformColor4f(float r, float g, float b, float a) |