Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/opengl/gl_texture.hh
| Show All 40 Lines | private: | ||||
| bool has_pixels_ = false; | bool has_pixels_ = false; | ||||
| public: | public: | ||||
| GLTexture(const char *name); | GLTexture(const char *name); | ||||
| ~GLTexture(); | ~GLTexture(); | ||||
| void update_sub( | void update_sub( | ||||
| int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) override; | int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) override; | ||||
| void update_sub(int offset[3], | |||||
| int extent[3], | |||||
| eGPUDataFormat format, | |||||
| GPUPixelBuffer *pixbuf) override; | |||||
| /** | /** | ||||
| * This will create the mipmap images and populate them with filtered data from base level. | * This will create the mipmap images and populate them with filtered data from base level. | ||||
| * | * | ||||
| * \warning Depth textures are not populated but they have their mips correctly defined. | * \warning Depth textures are not populated but they have their mips correctly defined. | ||||
| * \warning This resets the mipmap range. | * \warning This resets the mipmap range. | ||||
| */ | */ | ||||
| void generate_mipmap() override; | void generate_mipmap() override; | ||||
| Show All 25 Lines | private: | ||||
| bool proxy_check(int mip); | bool proxy_check(int mip); | ||||
| void update_sub_direct_state_access( | void update_sub_direct_state_access( | ||||
| int mip, int offset[3], int extent[3], GLenum gl_format, GLenum gl_type, const void *data); | int mip, int offset[3], int extent[3], GLenum gl_format, GLenum gl_type, const void *data); | ||||
| GPUFrameBuffer *framebuffer_get(); | GPUFrameBuffer *framebuffer_get(); | ||||
| MEM_CXX_CLASS_ALLOC_FUNCS("GLTexture") | MEM_CXX_CLASS_ALLOC_FUNCS("GLTexture") | ||||
| }; | }; | ||||
| class GLPixelBuffer : public PixelBuffer { | |||||
| private: | |||||
| GLuint gl_id_ = 0; | |||||
| public: | |||||
| GLPixelBuffer(uint size); | |||||
| ~GLPixelBuffer(); | |||||
| void *map() override; | |||||
| void unmap() override; | |||||
| int64_t get_native_handle() override; | |||||
| uint get_size() override; | |||||
| MEM_CXX_CLASS_ALLOC_FUNCS("GLPixelBuffer") | |||||
| }; | |||||
| inline GLenum to_gl_internal_format(eGPUTextureFormat format) | inline GLenum to_gl_internal_format(eGPUTextureFormat format) | ||||
| { | { | ||||
| /* You can add any of the available type to this list | /* You can add any of the available type to this list | ||||
| * For available types see GPU_texture.h */ | * For available types see GPU_texture.h */ | ||||
| switch (format) { | switch (format) { | ||||
| /* Formats texture & renderbuffer */ | /* Formats texture & renderbuffer */ | ||||
| case GPU_RGBA8UI: | case GPU_RGBA8UI: | ||||
| return GL_RGBA8UI; | return GL_RGBA8UI; | ||||
| ▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | switch (format) { | ||||
| case GPU_DATA_UBYTE: | case GPU_DATA_UBYTE: | ||||
| return GL_UNSIGNED_BYTE; | return GL_UNSIGNED_BYTE; | ||||
| case GPU_DATA_UINT_24_8: | case GPU_DATA_UINT_24_8: | ||||
| return GL_UNSIGNED_INT_24_8; | return GL_UNSIGNED_INT_24_8; | ||||
| case GPU_DATA_2_10_10_10_REV: | case GPU_DATA_2_10_10_10_REV: | ||||
| return GL_UNSIGNED_INT_2_10_10_10_REV; | return GL_UNSIGNED_INT_2_10_10_10_REV; | ||||
| case GPU_DATA_10_11_11_REV: | case GPU_DATA_10_11_11_REV: | ||||
| return GL_UNSIGNED_INT_10F_11F_11F_REV; | return GL_UNSIGNED_INT_10F_11F_11F_REV; | ||||
| case GPU_DATA_HALF_FLOAT: | |||||
| return GL_HALF_FLOAT; | |||||
| default: | default: | ||||
| BLI_assert_msg(0, "Unhandled data format"); | BLI_assert_msg(0, "Unhandled data format"); | ||||
| return GL_FLOAT; | return GL_FLOAT; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Definitely not complete, edit according to the OpenGL specification. | * Definitely not complete, edit according to the OpenGL specification. | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||