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
This commit is contained in:
Eidolon 2024-04-30 14:56:13 -05:00
parent d90a566ad7
commit 489dba16c3
4 changed files with 1 additions and 21 deletions

View file

@ -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)
{

View file

@ -24,7 +24,6 @@ namespace srb2::hwr2
class FramebufferManager final : public Pass
{
rhi::Handle<rhi::Texture> main_color_;
rhi::Handle<rhi::Renderbuffer> main_depth_;
std::array<rhi::Handle<rhi::Texture>, 2> post_colors_;
rhi::Handle<rhi::Texture> wipe_start_color_;
rhi::Handle<rhi::Texture> wipe_end_color_;
@ -52,7 +51,6 @@ public:
void reset_post() noexcept { first_postprocess_ = true; }
rhi::Handle<rhi::Texture> main_color() const noexcept { return main_color_; }
rhi::Handle<rhi::Renderbuffer> main_depth() const noexcept { return main_depth_; }
rhi::Handle<rhi::Texture> current_post_color() const noexcept { return post_colors_[post_index_]; }

View file

@ -41,7 +41,7 @@ void UpscaleBackbuffer::begin_pass(Rhi& rhi, Handle<GraphicsContext> 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<GraphicsContext> 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<GraphicsContext> 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<GraphicsContext> 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);
}

View file

@ -19,7 +19,6 @@ namespace srb2::hwr2
class UpscaleBackbuffer
{
rhi::Handle<rhi::Texture> color_;
rhi::Handle<rhi::Renderbuffer> depth_;
rhi::Handle<rhi::RenderPass> renderpass_;
rhi::Handle<rhi::RenderPass> renderpass_clear_;