diff --git a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc index 46456a81922..3f0644d7ca5 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc +++ b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc @@ -65,7 +65,7 @@ void Instance::init() if (!dummy_depth.is_valid()) { const float pixels[1] = {1.0f}; dummy_depth.ensure_2d( - GPU_DEPTH_COMPONENT24, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0]); + GPU_DEPTH_COMPONENT32F, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0]); } /* Resize and reset memory-blocks. */ @@ -230,7 +230,7 @@ void Instance::begin_sync() const float2 size = draw_ctx->viewport_size_get(); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT; - this->snapshot_depth_tx.ensure_2d(GPU_DEPTH24_STENCIL8, int2(size), usage); + this->snapshot_depth_tx.ensure_2d(GPU_DEPTH32F_STENCIL8, int2(size), usage); this->snapshot_color_tx.ensure_2d(GPU_R11F_G11F_B10F, int2(size), usage); this->snapshot_reveal_tx.ensure_2d(GPU_R11F_G11F_B10F, int2(size), usage); @@ -624,7 +624,7 @@ void Instance::acquire_resources() eGPUTextureFormat format = this->use_signed_fb ? GPU_RGBA16F : GPU_R11F_G11F_B10F; - this->depth_tx.acquire(size, GPU_DEPTH24_STENCIL8); + this->depth_tx.acquire(size, GPU_DEPTH32F_STENCIL8); this->color_tx.acquire(size, format); this->reveal_tx.acquire(size, format); @@ -654,7 +654,7 @@ void Instance::acquire_resources() /* Use high quality format for render. */ eGPUTextureFormat mask_format = this->is_render ? GPU_R16 : GPU_R8; /* We need an extra depth to not disturb the normal drawing. */ - this->mask_depth_tx.acquire(size, GPU_DEPTH24_STENCIL8); + this->mask_depth_tx.acquire(size, GPU_DEPTH32F_STENCIL8); /* The mask_color_tx is needed for frame-buffer completeness. */ this->mask_color_tx.acquire(size, GPU_R8); this->mask_tx.acquire(size, mask_format); diff --git a/source/blender/draw/engines/gpencil/gpencil_render.cc b/source/blender/draw/engines/gpencil/gpencil_render.cc index 94e2b64bc34..0da98a95d50 100644 --- a/source/blender/draw/engines/gpencil/gpencil_render.cc +++ b/source/blender/draw/engines/gpencil/gpencil_render.cc @@ -110,7 +110,7 @@ static void render_init_buffers(const DRWContext *draw_ctx, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; inst.render_depth_tx.ensure_2d( - GPU_DEPTH_COMPONENT24, int2(size), usage, do_region ? nullptr : pix_z); + GPU_DEPTH_COMPONENT32F, int2(size), usage, do_region ? nullptr : pix_z); } if (inst.render_color_tx.is_valid() && !do_clear_col) { GPU_texture_update(inst.render_color_tx, GPU_DATA_FLOAT, pix_col); diff --git a/source/blender/draw/engines/overlay/overlay_instance.cc b/source/blender/draw/engines/overlay/overlay_instance.cc index 5260ce79938..8c4191c81ab 100644 --- a/source/blender/draw/engines/overlay/overlay_instance.cc +++ b/source/blender/draw/engines/overlay/overlay_instance.cc @@ -682,7 +682,7 @@ void Instance::end_sync() size.x, size.y, 1, - GPU_DEPTH24_STENCIL8, + GPU_DEPTH32F_STENCIL8, GPU_TEXTURE_USAGE_GENERAL, nullptr); } diff --git a/source/blender/draw/engines/overlay/overlay_outline.hh b/source/blender/draw/engines/overlay/overlay_outline.hh index d412a76ba39..157e2c58023 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.hh +++ b/source/blender/draw/engines/overlay/overlay_outline.hh @@ -239,7 +239,7 @@ class Outline : Overlay { int2 render_size = int2(res.depth_tx.size()); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - tmp_depth_tx_.acquire(render_size, GPU_DEPTH24_STENCIL8, usage); + tmp_depth_tx_.acquire(render_size, GPU_DEPTH32F_STENCIL8, usage); object_id_tx_.acquire(render_size, GPU_R16UI, usage); prepass_fb_.ensure(GPU_ATTACHMENT_TEXTURE(tmp_depth_tx_), diff --git a/source/blender/draw/engines/overlay/overlay_private.hh b/source/blender/draw/engines/overlay/overlay_private.hh index cfaab973e44..5c9846d080d 100644 --- a/source/blender/draw/engines/overlay/overlay_private.hh +++ b/source/blender/draw/engines/overlay/overlay_private.hh @@ -775,16 +775,16 @@ struct Resources : public select::SelectMap { if (state.xray_enabled) { /* For X-ray we render the scene to a separate depth buffer. */ - this->xray_depth_tx.acquire(render_size, GPU_DEPTH24_STENCIL8); + this->xray_depth_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); this->depth_target_tx.wrap(this->xray_depth_tx); /* TODO(fclem): Remove mandatory allocation. */ - this->xray_depth_in_front_tx.acquire(render_size, GPU_DEPTH24_STENCIL8); + this->xray_depth_in_front_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); this->depth_target_in_front_tx.wrap(this->xray_depth_in_front_tx); } else { /* TODO(fclem): Remove mandatory allocation. */ if (!this->depth_in_front_tx.is_valid()) { - this->depth_in_front_alloc_tx.acquire(render_size, GPU_DEPTH24_STENCIL8); + this->depth_in_front_alloc_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); this->depth_in_front_tx.wrap(this->depth_in_front_alloc_tx); } this->depth_target_tx.wrap(this->depth_tx); diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.hh b/source/blender/draw/engines/overlay/overlay_wireframe.hh index 50e15464494..4f800a5b8d3 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.hh +++ b/source/blender/draw/engines/overlay/overlay_wireframe.hh @@ -260,7 +260,7 @@ class Wireframe : Overlay { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; int2 render_size = int2(depth_tx.size()); - tmp_depth_tx_.acquire(render_size, GPU_DEPTH24_STENCIL8, usage); + tmp_depth_tx_.acquire(render_size, GPU_DEPTH32F_STENCIL8, usage); /* WORKAROUND: Nasty framebuffer copy. * We should find a way to have nice wireframe without this. */ diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc index c098f64a203..23888013bb5 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc @@ -149,7 +149,7 @@ void AntiAliasingPass::sync(const SceneState &scene_state, SceneResources &resou taa_accumulation_tx_.ensure_2d(GPU_RGBA16F, scene_state.resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); - sample0_depth_tx_.ensure_2d(GPU_DEPTH24_STENCIL8, + sample0_depth_tx_.ensure_2d(GPU_DEPTH32F_STENCIL8, scene_state.resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); @@ -260,7 +260,7 @@ void AntiAliasingPass::draw(const DRWContext *draw_ctx, GPU_texture_copy(sample0_depth_tx_, resources.depth_tx); if (resources.depth_in_front_tx.is_valid()) { sample0_depth_in_front_tx_.ensure_2d( - GPU_DEPTH24_STENCIL8, scene_state.resolution, GPU_TEXTURE_USAGE_ATTACHMENT); + GPU_DEPTH32F_STENCIL8, scene_state.resolution, GPU_TEXTURE_USAGE_ATTACHMENT); GPU_texture_copy(sample0_depth_in_front_tx_, resources.depth_in_front_tx); } else { diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc index 3dae245dd6b..7b04582a269 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.cc +++ b/source/blender/draw/engines/workbench/workbench_engine.cc @@ -589,9 +589,9 @@ static bool workbench_render_framebuffers_init(const DRWContext *draw_ctx) dtxl->color = GPU_texture_create_2d( "txl.color", size.x, size.y, 1, GPU_RGBA16F, usage, nullptr); dtxl->depth = GPU_texture_create_2d( - "txl.depth", size.x, size.y, 1, GPU_DEPTH24_STENCIL8, usage, nullptr); + "txl.depth", size.x, size.y, 1, GPU_DEPTH32F_STENCIL8, usage, nullptr); dtxl->depth_in_front = GPU_texture_create_2d( - "txl.depth_in_front", size.x, size.y, 1, GPU_DEPTH24_STENCIL8, usage, nullptr); + "txl.depth_in_front", size.x, size.y, 1, GPU_DEPTH32F_STENCIL8, usage, nullptr); } if (!(dtxl->depth && dtxl->color && dtxl->depth_in_front)) { diff --git a/source/blender/draw/engines/workbench/workbench_mesh_passes.cc b/source/blender/draw/engines/workbench/workbench_mesh_passes.cc index 361c03ae442..add561a91f1 100644 --- a/source/blender/draw/engines/workbench/workbench_mesh_passes.cc +++ b/source/blender/draw/engines/workbench/workbench_mesh_passes.cc @@ -186,7 +186,7 @@ void OpaquePass::draw(Manager &manager, } if (shadow_pass) { - shadow_depth_stencil_tx.ensure_2d(GPU_DEPTH24_STENCIL8, + shadow_depth_stencil_tx.ensure_2d(GPU_DEPTH32F_STENCIL8, resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | diff --git a/source/blender/draw/intern/draw_context.cc b/source/blender/draw/intern/draw_context.cc index d28b5a37d88..8aaf9fa527f 100644 --- a/source/blender/draw/intern/draw_context.cc +++ b/source/blender/draw/intern/draw_context.cc @@ -1624,7 +1624,7 @@ static void draw_select_framebuffer_depth_only_setup(const int size[2]) if (g_select_buffer.texture_depth == nullptr) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; g_select_buffer.texture_depth = GPU_texture_create_2d( - "select_depth", size[0], size[1], 1, GPU_DEPTH_COMPONENT24, usage, nullptr); + "select_depth", size[0], size[1], 1, GPU_DEPTH_COMPONENT32F, usage, nullptr); GPU_framebuffer_texture_attach( g_select_buffer.framebuffer_depth_only, g_select_buffer.texture_depth, 0, 0); diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 832807ec698..83dcdf8cda9 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -749,7 +749,7 @@ GPUOffScreen *GPU_offscreen_create(int width, /* Format view flag is needed by Workbench Volumes to read the stencil view. */ eGPUTextureUsage depth_usage = usage | GPU_TEXTURE_USAGE_FORMAT_VIEW; ofs->depth = GPU_texture_create_2d( - "ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, depth_usage, nullptr); + "ofs_depth", width, height, 1, GPU_DEPTH32F_STENCIL8, depth_usage, nullptr); } if ((with_depth_buffer && !ofs->depth) || !ofs->color) { diff --git a/source/blender/gpu/intern/gpu_viewport.cc b/source/blender/gpu/intern/gpu_viewport.cc index d9fcad0393c..df449f08594 100644 --- a/source/blender/gpu/intern/gpu_viewport.cc +++ b/source/blender/gpu/intern/gpu_viewport.cc @@ -167,7 +167,7 @@ static void gpu_viewport_textures_create(GPUViewport *viewport) viewport->depth_tx = GPU_texture_create_2d("dtxl_depth", UNPACK2(size), 1, - GPU_DEPTH24_STENCIL8, + GPU_DEPTH32F_STENCIL8, usage | GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_FORMAT_VIEW, nullptr);