Commit graph

66 commits

Author SHA1 Message Date
toaster
20c1695ae4 WERROR unused variable removal 2025-09-18 19:52:32 +01:00
Eidolon
0dc337c9a5 Fix lots of code for clang-cl compatibility 2025-09-17 17:24:32 -05:00
James R
c896aec5e3 Fix screenshot/video recording in Debug builds on GCC 15
- New in GCC 15: std::vector subscript operator asserts if
  out of range (even past-end)
- Solution: use pointer arithmetic where a past-end
  iterator is needed
2025-07-15 14:53:46 -07:00
James R
7a4b17c230 TwodeeRenderer::rewrite_patch_quad_vertices: ensure high side of clipping clamp is >= low side
- Fixes assert raised on GCC 15
- Testing
  - Use Debug build
  - Use GCC 15
  - Be on linux
  - Give yourself the Bubble Shield
2025-05-14 13:12:27 -07:00
Eidolon
bd7646346b Use new containers and json 2025-03-16 18:45:11 -05:00
Eidolon
a2572f64df Update copyright years to 2025 2025-02-13 15:56:37 -06:00
Eidolon
cb7f437e60 Merge public master 2025-02-13 15:48:11 -06:00
Eidolon
a4d304a1f5 Update copyright years to 2025 2025-02-13 15:32:26 -06:00
Eidolon
7e74e70c20 Fix memory leak in BlitPostimgScreens due to typos
The indexed program was being compiled every frame and the wrong program
was being used for the screen configuration.
2024-11-09 20:44:40 -06:00
Eidolon
d2b3b15213 Restore imgui rendering
Was lost when pass architecture was removed; now it should work again.
2024-10-30 09:08:04 -05:00
Eidolon
fc05db7441 rhi: Use renderpasses as a stack
This way when you pop a render pass, it will restore the previous
renderpass state if there was one. Allows for rendering code to enter
and leave the default render pass without interfering with other drawing
code.
2024-10-30 09:08:04 -05:00
Eidolon
136761cf3b rhi: Remove Pipeline, Uniform/BindingSet, add dynamic state
The pipeline abstraction mimicked Vulkan and d3d12 explicit pipeline state objects
but, like GraphicsContext, was ill-considered for the kinds of drawing
behavior SRB2 uses. Rather than push this complexity into the drawing
code, it will instead be the responsibility of the backend to manage
explicit pipeline objects if necessary.

Now, drawing code must create a Program instance, bind it, and set the
rasterizer state to do the equivalent. Uniform, sampler, and vertex
attribute bindings are significantly simpler to set up now.
2024-10-30 09:08:04 -05:00
Eidolon
4499979458 rhi: Remove RenderPass object
While this has an analog in Vulkan, it is trivial to manage vkRenderPass
on the backend side. We are already having to dynamically manage GL FBOs
for binding framebuffers for drawing in begin_render_pass, so I see
little reason to keep this object around.
2024-10-30 09:08:04 -05:00
Eidolon
bba1d56529 rhi: Remove the old Pass concept
This was already slated to be removed; the old PassManager was a failed
attempt to centralize and pipeline all graphics logic for a frame. Let's
remove it as a step towards simplifying some of this code.
2024-10-30 09:08:04 -05:00
Eidolon
dae2e8ba17 rhi: Remove GraphicsContext
I've come to the conclusion that some aspects of RHI are overengineered
to suit a future where we would theoretically support Vulkan with
minimal implementation effort. In an effort of architectural astronaut
engineering this has had the consequence of making much of the code
interacting with RHI significantly more complex.

The GraphicsContext was originally an opaque object to wrap and
contextualize operations that would eventually be inserted into a Vulkan
CommandBuffer for dispatch. In practice, for the GL backend, this does
nothing but introduce another pointer to pass around across all RHI
code, when it had already been previously accepted that the idea of
recording multiple GraphicsContexts at the same time was infeasible.

Thus, I'm choosing to excise GraphicsContext entirely. This doesn't do
much except remove passing around the context object. This is one of
many changes I would like to make that would simplify RHI-related code
and defer the complexity to the hypothetical future. Vulkan can come at
a later date, and we can solve the problems of Vulkan then. Right now, I
am actually more concerned for supporting a d3d9 renderer to shore up
that Intel 945GM laptop GPU support gap we currently have.
2024-10-30 09:08:04 -05:00
Sally Coolatta
6b87b586d2 "snapshotmaps" command
Takes two screenshots for a list of maps that have an "Alternate View Point" thing with tag 0 -- one intended for level select pictures and another for Discord Rich Presence. If no view point exists, the map is skipped.
2024-07-21 08:54:49 -04:00
Eidolon
8ab9f9c2cb Merge branch 'remove-renderbuffers' into 'master'
Temporarily remove uses of RHI renderbuffers

Closes RingRacers#1

See merge request KartKrew/Kart!2323
2024-05-01 14:38:27 +00:00
Eidolon
489dba16c3 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
2024-04-30 14:56:13 -05:00
Eidolon
26fe683625 Fix pack alignment handling in screen capture
Some incorrect arithmetic (applying padding to each pixel instead
of each _row_ of pixels) caused the pixel data to be interpreted
incorrectly. This was both in the GL2 RHI driver for read_pixels
and in the ScreenCapture module.

