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:
authorClément Foucault <foucault.clem@gmail.com>2018-01-03 15:15:32 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-01-04 12:43:54 +0300
commitc79216d77df77e10f7ee3fed17836c77eb29da54 (patch)
treefbe99933aec3cbabe0bf8949f751dafc4732b23a /source/blender/gpu
parent6b2989ae7524f6728aa4cdfd2134fbf3dcd31315 (diff)
GPU_offscreen: Add option for high bit depth.
This way we can render in HDR and read the real pixel values.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_framebuffer.h2
-rw-r--r--source/blender/gpu/GPU_texture.h2
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c9
-rw-r--r--source/blender/gpu/intern/gpu_texture.c6
4 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index 705ef1997c1..c58d98c201e 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -83,7 +83,7 @@ void GPU_framebuffer_recursive_downsample(
* - wrapper around framebuffer and texture for simple offscreen drawing
* - changes size if graphics card can't support it */
-GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_out[256]);
+GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool high_bitdepth, char err_out[256]);
void GPU_offscreen_free(GPUOffScreen *ofs);
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save);
void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore);
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 82e215f6fae..3ed9ab4bf2c 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -152,6 +152,8 @@ GPUTexture *GPU_texture_create_2D(int w, int h, const float *pixels, char err_ou
GPUTexture *GPU_texture_create_2D_custom(
int w, int h, int channels, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D_multisample(int w, int h, const float *pixels, int samples, char err_out[256]);
+GPUTexture *GPU_texture_create_2D_custom_multisample(
+ int w, int h, int channels, GPUTextureFormat data_type, const float *pixels, int samples, char err_out[256]);
GPUTexture *GPU_texture_create_2D_array_custom(
int w, int h, int d, int channels, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_3D(int w, int h, int d, const float *pixels, char err_out[256]);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 6830e73cb03..09013cd29bd 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -650,7 +650,7 @@ struct GPUOffScreen {
GPUTexture *depth;
};
-GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_out[256])
+GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool high_bitdepth, char err_out[256])
{
GPUOffScreen *ofs;
@@ -683,7 +683,12 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_
return NULL;
}
- ofs->color = GPU_texture_create_2D_multisample(width, height, NULL, samples, err_out);
+ if (high_bitdepth) {
+ ofs->color = GPU_texture_create_2D_custom_multisample(width, height, 4, GPU_RGBA16F, NULL, samples, err_out);
+ }
+ else {
+ ofs->color = GPU_texture_create_2D_multisample(width, height, NULL, samples, err_out);
+ }
if (!ofs->color) {
GPU_offscreen_free(ofs);
return NULL;
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 252eede8758..bcc0bb2649f 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -663,6 +663,12 @@ GPUTexture *GPU_texture_create_2D_multisample(int w, int h, const float *pixels,
return GPU_texture_create_nD(w, h, 0, 2, pixels, GPU_RGBA8, 4, samples, false, err_out);
}
+GPUTexture *GPU_texture_create_2D_custom_multisample(
+ int w, int h, int channels, GPUTextureFormat data_type, const float *pixels, int samples, char err_out[256])
+{
+ return GPU_texture_create_nD(w, h, 0, 2, pixels, data_type, channels, samples, false, err_out);
+}
+
GPUTexture *GPU_texture_create_2D_array_custom(int w, int h, int d, int channels, GPUTextureFormat data_type, const float *pixels, char err_out[256])
{
return GPU_texture_create_nD(w, h, d, 2, pixels, data_type, channels, 0, false, err_out);