Blender
V3.3
|
#include <gpu_texture_private.hh>
Public Member Functions | |
virtual void | generate_mipmap ()=0 |
virtual void | copy_to (Texture *tex)=0 |
virtual void | clear (eGPUDataFormat format, const void *data)=0 |
virtual void | swizzle_set (const char swizzle_mask[4])=0 |
virtual void | stencil_texture_mode_set (bool use_stencil)=0 |
virtual void | mip_range_set (int min, int max)=0 |
virtual void * | read (int mip, eGPUDataFormat format)=0 |
virtual void | update_sub (int mip, int offset[3], int extent[3], eGPUDataFormat format, const void *data)=0 |
virtual uint | gl_bindcode_get () const =0 |
int | width_get () const |
int | height_get () const |
int | depth_get () const |
void | mip_size_get (int mip, int r_size[3]) const |
int | mip_width_get (int mip) const |
int | mip_height_get (int mip) const |
int | mip_depth_get (int mip) const |
int | dimensions_count () const |
int | layer_count () const |
int | mip_count () const |
eGPUTextureFormat | format_get () const |
eGPUTextureFormatFlag | format_flag_get () const |
eGPUTextureType | type_get () const |
GPUAttachmentType | attachment_type (int slot) const |
Creation & Deletion | |
Texture (const char *name) | |
virtual | ~Texture () |
bool | init_1D (int w, int layers, int mip_len, eGPUTextureFormat format) |
bool | init_2D (int w, int h, int layers, int mip_len, eGPUTextureFormat format) |
bool | init_3D (int w, int h, int d, int mip_len, eGPUTextureFormat format) |
bool | init_cubemap (int w, int layers, int mip_len, eGPUTextureFormat format) |
bool | init_buffer (GPUVertBuf *vbo, eGPUTextureFormat format) |
bool | init_view (const GPUTexture *src, eGPUTextureFormat format, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array) |
Operation | |
void | attach_to (FrameBuffer *fb, GPUAttachmentType type) |
void | detach_from (FrameBuffer *fb) |
void | update (eGPUDataFormat format, const void *data) |
Public Attributes | |
eGPUSamplerState | sampler_state = GPU_SAMPLER_DEFAULT |
int | refcount = 1 |
int | src_w = 0 |
int | src_h = 0 |
void ** | py_ref = nullptr |
Protected Member Functions | |
virtual bool | init_internal ()=0 |
virtual bool | init_internal (GPUVertBuf *vbo)=0 |
virtual bool | init_internal (const GPUTexture *src, int mip_offset, int layer_offset)=0 |
Protected Attributes | |
int | w_ |
int | h_ |
int | d_ |
eGPUTextureFormat | format_ |
eGPUTextureFormatFlag | format_flag_ |
eGPUTextureType | type_ |
int | mipmaps_ = -1 |
int | mip_min_ = 0 |
int | mip_max_ = 0 |
char | name_ [DEBUG_NAME_LEN] |
GPUAttachmentType | fb_attachment_ [GPU_TEX_MAX_FBO_ATTACHED] |
FrameBuffer * | fb_ [GPU_TEX_MAX_FBO_ATTACHED] |
Implementation of Textures. Base class which is then specialized for each implementation (GL, VK, ...).
Definition at line 59 of file gpu_texture_private.hh.
blender::gpu::Texture::Texture | ( | const char * | name | ) |
Definition at line 25 of file gpu_texture.cc.
References ARRAY_SIZE, BLI_strncpy(), fb_, and name_.
|
virtual |
Definition at line 39 of file gpu_texture.cc.
References ARRAY_SIZE, blender::gpu::FrameBuffer::attachment_remove(), fb_, fb_attachment_, and py_ref.
void blender::gpu::Texture::attach_to | ( | FrameBuffer * | fb, |
GPUAttachmentType | type | ||
) |
Definition at line 182 of file gpu_texture.cc.
References ARRAY_SIZE, BLI_assert_msg, fb(), fb_, fb_attachment_, and type.
|
inline |
Definition at line 229 of file gpu_texture_private.hh.
References BLI_assert, format_, GPU_DEPTH24_STENCIL8, GPU_DEPTH32F_STENCIL8, GPU_DEPTH_COMPONENT16, GPU_DEPTH_COMPONENT24, GPU_DEPTH_COMPONENT32F, GPU_FB_COLOR_ATTACHMENT0, GPU_FB_DEPTH_ATTACHMENT, and GPU_FB_DEPTH_STENCIL_ATTACHMENT.
Referenced by blender::gpu::GLTexture::clear().
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
inline |
Definition at line 142 of file gpu_texture_private.hh.
References d_.
void blender::gpu::Texture::detach_from | ( | FrameBuffer * | fb | ) |
Definition at line 194 of file gpu_texture.cc.
References ARRAY_SIZE, blender::gpu::FrameBuffer::attachment_remove(), BLI_assert_msg, fb(), fb_, and fb_attachment_.
|
inline |
Definition at line 182 of file gpu_texture_private.hh.
References blender::gpu::GPU_TEXTURE_1D, blender::gpu::GPU_TEXTURE_2D, blender::gpu::GPU_TEXTURE_3D, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::GPU_TEXTURE_BUFFER, blender::gpu::GPU_TEXTURE_CUBE, and type_.
Referenced by blender::gpu::GLTexture::init_internal(), and blender::gpu::GLTexture::update_sub().
|
inline |
Definition at line 221 of file gpu_texture_private.hh.
References format_flag_.
|
inline |
Definition at line 217 of file gpu_texture_private.hh.
References format_.
Referenced by blender::gpu::MTLFrameBuffer::blit(), and blender::gpu::MTLFrameBuffer::update_attachments().
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
inline |
Definition at line 138 of file gpu_texture_private.hh.
References h_.
Referenced by blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLFrameBuffer::blit_to(), and blender::gpu::MTLFrameBuffer::check().
bool blender::gpu::Texture::init_1D | ( | int | w, |
int | layers, | ||
int | mip_len, | ||
eGPUTextureFormat | format | ||
) |
Definition at line 54 of file gpu_texture.cc.
References d_, floorf, format_, format_flag_, blender::gpu::GPU_FORMAT_DEPTH_STENCIL, blender::gpu::GPU_FORMAT_INTEGER, GPU_SAMPLER_FILTER, blender::gpu::GPU_TEXTURE_1D, blender::gpu::GPU_TEXTURE_1D_ARRAY, h_, init_internal(), min_ii(), mipmaps_, sampler_state, blender::gpu::to_format_flag(), type_, w(), and w_.
bool blender::gpu::Texture::init_2D | ( | int | w, |
int | h, | ||
int | layers, | ||
int | mip_len, | ||
eGPUTextureFormat | format | ||
) |
Definition at line 70 of file gpu_texture.cc.
References d_, floorf, format_, format_flag_, blender::gpu::GPU_FORMAT_DEPTH_STENCIL, blender::gpu::GPU_FORMAT_INTEGER, GPU_SAMPLER_FILTER, blender::gpu::GPU_TEXTURE_2D, blender::gpu::GPU_TEXTURE_2D_ARRAY, h_, init_internal(), max_ii(), min_ii(), mipmaps_, sampler_state, blender::gpu::to_format_flag(), type_, w(), and w_.
Referenced by blender::gpu::MTLTexture::MTLTexture().
bool blender::gpu::Texture::init_3D | ( | int | w, |
int | h, | ||
int | d, | ||
int | mip_len, | ||
eGPUTextureFormat | format | ||
) |
Definition at line 86 of file gpu_texture.cc.
References d_, floorf, format_, format_flag_, blender::gpu::GPU_FORMAT_DEPTH_STENCIL, blender::gpu::GPU_FORMAT_INTEGER, GPU_SAMPLER_FILTER, blender::gpu::GPU_TEXTURE_3D, h_, init_internal(), max_iii(), min_ii(), mipmaps_, sampler_state, blender::gpu::to_format_flag(), type_, w(), and w_.
bool blender::gpu::Texture::init_buffer | ( | GPUVertBuf * | vbo, |
eGPUTextureFormat | format | ||
) |
Definition at line 118 of file gpu_texture.cc.
References d_, format_, format_flag_, GPU_DEPTH_COMPONENT24, blender::gpu::GPU_TEXTURE_BUFFER, GPU_vertbuf_get_vertex_len(), h_, init_internal(), blender::gpu::to_format_flag(), type_, and w_.
bool blender::gpu::Texture::init_cubemap | ( | int | w, |
int | layers, | ||
int | mip_len, | ||
eGPUTextureFormat | format | ||
) |
Definition at line 102 of file gpu_texture.cc.
References d_, floorf, format_, format_flag_, blender::gpu::GPU_FORMAT_DEPTH_STENCIL, blender::gpu::GPU_FORMAT_INTEGER, GPU_SAMPLER_FILTER, blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::GPU_TEXTURE_CUBE_ARRAY, h_, init_internal(), max_ii(), min_ii(), mipmaps_, sampler_state, blender::gpu::to_format_flag(), type_, w(), and w_.
|
protectedpure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
Referenced by init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), and init_view().
|
protectedpure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
protectedpure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
bool blender::gpu::Texture::init_view | ( | const GPUTexture * | src, |
eGPUTextureFormat | format, | ||
int | mip_start, | ||
int | mip_len, | ||
int | layer_start, | ||
int | layer_len, | ||
bool | cube_as_array | ||
) |
Definition at line 133 of file gpu_texture.cc.
References ATTR_FALLTHROUGH, BLI_assert, d_, format_, format_flag_, blender::gpu::GPU_TEXTURE_1D_ARRAY, blender::gpu::GPU_TEXTURE_2D_ARRAY, blender::gpu::GPU_TEXTURE_CUBE, blender::gpu::GPU_TEXTURE_CUBE_ARRAY, h_, init_internal(), min_ii(), mipmaps_, sampler_state, src, blender::gpu::to_format_flag(), type_, blender::gpu::unwrap(), and w_.
|
inline |
Definition at line 199 of file gpu_texture_private.hh.
References d_, blender::gpu::GPU_TEXTURE_1D_ARRAY, blender::gpu::GPU_TEXTURE_2D_ARRAY, blender::gpu::GPU_TEXTURE_CUBE_ARRAY, h_, and type_.
|
inline |
Definition at line 212 of file gpu_texture_private.hh.
References mipmaps_.
|
inline |
Definition at line 176 of file gpu_texture_private.hh.
References d_, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::GPU_TEXTURE_CUBE, max_ii(), and type_.
|
inline |
Definition at line 172 of file gpu_texture_private.hh.
References blender::gpu::GPU_TEXTURE_1D_ARRAY, h_, max_ii(), and type_.
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
inline |
Definition at line 147 of file gpu_texture_private.hh.
References d_, blender::gpu::GPU_TEXTURE_1D_ARRAY, blender::gpu::GPU_TEXTURE_ARRAY, blender::gpu::GPU_TEXTURE_CUBE, h_, max_ii(), type_, and w_.
Referenced by blender::gpu::GLTexture::copy_to(), blender::gpu::GLTexture::read(), and update().
|
inline |
Definition at line 168 of file gpu_texture_private.hh.
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
|
inline |
Definition at line 225 of file gpu_texture_private.hh.
References type_.
void blender::gpu::Texture::update | ( | eGPUDataFormat | format, |
const void * | data | ||
) |
Definition at line 206 of file gpu_texture.cc.
References data, mip_size_get(), offset, and update_sub().
|
pure virtual |
Implemented in blender::gpu::GLTexture, and blender::gpu::MTLTexture.
Referenced by update().
|
inline |
Definition at line 134 of file gpu_texture_private.hh.
References w_.
Referenced by blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLFrameBuffer::blit_to(), and blender::gpu::MTLFrameBuffer::check().
|
protected |
Definition at line 78 of file gpu_texture_private.hh.
Referenced by blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLTexture::copy_to(), blender::gpu::GLTexture::copy_to(), depth_get(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), layer_count(), mip_depth_get(), and mip_size_get().
|
protected |
Definition at line 97 of file gpu_texture_private.hh.
Referenced by attach_to(), blender::gpu::GLTexture::check_feedback_loop(), detach_from(), Texture(), and ~Texture().
|
protected |
Frame-buffer references to update on deletion.
Definition at line 96 of file gpu_texture_private.hh.
Referenced by attach_to(), blender::gpu::GLTexture::check_feedback_loop(), detach_from(), and ~Texture().
|
protected |
Internal data format.
Definition at line 80 of file gpu_texture_private.hh.
Referenced by attachment_type(), blender::gpu::GLTexture::clear(), blender::gpu::MTLTexture::copy_to(), blender::gpu::GLTexture::copy_to(), format_get(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), blender::gpu::GLTexture::read(), and blender::gpu::GLTexture::update_sub().
|
protected |
Format characteristics.
Definition at line 82 of file gpu_texture_private.hh.
Referenced by format_flag_get(), blender::gpu::GLTexture::generate_mipmap(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), blender::gpu::GLTexture::read(), and blender::gpu::GLTexture::update_sub().
|
protected |
Definition at line 78 of file gpu_texture_private.hh.
Referenced by blender::gpu::MTLTexture::copy_to(), blender::gpu::GLTexture::copy_to(), height_get(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), layer_count(), mip_height_get(), and mip_size_get().
|
protected |
Definition at line 90 of file gpu_texture_private.hh.
Referenced by blender::gpu::GLTexture::check_feedback_loop(), and blender::gpu::GLTexture::mip_range_set().
|
protected |
For error checking
Definition at line 90 of file gpu_texture_private.hh.
Referenced by blender::gpu::GLTexture::check_feedback_loop(), and blender::gpu::GLTexture::mip_range_set().
|
protected |
Number of mipmaps this texture has (Max miplvl).
Definition at line 88 of file gpu_texture_private.hh.
Referenced by init_1D(), init_2D(), init_3D(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), mip_count(), blender::gpu::GLTexture::mip_range_set(), blender::gpu::GLTexture::read(), and blender::gpu::GLTexture::update_sub().
|
protected |
For debugging
Definition at line 93 of file gpu_texture_private.hh.
Referenced by blender::gpu::GLTexture::check_feedback_loop(), blender::gpu::MTLTexture::get_name(), blender::gpu::GLTexture::init_internal(), and Texture().
void** blender::gpu::Texture::py_ref = nullptr |
Reference of a pointer that needs to be cleaned when deallocating the texture. Points to BPyGPUTexture.tex
Definition at line 72 of file gpu_texture_private.hh.
Referenced by ~Texture().
int blender::gpu::Texture::refcount = 1 |
Reference counter.
Definition at line 64 of file gpu_texture_private.hh.
eGPUSamplerState blender::gpu::Texture::sampler_state = GPU_SAMPLER_DEFAULT |
Internal Sampler state.
Definition at line 62 of file gpu_texture_private.hh.
Referenced by init_1D(), init_2D(), init_3D(), init_cubemap(), and init_view().
int blender::gpu::Texture::src_h = 0 |
Definition at line 66 of file gpu_texture_private.hh.
int blender::gpu::Texture::src_w = 0 |
Width & Height (of source data), optional.
Definition at line 66 of file gpu_texture_private.hh.
|
protected |
Texture type.
Definition at line 84 of file gpu_texture_private.hh.
Referenced by blender::gpu::MTLFrameBuffer::add_color_attachment(), blender::gpu::MTLFrameBuffer::add_depth_attachment(), blender::gpu::MTLFrameBuffer::add_stencil_attachment(), blender::gpu::MTLTexture::copy_to(), blender::gpu::GLTexture::copy_to(), dimensions_count(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), layer_count(), mip_depth_get(), mip_height_get(), mip_size_get(), blender::gpu::MTLTexture::MTLTexture(), blender::gpu::GLTexture::read(), type_get(), and blender::gpu::GLTexture::update_sub().
|
protected |
Width & Height & Depth. For cube-map arrays, d is number of face-layers.
Definition at line 78 of file gpu_texture_private.hh.
Referenced by blender::gpu::MTLTexture::copy_to(), blender::gpu::GLTexture::copy_to(), init_1D(), init_2D(), init_3D(), init_buffer(), init_cubemap(), blender::gpu::GLTexture::init_internal(), init_view(), mip_size_get(), mip_width_get(), and width_get().