Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_draw.c
| Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | static uint gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) | ||||
| /* create image */ | /* create image */ | ||||
| int bindcode; | int bindcode; | ||||
| glGenTextures(1, (GLuint *)&bindcode); | glGenTextures(1, (GLuint *)&bindcode); | ||||
| glBindTexture(GL_TEXTURE_2D_ARRAY, bindcode); | glBindTexture(GL_TEXTURE_2D_ARRAY, bindcode); | ||||
| GLenum data_type, internal_format; | GLenum data_type, internal_format; | ||||
| if (main_ibuf->rect_float) { | if (main_ibuf->rect_float) { | ||||
| data_type = GL_FLOAT; | data_type = GL_FLOAT; | ||||
| internal_format = GL_RGBA16F; | internal_format = (ima->flag & IMA_HIGH_BITDEPTH) ? GL_RGBA32F : GL_RGBA16F; | ||||
brecht: Is this test correct? I would expect:
```
(!(main_ibuf->flags & IB_halffloat) || (ima->flag &… | |||||
Not Done Inline ActionsSorry, that should be: (!(main_ibuf->flags & IB_halffloat) && (ima->flag & IMA_HIGH_BITDEPTH)) brecht: Sorry, that should be:
```
(!(main_ibuf->flags & IB_halffloat) && (ima->flag &… | |||||
| } | } | ||||
| else { | else { | ||||
| data_type = GL_UNSIGNED_BYTE; | data_type = GL_UNSIGNED_BYTE; | ||||
| internal_format = GL_RGBA8; | internal_format = GL_RGBA8; | ||||
| if (!IMB_colormanagement_space_is_data(main_ibuf->rect_colorspace) && | if (!IMB_colormanagement_space_is_data(main_ibuf->rect_colorspace) && | ||||
| !IMB_colormanagement_space_is_scene_linear(main_ibuf->rect_colorspace)) { | !IMB_colormanagement_space_is_scene_linear(main_ibuf->rect_colorspace)) { | ||||
| internal_format = GL_SRGB8_ALPHA8; | internal_format = GL_SRGB8_ALPHA8; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 727 Lines • ▼ Show 20 Lines | else { | ||||
| rect = ibuf->rect; | rect = ibuf->rect; | ||||
| } | } | ||||
| } | } | ||||
| /* create image */ | /* create image */ | ||||
| glGenTextures(1, (GLuint *)bind); | glGenTextures(1, (GLuint *)bind); | ||||
| glBindTexture(textarget, *bind); | glBindTexture(textarget, *bind); | ||||
| GLenum internal_format = (frect) ? GL_RGBA16F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8; | GLenum float_format = (ima->flag & IMA_HIGH_BITDEPTH) ? GL_RGBA32F : GL_RGBA16F; | ||||
| GLenum internal_format = (frect) ? float_format : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8; | |||||
| if (textarget == GL_TEXTURE_2D) { | if (textarget == GL_TEXTURE_2D) { | ||||
| if (frect) { | if (frect) { | ||||
| glTexImage2D(GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect); | glTexImage2D(GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect); | ||||
| } | } | ||||
| else { | else { | ||||
| glTexImage2D( | glTexImage2D( | ||||
| GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); | GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); | ||||
| ▲ Show 20 Lines • Show All 609 Lines • Show Last 20 Lines | |||||
Is this test correct? I would expect: