From c766d9b9dc5661693a58e01a3637f15197c2fe59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 5 Sep 2020 17:29:51 +0200 Subject: GPUTexture: GL Backend Isolation This is a massive cleanup needed for vulkan support T68990. It provides: - More meaningful enums with conversion functions. - Less hacky supports of arrays and cubemaps (all considered layered). - More inline with the stateless design of vulkan and modern GL. - Methods Fallbacks are using framebuffer functions that are wrapped instead of implementing inside the texture module. What is not in there: - API change. - Samplers support (breaks a few effects). # Conflicts: # source/blender/gpu/GPU_texture.h --- source/blender/gpu/GPU_texture.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'source/blender/gpu/GPU_texture.h') diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 8cc5936fac9..e56866c5259 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -44,6 +44,7 @@ typedef struct GPUTexture GPUTexture; * - All states are created at startup to avoid runtime costs. */ typedef enum eGPUSamplerState { + GPU_SAMPLER_DEFAULT = 0, GPU_SAMPLER_FILTER = (1 << 0), GPU_SAMPLER_MIPMAP = (1 << 1), GPU_SAMPLER_REPEAT_S = (1 << 2), @@ -52,8 +53,11 @@ typedef enum eGPUSamplerState { GPU_SAMPLER_CLAMP_BORDER = (1 << 5), /* Clamp to border color instead of border texel. */ GPU_SAMPLER_COMPARE = (1 << 6), GPU_SAMPLER_ANISO = (1 << 7), + GPU_SAMPLER_ICON = (1 << 8), + + GPU_SAMPLER_REPEAT = (GPU_SAMPLER_REPEAT_S | GPU_SAMPLER_REPEAT_T | GPU_SAMPLER_REPEAT_R), /* Don't use that. */ - GPU_SAMPLER_MAX = (1 << 8), + GPU_SAMPLER_MAX = (GPU_SAMPLER_ICON + 1), } eGPUSamplerState; ENUM_OPERATORS(eGPUSamplerState) @@ -209,12 +213,6 @@ GPUTexture *GPU_texture_create_1d_array( int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]); GPUTexture *GPU_texture_create_2d( int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]); -GPUTexture *GPU_texture_create_2d_multisample(int w, - int h, - eGPUTextureFormat tex_format, - const float *pixels, - int samples, - char err_out[256]); GPUTexture *GPU_texture_create_2d_array( int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]); GPUTexture *GPU_texture_create_3d( @@ -227,7 +225,6 @@ GPUTexture *GPU_texture_create_cube_array( int w, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]); GPUTexture *GPU_texture_create_from_vertbuf(struct GPUVertBuf *vert); -GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat tex_format, const uint buffer); GPUTexture *GPU_texture_create_compressed( int w, int h, int miplen, eGPUTextureFormat format, const void *data); @@ -286,7 +283,6 @@ int GPU_texture_height(const GPUTexture *tex); int GPU_texture_orig_width(const GPUTexture *tex); int GPU_texture_orig_height(const GPUTexture *tex); void GPU_texture_orig_size_set(GPUTexture *tex, int w, int h); -int GPU_texture_layers(const GPUTexture *tex); eGPUTextureFormat GPU_texture_format(const GPUTexture *tex); int GPU_texture_samples(const GPUTexture *tex); bool GPU_texture_array(const GPUTexture *tex); -- cgit v1.2.3