Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-02-28 11:01:15 +0300
committerJacques Lucke <jacques@blender.org>2020-02-28 11:01:15 +0300
commit4ed7334ef617abc3f3fabbca4fe3e128f74020c2 (patch)
treeedd7dcae4a5b9ed764d4471b4b63f992ede777a7 /source/blender/gpu/intern/gpu_draw.c
parentb92b1a4fe56338c7a66dda4f27426c10e070b11c (diff)
parent9cac5fa681c55edcf6e856e59e07e90e2ae25965 (diff)
Merge branch 'master' into functions
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6afff4f68f1..d674f8600c2 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -328,7 +328,9 @@ static uint gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf)
GLenum data_type, internal_format;
if (main_ibuf->rect_float) {
data_type = GL_FLOAT;
- internal_format = GL_RGBA16F;
+ internal_format = (!(main_ibuf->flags & IB_halffloat) && (ima->flag & IMA_HIGH_BITDEPTH)) ?
+ GL_RGBA32F :
+ GL_RGBA16F;
}
else {
data_type = GL_UNSIGNED_BYTE;
@@ -472,6 +474,7 @@ static uint gpu_texture_create_from_ibuf(Image *ima, ImBuf *ibuf, int textarget)
{
uint bindcode = 0;
const bool mipmap = GPU_get_mipmap();
+ const bool half_float = (ibuf->flags & IB_halffloat) != 0;
#ifdef WITH_DDS
if (ibuf->ftype == IMB_FTYPE_DDS) {
@@ -536,6 +539,7 @@ static uint gpu_texture_create_from_ibuf(Image *ima, ImBuf *ibuf, int textarget)
ibuf->y,
textarget,
mipmap,
+ half_float,
compress_as_srgb,
ima);
@@ -1043,6 +1047,7 @@ void GPU_create_gl_tex(uint *bind,
int recth,
int textarget,
bool mipmap,
+ bool half_float,
bool use_srgb,
Image *ima)
{
@@ -1072,7 +1077,9 @@ void GPU_create_gl_tex(uint *bind,
glGenTextures(1, (GLuint *)bind);
glBindTexture(textarget, *bind);
- GLenum internal_format = (frect) ? GL_RGBA16F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
+ GLenum float_format = (!half_float && (ima && (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 (frect) {
@@ -1236,18 +1243,21 @@ void GPU_create_gl_tex_compressed(unsigned int *bind, int textarget, Image *ima,
const bool use_srgb = !(IMB_colormanagement_space_is_data(ibuf->rect_colorspace) ||
IMB_colormanagement_space_is_scene_linear(ibuf->rect_colorspace));
const bool mipmap = GPU_get_mipmap();
+ const bool half_float = (ibuf->flags & IB_halffloat) != 0;
#ifndef WITH_DDS
(void)ibuf;
/* Fall back to uncompressed if DDS isn't enabled */
- GPU_create_gl_tex(bind, ibuf->rect, NULL, ibuf->x, ibuf->y, textarget, mipmap, use_srgb, ima);
+ GPU_create_gl_tex(
+ bind, ibuf->rect, NULL, ibuf->x, ibuf->y, textarget, mipmap, half_float, use_srgb, ima);
#else
glGenTextures(1, (GLuint *)bind);
glBindTexture(textarget, *bind);
if (textarget == GL_TEXTURE_2D && GPU_upload_dxt_texture(ibuf, use_srgb) == 0) {
glDeleteTextures(1, (GLuint *)bind);
- GPU_create_gl_tex(bind, ibuf->rect, NULL, ibuf->x, ibuf->y, textarget, mipmap, use_srgb, ima);
+ GPU_create_gl_tex(
+ bind, ibuf->rect, NULL, ibuf->x, ibuf->y, textarget, mipmap, half_float, use_srgb, ima);
}
glBindTexture(textarget, 0);