Eevee: fix HDR buffer
This commit is contained in:
@@ -53,7 +53,7 @@ static void EEVEE_engine_init(void *vedata)
|
|||||||
EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
|
EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
|
||||||
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
||||||
|
|
||||||
DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_32};
|
DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_16};
|
||||||
|
|
||||||
float *viewport_size = DRW_viewport_size_get();
|
float *viewport_size = DRW_viewport_size_get();
|
||||||
DRW_framebuffer_init(&fbl->main,
|
DRW_framebuffer_init(&fbl->main,
|
||||||
|
@@ -1265,6 +1265,18 @@ void *DRW_render_settings_get(Scene *scene, const char *engine_name)
|
|||||||
}
|
}
|
||||||
/* ****************************************** Framebuffers ******************************************/
|
/* ****************************************** Framebuffers ******************************************/
|
||||||
|
|
||||||
|
static GPUTextureFormat convert_tex_format(int fbo_format, int *channels)
|
||||||
|
{
|
||||||
|
switch (fbo_format) {
|
||||||
|
case DRW_BUF_RGBA_8: *channels = 4; return GPU_RGBA8;
|
||||||
|
case DRW_BUF_RGBA_16: *channels = 4; return GPU_RGBA16F;
|
||||||
|
case DRW_BUF_DEPTH_24: *channels = 1; return GPU_DEPTH_COMPONENT24;
|
||||||
|
default:
|
||||||
|
BLI_assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRWFboTexture textures[MAX_FBO_TEX],
|
void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRWFboTexture textures[MAX_FBO_TEX],
|
||||||
int texnbr)
|
int texnbr)
|
||||||
{
|
{
|
||||||
@@ -1278,6 +1290,9 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRW
|
|||||||
DRWFboTexture fbotex = textures[i];
|
DRWFboTexture fbotex = textures[i];
|
||||||
|
|
||||||
if (!*fbotex.tex) {
|
if (!*fbotex.tex) {
|
||||||
|
int channels;
|
||||||
|
GPUTextureFormat gpu_format = convert_tex_format(fbotex.format, &channels);
|
||||||
|
|
||||||
/* TODO refine to opengl formats */
|
/* TODO refine to opengl formats */
|
||||||
if (fbotex.format == DRW_BUF_DEPTH_16 ||
|
if (fbotex.format == DRW_BUF_DEPTH_16 ||
|
||||||
fbotex.format == DRW_BUF_DEPTH_24)
|
fbotex.format == DRW_BUF_DEPTH_24)
|
||||||
@@ -1287,7 +1302,7 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRW
|
|||||||
GPU_texture_filter_mode(*fbotex.tex, false);
|
GPU_texture_filter_mode(*fbotex.tex, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*fbotex.tex = GPU_texture_create_2D(width, height, NULL, NULL);
|
*fbotex.tex = GPU_texture_create_2D_custom(width, height, channels, gpu_format, NULL, NULL);
|
||||||
++color_attachment;
|
++color_attachment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user