From 489dba16c32c643160cfa5ef3c266b620a1a51b8 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 30 Apr 2024 14:56:13 -0500 Subject: [PATCH] Temporarily remove uses of RHI renderbuffers OpenGL does not have renderbuffers until OpenGL 3.0 (contrast to GLES which has them starting with 2.0). In order to allow people with older GPUs to play the game for now (until ANGLE+GLES), I am removing the use of renderbuffers in the game code. They aren't needed because nothing actually needs a depth or stencil test yet. Once HWR2 gets rolling, I'll add these back. Fixes KartKrew/RingRacers#1 --- src/hwr2/pass_resource_managers.cpp | 9 --------- src/hwr2/pass_resource_managers.hpp | 2 -- src/hwr2/upscale_backbuffer.cpp | 10 +--------- src/hwr2/upscale_backbuffer.hpp | 1 - 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/hwr2/pass_resource_managers.cpp b/src/hwr2/pass_resource_managers.cpp index 440c0453e..d7ace5d9b 100644 --- a/src/hwr2/pass_resource_managers.cpp +++ b/src/hwr2/pass_resource_managers.cpp @@ -40,11 +40,6 @@ void FramebufferManager::prepass(Rhi& rhi) rhi.destroy_texture(main_color_); main_color_ = kNullHandle; } - if (main_depth_ != kNullHandle) - { - rhi.destroy_renderbuffer(main_depth_); - main_depth_ = kNullHandle; - } if (post_colors_[0] != kNullHandle) { @@ -81,10 +76,6 @@ void FramebufferManager::prepass(Rhi& rhi) TextureWrapMode::kClamp }); } - if (main_depth_ == kNullHandle) - { - main_depth_ = rhi.create_renderbuffer({current_width, current_height}); - } if (post_colors_[0] == kNullHandle) { diff --git a/src/hwr2/pass_resource_managers.hpp b/src/hwr2/pass_resource_managers.hpp index 62f368070..30e93279e 100644 --- a/src/hwr2/pass_resource_managers.hpp +++ b/src/hwr2/pass_resource_managers.hpp @@ -24,7 +24,6 @@ namespace srb2::hwr2 class FramebufferManager final : public Pass { rhi::Handle main_color_; - rhi::Handle main_depth_; std::array, 2> post_colors_; rhi::Handle wipe_start_color_; rhi::Handle wipe_end_color_; @@ -52,7 +51,6 @@ public: void reset_post() noexcept { first_postprocess_ = true; } rhi::Handle main_color() const noexcept { return main_color_; } - rhi::Handle main_depth() const noexcept { return main_depth_; } rhi::Handle current_post_color() const noexcept { return post_colors_[post_index_]; } diff --git a/src/hwr2/upscale_backbuffer.cpp b/src/hwr2/upscale_backbuffer.cpp index 5d4d94d16..790f5b332 100644 --- a/src/hwr2/upscale_backbuffer.cpp +++ b/src/hwr2/upscale_backbuffer.cpp @@ -41,7 +41,7 @@ void UpscaleBackbuffer::begin_pass(Rhi& rhi, Handle ctx) auto new_renderpass = [&rhi = rhi](AttachmentLoadOp load_op, AttachmentStoreOp store_op) { RenderPassDesc desc {}; - desc.use_depth_stencil = true; + desc.use_depth_stencil = false; desc.color_load_op = load_op; desc.color_store_op = store_op; desc.depth_load_op = load_op; @@ -58,11 +58,6 @@ void UpscaleBackbuffer::begin_pass(Rhi& rhi, Handle ctx) rhi.destroy_texture(color_); color_ = kNullHandle; } - if (depth_) - { - rhi.destroy_renderbuffer(depth_); - depth_ = kNullHandle; - } TextureDesc color_tex {}; color_tex.format = TextureFormat::kRGBA; @@ -76,8 +71,6 @@ void UpscaleBackbuffer::begin_pass(Rhi& rhi, Handle ctx) depth_tex.width = vid_width; depth_tex.height = vid_height; - depth_ = rhi.create_renderbuffer(depth_tex); - if (!renderpass_clear_) { renderpass_clear_ = new_renderpass(AttachmentLoadOp::kClear, AttachmentStoreOp::kStore); @@ -95,6 +88,5 @@ void UpscaleBackbuffer::begin_pass(Rhi& rhi, Handle ctx) begin_info.render_pass = remake ? renderpass_clear_ : renderpass_; begin_info.clear_color = {0, 0, 0, 1}; begin_info.color_attachment = color_; - begin_info.depth_stencil_attachment = depth_; rhi.begin_render_pass(ctx, begin_info); } diff --git a/src/hwr2/upscale_backbuffer.hpp b/src/hwr2/upscale_backbuffer.hpp index 6e806a90e..a60f30172 100644 --- a/src/hwr2/upscale_backbuffer.hpp +++ b/src/hwr2/upscale_backbuffer.hpp @@ -19,7 +19,6 @@ namespace srb2::hwr2 class UpscaleBackbuffer { rhi::Handle color_; - rhi::Handle depth_; rhi::Handle renderpass_; rhi::Handle renderpass_clear_;