Fixes KartKrew/RingRacers#41
2024-04-30 14:35:51 -05:00
James R
8ae80a58b9 Add missing algorithm include to some files
Fix missing std::clamp
2024-04-24 17:03:03 -07:00
Sally Coolatta
c0c2f8a93a SRB2 -> DRRR copyright in hwr2 folder 2024-04-05 10:04:07 -04:00
AJ Martinez
0072170b2e Add SalCRT Sharp 2024-03-17 17:50:29 -07:00
Eidolon
123477dac9 Add Sharp Bilinear mode, make default 2024-03-07 22:03:36 -06:00
Eidolon
0156db0dc1 Add optional CRT screen effect 2024-03-06 22:39:21 -06:00
James R
4a7d2504b0 srb2::hwr2::PaletteManager: disable lighttables upload
- This code uploads encoremap to the GPU as a texture.
- It assumes encoremap is 256 * 32 bytes, but in reality
  encoremap is only 256 bytes.
- The textures go completely unused, so I simply
  commented out the code altogether.
2024-02-05 19:04:23 -08:00
Eidolon
bdc0795704 Fix several Clang compile warnings 2024-01-16 06:11:43 -05:00
Eidolon
bd8ebabfee Enforce C++17 standard compliance 2023-12-14 21:00:42 -06:00
James R.
a7382ca9d0 UpscaleBackbuffer::begin_pass: use separate renderpass to clear framebuffer if texture was recreated
Fixes wipes potentially reading invalid data from the
framebuffer if the texture was recreated but not yet
rendered to.
2023-09-30 19:23:14 -07:00
James R.
37dc1189bb srb2::hwr2::BlitRectPass::set_output: set x/y as well 2023-09-30 16:38:56 -07:00
Eidolon
1e9d0edca2 Add missing include in HWR2 header
Fixes macOS compilation
2023-09-16 11:30:53 -05:00
Eidolon
6b0c2c6fd8 hwr2: fix unaligned software copies 2023-09-01 15:30:04 -05:00
Eidolon
78ccaf361b hwr2: upscale chosen resolution to desktop res 2023-09-01 15:30:04 -05:00
Eidolon
6f580606cd hwr2: Remove pass infrastructure
It's not worth trying to force the engine to conform to deferred
drawing.
2023-09-01 15:30:04 -05:00
Eidolon
3ec7163a34 rhi: remove TransferContexts 2023-07-09 13:54:07 -05:00
Eidolon
6d94de494e hwr2: Only upload lighttable if currently valid 2023-06-01 05:12:04 -05:00
Eidolon
99bc417978 hwr2: Upload encore lighttable to correct texture 2023-06-01 05:12:04 -05:00
Eidolon
79a01789b8 hwr2: Reset extra lighttable textures 2023-06-01 05:12:04 -05:00
Eidolon
e40b3ac1e3 hwr2: Track colormaps and lighttables tex globally 2023-06-01 05:11:48 -05:00
Eidolon
b8dabe82cf Revert "hwr2: Track colormaps and lighttables tex globally"
This reverts commit aa48237928.
2023-05-23 09:05:23 -05:00
Eidolon
aa48237928 hwr2: Track colormaps and lighttables tex globally
This will allow hardware to reuse the same colormap textures objects as
twodee.
2023-05-19 18:54:19 -05:00
Eidolon
8d390c58d4 hwr2: Extract BlendMode enum from twodee
This enum is usable across multiple parts of hwr2 so it would be easier
to just keep it separate.
2023-05-19 18:54:19 -05:00
Sal
563e2f2ffd Merge branch 'fix-2p-splitscreen-viewports' into 'master'
Fix 2P splitscreen viewports being out of order

See merge request KartKrew/Kart!1180
2023-04-18 08:49:04 +00:00
James R
d78b17170c get_screen_viewport: fix 2P splitscreen viewport order 2023-04-18 01:46:00 -07:00
Eidolon
2b01d8a589 rhi: Reset patch atlas if patch is freed 2023-04-15 22:19:01 -05:00
Eidolon
3ad3dd5cd9 rhi: Extract patch atlas cache to own class 2023-04-15 21:04:07 -05:00
Eidolon
356e3317df hwr2: Do postimg in hardware
Depends on updated shaders
2023-04-02 19:46:21 -05:00
Eidolon
8cc6e9a4f0 rhi: Add texture wrap modes
They cannot be changed after creation, for simplicity.
2023-03-24 16:43:41 -05:00
Eidolon
70c375f9db rhi: Remove color attachment pixel formats
Color attachment must always be an RGBA texture
2023-03-24 16:11:11 -05:00
Eidolon
c31df8a0bb rhi: Repurpose Renderbuffer for depth-stencil 2023-03-24 16:06:30 -05:00
Eidolon
ba5ee56b8e Rename RHI update_buffer_contents to update_buffer
Consistency with update_texture
2023-03-23 13:30:17 -05:00