diff options
20 files changed, 92 insertions, 98 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index 64585604bbd..96eaf541cae 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -136,7 +136,7 @@ static void BASIC_engine_init(void *vedata) #ifdef USE_DEPTH if (DRW_state_is_fbo()) { const float *viewport_size = DRW_viewport_size_get(); - DRWFboTexture tex = {&txl->depth_dup, DRW_BUF_DEPTH_24, 0}; + DRWFboTexture tex = {&txl->depth_dup, DRW_TEX_DEPTH_24, 0}; DRW_framebuffer_init(&fbl->dupli_depth, &draw_engine_basic_type, (int)viewport_size[0], (int)viewport_size[1], &tex, 1); diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c index 3d692c0b3d9..ff0c37aa623 100644 --- a/source/blender/draw/engines/clay/clay_engine.c +++ b/source/blender/draw/engines/clay/clay_engine.c @@ -369,7 +369,7 @@ static void CLAY_engine_init(void *vedata) if (DRW_state_is_fbo()) { const float *viewport_size = DRW_viewport_size_get(); - DRWFboTexture tex = {&e_data.depth_dup, DRW_BUF_DEPTH_24, DRW_TEX_TEMP}; + DRWFboTexture tex = {&e_data.depth_dup, DRW_TEX_DEPTH_24, DRW_TEX_TEMP}; DRW_framebuffer_init(&fbl->dupli_depth, &draw_engine_clay_type, (int)viewport_size[0], (int)viewport_size[1], &tex, 1); diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 0a86fc1afb4..b19bbce801c 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -178,7 +178,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects = stl->effects; - effects->enabled_effects = 0; + int enabled_effects = 0; #if ENABLE_EFFECT_MOTION_BLUR if (BKE_collection_engine_property_value_get_bool(props, "motion_blur_enable")) { @@ -207,7 +207,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) invert_m4(effects->current_ndc_to_world); effects->motion_blur_samples = BKE_collection_engine_property_value_get_int(props, "motion_blur_samples"); - effects->enabled_effects |= EFFECT_MOTION_BLUR; + enabled_effects |= EFFECT_MOTION_BLUR; } } } @@ -228,7 +228,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->blit_texel_size[0] = 1.0f / (float)blitsize[0]; effects->blit_texel_size[1] = 1.0f / (float)blitsize[1]; - DRWFboTexture tex_blit = {&txl->bloom_blit, DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex_blit = {&txl->bloom_blit, DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->bloom_blit_fb, &draw_engine_eevee_type, (int)blitsize[0], (int)blitsize[1], &tex_blit, 1); @@ -263,7 +263,7 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->downsamp_texel_size[i][0] = 1.0f / (float)texsize[0]; effects->downsamp_texel_size[i][1] = 1.0f / (float)texsize[1]; - DRWFboTexture tex_bloom = {&txl->bloom_downsample[i], DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex_bloom = {&txl->bloom_downsample[i], DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->bloom_down_fb[i], &draw_engine_eevee_type, (int)texsize[0], (int)texsize[1], &tex_bloom, 1); @@ -276,13 +276,13 @@ void EEVEE_effects_init(EEVEE_Data *vedata) texsize[0] = MAX2(texsize[0], 2); texsize[1] = MAX2(texsize[1], 2); - DRWFboTexture tex_bloom = {&txl->bloom_upsample[i], DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex_bloom = {&txl->bloom_upsample[i], DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->bloom_accum_fb[i], &draw_engine_eevee_type, (int)texsize[0], (int)texsize[1], &tex_bloom, 1); } - effects->enabled_effects |= EFFECT_BLOOM; + enabled_effects |= EFFECT_BLOOM; } #endif /* ENABLE_EFFECT_BLOOM */ @@ -298,16 +298,31 @@ void EEVEE_effects_init(EEVEE_Data *vedata) int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2}; + struct GPUTexture **dof_down_near = &txl->dof_down_near; + + /* Reuse buffer from Bloom if available */ + /* WATCH IT : must have the same size */ + if ((enabled_effects & EFFECT_BLOOM) != 0) { + dof_down_near = &txl->bloom_downsample[0]; /* should always exists */ + } + else if ((effects->enabled_effects & EFFECT_BLOOM) != 0) { + /* if framebuffer was configured to share buffer with bloom last frame */ + if (fbl->dof_down_fb != NULL) { + DRW_framebuffer_free(fbl->dof_down_fb); + fbl->dof_down_fb = NULL; + } + } + /* Setup buffers */ - DRWFboTexture tex_down[3] = {{&txl->dof_down_near, DRW_BUF_RGBA_16, 0}, - {&txl->dof_down_far, DRW_BUF_RGBA_16, 0}, - {&txl->dof_coc, DRW_BUF_RG_16, 0}}; + DRWFboTexture tex_down[3] = {{dof_down_near, DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}, /* filter to not interfeer with bloom */ + {&txl->dof_down_far, DRW_TEX_RGB_11_11_10, 0}, + {&txl->dof_coc, DRW_TEX_RG_16, 0}}; DRW_framebuffer_init(&fbl->dof_down_fb, &draw_engine_eevee_type, buffer_size[0], buffer_size[1], tex_down, 3); - DRWFboTexture tex_scatter_far = {&txl->dof_far_blur, DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex_scatter_far = {&txl->dof_far_blur, DRW_TEX_RGBA_16, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->dof_scatter_far_fb, &draw_engine_eevee_type, buffer_size[0], buffer_size[1], &tex_scatter_far, 1); - DRWFboTexture tex_scatter_near = {&txl->dof_near_blur, DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex_scatter_near = {&txl->dof_near_blur, DRW_TEX_RGBA_16, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->dof_scatter_near_fb, &draw_engine_eevee_type, buffer_size[0], buffer_size[1], &tex_scatter_near, 1); /* Parameters */ @@ -341,15 +356,17 @@ void EEVEE_effects_init(EEVEE_Data *vedata) effects->dof_bokeh[2] = ratio; effects->dof_bokeh[3] = BKE_collection_engine_property_value_get_float(props, "bokeh_max_size"); - effects->enabled_effects |= EFFECT_DOF; + enabled_effects |= EFFECT_DOF; } } #endif /* ENABLE_EFFECT_DOF */ + effects->enabled_effects = enabled_effects; + /* Only allocate if at least one effect is activated */ if (effects->enabled_effects != 0) { /* Ping Pong buffer */ - DRWFboTexture tex = {&txl->color_post, DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex = {&txl->color_post, DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}; DRW_framebuffer_init(&fbl->effect_fb, &draw_engine_eevee_type, (int)viewport_size[0], (int)viewport_size[1], @@ -538,7 +555,13 @@ void EEVEE_draw_effects(EEVEE_Data *vedata) DRW_draw_pass(psl->dof_scatter); /* Scatter Near */ - effects->unf_source_buffer = txl->dof_down_near; + if ((effects->enabled_effects & EFFECT_BLOOM) != 0) { + /* Reuse bloom half res buffer */ + effects->unf_source_buffer = txl->bloom_downsample[0]; + } + else { + effects->unf_source_buffer = txl->dof_down_near; + } copy_v2_fl2(effects->dof_layer_select, 1.0f, 0.0f); DRW_framebuffer_bind(fbl->dof_scatter_near_fb); DRW_framebuffer_clear(true, false, false, clear_col, 0.0f); diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 7311ec5a459..9b4a7a15630 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -165,7 +165,7 @@ static struct GPUTexture *create_ggx_lut_texture(int UNUSED(w), int UNUSED(h)) tex = DRW_texture_create_2D(w, h, DRW_TEX_RG_16, DRW_TEX_FILTER, (float *)texels); - DRWFboTexture tex_filter = {&tex, DRW_BUF_RG_16, DRW_TEX_FILTER}; + DRWFboTexture tex_filter = {&tex, DRW_TEX_RG_16, DRW_TEX_FILTER}; DRW_framebuffer_init(&fb, &draw_engine_eevee_type, w, h, &tex_filter, 1); DRW_framebuffer_bind(fb); @@ -212,7 +212,7 @@ static void EEVEE_engine_init(void *ved) EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_StorageList *stl = vedata->stl; - DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_16, DRW_TEX_FILTER}; + DRWFboTexture tex = {&txl->color, DRW_TEX_RGB_11_11_10, DRW_TEX_FILTER}; const float *viewport_size = DRW_viewport_size_get(); DRW_framebuffer_init(&fbl->main, &draw_engine_eevee_type, diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index bec3d8a047a..aeeb25ca1c0 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -167,13 +167,13 @@ void EEVEE_lights_cache_finish(EEVEE_StorageList *stl, EEVEE_TextureList *txl, E } } - DRWFboTexture tex_cube = {&txl->shadow_depth_cube_pool, DRW_BUF_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; + DRWFboTexture tex_cube = {&txl->shadow_depth_cube_pool, DRW_TEX_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; DRW_framebuffer_init(&fbl->shadow_cube_fb, &draw_engine_eevee_type, 512, 512, &tex_cube, 1); - DRWFboTexture tex_map = {&txl->shadow_depth_map_pool, DRW_BUF_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; + DRWFboTexture tex_map = {&txl->shadow_depth_map_pool, DRW_TEX_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; DRW_framebuffer_init(&fbl->shadow_map_fb, &draw_engine_eevee_type, 512, 512, &tex_map, 1); - DRWFboTexture tex_cascade = {&txl->shadow_depth_cascade_pool, DRW_BUF_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; + DRWFboTexture tex_cascade = {&txl->shadow_depth_cascade_pool, DRW_TEX_DEPTH_24, DRW_TEX_FILTER | DRW_TEX_COMPARE}; DRW_framebuffer_init(&fbl->shadow_cascade_fb, &draw_engine_eevee_type, 512, 512, &tex_cascade, 1); } diff --git a/source/blender/draw/engines/eevee/eevee_probes.c b/source/blender/draw/engines/eevee/eevee_probes.c index b3ca21d17cc..8a97373f9e4 100644 --- a/source/blender/draw/engines/eevee/eevee_probes.c +++ b/source/blender/draw/engines/eevee/eevee_probes.c @@ -54,53 +54,26 @@ void EEVEE_probes_init(EEVEE_Data *vedata) } if (!txl->probe_rt) { - float *test_tex; - const float face_col[6][4] = {{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f, 1.0f}, - {1.0f, 0.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 1.0f, 1.0f}}; - - test_tex = MEM_mallocN(sizeof(float) * 6 * PROBE_SIZE * PROBE_SIZE * 4, "test tex"); - - for (int i = 0; i < 6; ++i) { - for (int j = 0; j < PROBE_SIZE * PROBE_SIZE; ++j) { - copy_v4_v4(test_tex + i * PROBE_SIZE * PROBE_SIZE * 4 + j * 4, face_col[i]); - } - } - - txl->probe_rt = DRW_texture_create_cube(PROBE_SIZE, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP, (float *)test_tex); + txl->probe_rt = DRW_texture_create_cube(PROBE_SIZE, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL); txl->probe_depth_rt = DRW_texture_create_cube(PROBE_SIZE, DRW_TEX_DEPTH_24, DRW_TEX_FILTER, NULL); - - MEM_freeN(test_tex); } - DRWFboTexture tex_probe[2] = {{&txl->probe_depth_rt, DRW_BUF_DEPTH_24, DRW_TEX_FILTER}, - {&txl->probe_rt, DRW_BUF_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}}; + DRWFboTexture tex_probe[2] = {{&txl->probe_depth_rt, DRW_TEX_DEPTH_24, DRW_TEX_FILTER}, + {&txl->probe_rt, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}}; DRW_framebuffer_init(&fbl->probe_fb, &draw_engine_eevee_type, PROBE_SIZE, PROBE_SIZE, tex_probe, 2); if (!txl->probe_pool) { - float *test_tex; - const float face_col[6][4] = {{1.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 1.0f, 1.0f}, - {1.0f, 0.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 1.0f, 1.0f}}; - - test_tex = MEM_mallocN(sizeof(float) * 6 * PROBE_SIZE * PROBE_SIZE * 4, "test tex"); - - for (int i = 0; i < 6; ++i) { - for (int j = 0; j < PROBE_SIZE * PROBE_SIZE; ++j) { - copy_v4_v4(test_tex + i * PROBE_SIZE * PROBE_SIZE * 4 + j * 4, face_col[i]); - } - } - /* TODO array */ - txl->probe_pool = DRW_texture_create_cube(PROBE_SIZE, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP, (float *)test_tex); - MEM_freeN(test_tex); + txl->probe_pool = DRW_texture_create_cube(PROBE_SIZE, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL); } - DRWFboTexture tex_filter = {&txl->probe_pool, DRW_BUF_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}; + DRWFboTexture tex_filter = {&txl->probe_pool, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}; DRW_framebuffer_init(&fbl->probe_filter_fb, &draw_engine_eevee_type, PROBE_SIZE, PROBE_SIZE, &tex_filter, 1); /* Spherical Harmonic Buffer */ - DRWFboTexture tex_sh = {&txl->probe_sh, DRW_BUF_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}; + DRWFboTexture tex_sh = {&txl->probe_sh, DRW_TEX_RGBA_16, DRW_TEX_FILTER | DRW_TEX_MIPMAP}; DRW_framebuffer_init(&fbl->probe_sh_fb, &draw_engine_eevee_type, 9, 1, &tex_sh, 1); } diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index dbf8a39d0d1..5a3119494b2 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -131,6 +131,7 @@ typedef enum { DRW_TEX_RGBA_8, DRW_TEX_RGBA_16, DRW_TEX_RGBA_32, + DRW_TEX_RGB_11_11_10, DRW_TEX_RGB_8, DRW_TEX_RGB_16, DRW_TEX_RGB_32, @@ -176,20 +177,6 @@ void DRW_uniformbuffer_update(struct GPUUniformBuffer *ubo, const void *data); void DRW_uniformbuffer_free(struct GPUUniformBuffer *ubo); /* Buffers */ - -/* DRWFboTexture->format */ -#define DRW_BUF_DEPTH_16 1 -#define DRW_BUF_DEPTH_24 2 -#define DRW_BUF_R_8 3 -#define DRW_BUF_R_16 4 -#define DRW_BUF_R_32 5 -#define DRW_BUF_RG_8 6 -#define DRW_BUF_RG_16 7 -#define DRW_BUF_RG_32 8 -#define DRW_BUF_RGBA_8 12 -#define DRW_BUF_RGBA_16 13 -#define DRW_BUF_RGBA_32 14 - #define MAX_FBO_TEX 5 typedef struct DRWFboTexture { @@ -201,6 +188,7 @@ typedef struct DRWFboTexture { void DRW_framebuffer_init( struct GPUFrameBuffer **fb, void *engine_type, int width, int height, DRWFboTexture textures[MAX_FBO_TEX], int textures_len); +void DRW_framebuffer_free(struct GPUFrameBuffer *fb); void DRW_framebuffer_bind(struct GPUFrameBuffer *fb); void DRW_framebuffer_clear(bool color, bool depth, bool stencil, float clear_col[4], float clear_depth); void DRW_framebuffer_read_data(int x, int y, int w, int h, int channels, int slot, float *data); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 2a5b53580ed..5a1c05e3835 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -317,6 +317,7 @@ static void drw_texture_get_format(DRWTextureFormat format, GPUTextureFormat *da case DRW_TEX_RGBA_8: *data_type = GPU_RGBA8; break; case DRW_TEX_RGBA_16: *data_type = GPU_RGBA16F; break; case DRW_TEX_RGB_16: *data_type = GPU_RGB16F; break; + case DRW_TEX_RGB_11_11_10: *data_type = GPU_R11F_G11F_B10F; break; case DRW_TEX_RG_16: *data_type = GPU_RG16F; break; case DRW_TEX_RG_32: *data_type = GPU_RG32F; break; case DRW_TEX_R_8: *data_type = GPU_R8; break; @@ -346,6 +347,7 @@ static void drw_texture_get_format(DRWTextureFormat format, GPUTextureFormat *da case DRW_TEX_RGB_8: case DRW_TEX_RGB_16: case DRW_TEX_RGB_32: + case DRW_TEX_RGB_11_11_10: *channels = 3; break; case DRW_TEX_RG_8: @@ -1854,16 +1856,17 @@ bool DRW_object_is_renderable(Object *ob) static GPUTextureFormat convert_tex_format(int fbo_format, int *channels, bool *is_depth) { - *is_depth = ELEM(fbo_format, DRW_BUF_DEPTH_16, DRW_BUF_DEPTH_24); + *is_depth = ELEM(fbo_format, DRW_TEX_DEPTH_16, DRW_TEX_DEPTH_24); switch (fbo_format) { - case DRW_BUF_RG_16: *channels = 2; return GPU_RG16F; - case DRW_BUF_RGBA_8: *channels = 4; return GPU_RGBA8; - case DRW_BUF_RGBA_16: *channels = 4; return GPU_RGBA16F; - case DRW_BUF_RGBA_32: *channels = 4; return GPU_RGBA32F; - case DRW_BUF_DEPTH_24: *channels = 1; return GPU_DEPTH_COMPONENT24; + case DRW_TEX_RG_16: *channels = 2; return GPU_RG16F; + case DRW_TEX_RGBA_8: *channels = 4; return GPU_RGBA8; + case DRW_TEX_RGBA_16: *channels = 4; return GPU_RGBA16F; + case DRW_TEX_RGBA_32: *channels = 4; return GPU_RGBA32F; + case DRW_TEX_DEPTH_24: *channels = 1; return GPU_DEPTH_COMPONENT24; + case DRW_TEX_RGB_11_11_10: *channels = 3; return GPU_R11F_G11F_B10F; default: - BLI_assert(false); + BLI_assert(false && "Texture format unsupported as render target!"); *channels = 4; return GPU_RGBA8; } } @@ -1901,7 +1904,7 @@ void DRW_framebuffer_init( ++color_attachment; } - GPU_framebuffer_texture_attach(*fb, *fbotex.tex, color_attachment, 0); + GPU_framebuffer_texture_attach(*fb, *fbotex.tex, color_attachment, 0); } if (!GPU_framebuffer_check_valid(*fb, NULL)) { @@ -1921,6 +1924,11 @@ void DRW_framebuffer_init( } } +void DRW_framebuffer_free(struct GPUFrameBuffer *fb) +{ + GPU_framebuffer_free(fb); +} + void DRW_framebuffer_bind(struct GPUFrameBuffer *fb) { GPU_framebuffer_bind(fb); diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index 7cdaf7c50e6..ae3201fa297 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -140,8 +140,8 @@ static void EDIT_CURVE_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c index 32411ea470d..2993719ee1c 100644 --- a/source/blender/draw/modes/edit_lattice_mode.c +++ b/source/blender/draw/modes/edit_lattice_mode.c @@ -130,8 +130,8 @@ static void EDIT_LATTICE_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index e06aea64be8..286d277f0e3 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -135,8 +135,8 @@ static void EDIT_MESH_engine_init(void *vedata) const float *viewport_size = DRW_viewport_size_get(); DRWFboTexture tex[2] = {{ - &e_data.occlude_wire_depth_tx, DRW_BUF_DEPTH_24, DRW_TEX_TEMP}, - {&e_data.occlude_wire_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP} + &e_data.occlude_wire_depth_tx, DRW_TEX_DEPTH_24, DRW_TEX_TEMP}, + {&e_data.occlude_wire_color_tx, DRW_TEX_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP} }; DRW_framebuffer_init( &fbl->occlude_wire_fb, &draw_engine_edit_mesh_type, diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c index 3bf26ae7adf..a5857ba362a 100644 --- a/source/blender/draw/modes/edit_metaball_mode.c +++ b/source/blender/draw/modes/edit_metaball_mode.c @@ -117,8 +117,8 @@ static void EDIT_METABALL_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/edit_surface_mode.c b/source/blender/draw/modes/edit_surface_mode.c index 0e1049b7a10..577b84e38c6 100644 --- a/source/blender/draw/modes/edit_surface_mode.c +++ b/source/blender/draw/modes/edit_surface_mode.c @@ -117,8 +117,8 @@ static void EDIT_SURFACE_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c index 03da9ebbb94..13c8015e628 100644 --- a/source/blender/draw/modes/edit_text_mode.c +++ b/source/blender/draw/modes/edit_text_mode.c @@ -127,8 +127,8 @@ static void EDIT_TEXT_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index fb0d5bd0a8d..badf532fe2c 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -215,8 +215,8 @@ static void OBJECT_engine_init(void *vedata) if (DRW_state_is_fbo()) { DRWFboTexture tex[2] = { - {&e_data.outlines_depth_tx, DRW_BUF_DEPTH_24, DRW_TEX_TEMP}, - {&e_data.outlines_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP}, + {&e_data.outlines_depth_tx, DRW_TEX_DEPTH_24, DRW_TEX_TEMP}, + {&e_data.outlines_color_tx, DRW_TEX_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP}, }; DRW_framebuffer_init( @@ -224,7 +224,7 @@ static void OBJECT_engine_init(void *vedata) (int)viewport_size[0], (int)viewport_size[1], tex, 2); - DRWFboTexture blur_tex = {&e_data.outlines_blur_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP}; + DRWFboTexture blur_tex = {&e_data.outlines_blur_tx, DRW_TEX_RGBA_8, DRW_TEX_FILTER | DRW_TEX_TEMP}; DRW_framebuffer_init( &fbl->blur, &draw_engine_object_type, (int)viewport_size[0], (int)viewport_size[1], diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c index 39c0b495fd5..d2316534cfe 100644 --- a/source/blender/draw/modes/paint_texture_mode.c +++ b/source/blender/draw/modes/paint_texture_mode.c @@ -117,8 +117,8 @@ static void PAINT_TEXTURE_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/particle_mode.c b/source/blender/draw/modes/particle_mode.c index f1ec8a2ec75..4b63a00d0a5 100644 --- a/source/blender/draw/modes/particle_mode.c +++ b/source/blender/draw/modes/particle_mode.c @@ -111,8 +111,8 @@ static void PARTICLE_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index 7bbf551bcd9..ba9f530ae40 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -121,8 +121,8 @@ static void SCULPT_engine_init(void *vedata) /* Init Framebuffers like this: order is attachment order (for color texs) */ /* - * DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0}, - * {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}}; + * DRWFboTexture tex[2] = {{&txl->depth, DRW_TEX_DEPTH_24, 0}, + * {&txl->color, DRW_TEX_RGBA_8, DRW_TEX_FILTER}}; */ /* DRW_framebuffer_init takes care of checking if diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index b58cffd7214..bd98f4534b3 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -97,11 +97,11 @@ typedef enum GPUTextureFormat { /* Special formats texture & renderbuffer */ #if 0 - GPU_R11F_G11F_B10F, GPU_RGB10_A2, GPU_RGB10_A2UI, GPU_DEPTH32F_STENCIL8, #endif + GPU_R11F_G11F_B10F, GPU_DEPTH24_STENCIL8, /* Texture only format */ diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 4be425b7eb9..12b0fb4c0e2 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -158,6 +158,7 @@ static GLenum gpu_texture_get_format( case GPU_DEPTH24_STENCIL8: case GPU_DEPTH_COMPONENT32F: case GPU_RGBA8: + case GPU_R11F_G11F_B10F: *bytesize = 4; break; case GPU_DEPTH_COMPONENT24: @@ -188,6 +189,7 @@ static GLenum gpu_texture_get_format( case GPU_R16F: return GL_R16F; case GPU_R8: return GL_R8; /* Special formats texture & renderbuffer */ + case GPU_R11F_G11F_B10F: return GL_R11F_G11F_B10F; case GPU_DEPTH24_STENCIL8: return GL_DEPTH24_STENCIL8; /* Texture only format */ /* ** Add Format here **/ |