Commit Graph

1204 Commits

Author SHA1 Message Date
Vladislav Belov 4ae50fd4a4 Reduces memory peak during window resize 2026-09-10 15:38:55 +02:00
Vladislav Belov 63e05d3c65 Removes unused updateFlags from GPU skinning 2026-09-10 15:27:18 +02:00
Vladislav Belov 100a13343a Uses default group for vertex buffer for skinning 2026-09-10 15:27:14 +02:00
Vladislav Belov e933d18a36 Moves tracking of requiring update models to upper
We need to track models to update in a single place. SceneRenderer in
that case. It allows us to make ModelVertexRenderer implementations more
straightforward.
2026-09-10 15:27:09 +02:00
Vladislav Belov a374411279 Separates preparing for rendering of CPU skinned
Only CPU skinned models require preparing for rendering to mark vertex
buffer chunks as needed.
2026-09-10 15:27:04 +02:00
phosit 7bcee2ea0e Remove XERO_ITER_EL 2026-09-08 10:32:51 +02:00
Vladislav Belov c4e7364802 Removes unused BuildColor4ub from ModelRenderer
We don't need to calculate shading on CPU since we always use shaders.

Refs: a9c27b412b
2026-08-06 11:32:02 +02:00
Vladislav Belov 867bdf318b Fixes missing material reference in ModelRenderer
Missed in 18a16aa135
2026-08-06 10:31:16 +02:00
Vladislav Belov e64a138f92 Fixes outdated state on disabling GPU skinning 2026-08-04 23:06:12 +02:00
Vladislav Belov 4a7b7e7df1 Removes smart pointers from ModelRenderer
We don't need to use pointers because we know lifetimes of all
renderers. And its list statically defined. A new renderer should follow
DOD and use a separate submission list with a separate inplace renderer.
2026-08-04 23:06:10 +02:00
Vladislav Belov fa90ddc8b6 Refactors ModelRenderer and makes it closer to DOD
Separates submitted models and moder renderer and makes relations
explicit. Now it's clear that we don't need separate ModelRenderer and
ModelVertexRenderer.
2026-08-04 23:06:09 +02:00
Vladislav Belov 764a420797 Merges ModelRenderer and ShaderModelRenderer
We use only shaders to render models so we don't need a separate class.

BatchModelRenderer was renamed in 6bc33fe8bd.
m_Renderer became unused in 0346ba1b18.
2026-08-04 23:06:07 +02:00
Vladislav Belov 8a2bb10827 Renames ShaderModelRenderer instances 2026-08-04 23:06:06 +02:00
Vladislav Belov af9d102126 Removes legacy logic of reused ModelRendererPtr
It became unused in 4a69e9117e.
2026-08-04 23:06:04 +02:00
Vladislav Belov f781181899 Adds sRGB support for proper lighting
Currently we're incorrectly using sRGB colors as raw inputs for lighting
instead of conversion to linear space. For proper PBR we need linear
values.
2026-07-29 01:29:09 +02:00
Vladislav Belov e2f5b20922 Fixes GL internal format of textures in compute
In compute shaders load/store operations requires sized formats.
2026-07-28 23:32:23 +02:00
Vladislav Belov 7ee476928b Fixes missing window preview on Alt+Tab
There was a crash on Alt+Tab in fullscreen for some specific driver:

https://code.wildfiregames.com/D1212

It was related only to post processing so it's time to try to enable
rendering again (but with provided option to disable it). Also without
rendering we might have some bugs in other components. See:

https://github.com/libsdl-org/SDL/issues/5033#issuecomment-981819661

The issue is reported here (first one):

https://wildfiregames.com/forum/topic/129061-two-vulkan-issues-in-a27-and-unrelated-choppiness-caused-by-control-groups/
2026-07-14 19:54:00 +02:00
Vladislav Belov 5778ef6cac Removes std::shared_ptr usages from particles 2026-07-13 01:01:03 +02:00
Vladislav Belov d2375de187 Splits PrepareScene and remove intermediates
We don't need to have intermediate functions as they don't add something
useful.
2026-07-13 00:40:36 +02:00
Vladislav Belov 43dd988ee7 Removes render methods from GameView 2026-07-13 00:40:34 +02:00
Vladislav Belov a2798b733f Splits render frame function 2026-07-13 00:40:32 +02:00
Vladislav Belov abf444d91c Reduces vertex maximum stride to 16
https://wikis.khronos.org/opengl/Vertex_Specification_Best_Practices

> The alignment of any attribute's data should be no less than 4 bytes.

But to make it a bit safer for older drivers we prefer to use 16 bytes
alignment (vec4) for now to match std140.
2026-07-12 17:54:26 +02:00
Vladislav Belov db8c05572f Adds Vulkan vertex format verification 2026-07-12 17:09:11 +02:00
Vladislav Belov fd99348d56 Fixes AMD Vulkan drivers crash with GPU skinning
R16G16B16_SFLOAT isn't guaranteed to be supported:
https://docs.vulkan.org/spec/latest/chapters/formats.html
See Table 17. Mandatory Format Support: 16-bit Components

It's safe to use less components:
https://docs.vulkan.org/spec/latest/chapters/fxvertex.html

> The number of components in the vertex shader input variable
> need not exactly match the number of components in the format.
> If the vertex shader has fewer components, the extra components
> are discarded.

The issue is reported here (second one):

https://wildfiregames.com/forum/topic/129061-two-vulkan-issues-in-a27-and-unrelated-choppiness-caused-by-control-groups/
2026-07-12 17:09:09 +02:00
Vladislav Belov 92ee2dba9e Removes unused OGL legacy 2026-07-09 22:53:30 +02:00
Vladislav Belov 552d91e92a Removes legacy GL error handling
We have GL_KHR_debug for proper error handling. ogl_WarnIfError isn't
really useful since it doesn't provide per-call granularity and requires
recompilation. So if it'll be really needed we can wrap all GL calls
into a macro like GL_CALL.
2026-07-09 22:53:29 +02:00
Vladislav Belov 11f78e5c1a Uses GLAD to get GL version 2026-07-08 20:52:23 +02:00
Vladislav Belov 4ca83fa071 Uses GLAD to check extensions
If GLAD failed to load an extension then we can't use it. Because all
its functions are nullptr.
2026-07-08 20:06:18 +02:00
Ralph Sennhauser 99bbc24265 Remove global g_xres and x_yres
Instead query g_VideoMode where needed. As both g_xres and g_yres aren't
global anymore remove static from UpdateRenderer. While at it use more
desicriptive names: GetXRes -> GetWindowWidth, GetYRes ->
GetWindowHeight.

This reduces the amount of variables tracking width and height by one
each.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-08 11:35:46 +02:00
Vladislav Belov 2bc674cbaa Removes extensions prior 2.1
Since we generate GL headers using GLAD with 2.1 version we don't need
to check extensions prior that.
2026-07-08 09:28:52 +02:00
Vladislav Belov 0a22bc66f7 Makes GL error handling explicit in report 2026-07-08 08:13:46 +02:00
Vladislav Belov 0168f45a65 Refactors GL device report
It makes the report function easier to read.
2026-07-08 08:13:44 +02:00
Vladislav Belov 46af67b5bd Removes RenderPath
We can render the game only with shaders so we don't need to support
fixed function pipeline as a separate render path. We only need to know
when to warn a user.

Fixes #6244
2026-07-07 23:12:45 +02:00
Vladislav Belov 0538e95793 Makes GameView::GetCamera constant 2026-06-28 17:57:26 +02:00
Vladislav Belov e0d131854d Makes GameView returning reference on camera 2026-06-28 17:57:16 +02:00
Vladislav Belov 0cc07aa209 Removes legacy glEnable of GL_TEXTURE_2D
It needs to bo enabled only for fixed-function pipeline.

https://registry.khronos.org/OpenGL-Refpages/gl2.1/

> If enabled and no fragment shader is active, two-dimensional texturing is performed
2026-06-28 15:56:33 +02:00
Ralph Sennhauser 4967922447 Don't load WGL
Depend on SDL and wxWidgets doing the necessary work.

Also remove WGL from glad.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:26 +02:00
Ralph Sennhauser c5a9d18cfa Drop use of GLX and EGL
Only used for hw-report and only when using GLX which is for X11 only.
The usefulness of those reported properties is questionable and X11 is
becoming rarer.

This allows us to drop a direct dependency on X11 delegating the
handling to SDL and wxWidgets respectively GTK.

Further SDL3 wont expose supported video driver at compile time making
this step more meaningful.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:26 +02:00
Ralph Sennhauser 08cd7e9096 Drop vsync workaround for wxWidgets
wxWidgets already sets it's prefered mode.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:25 +02:00
Vladislav Belov 1709149740 Adds instancing to particles
We use instancing to provide dynamic data for particle only once and not
for each vertex.
2026-06-22 23:18:29 +02:00
vyordan ec8b420abc Move Script* classes to Script namespace
- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
  Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
  ScriptContext.* → Context.*
  ScriptInterface.* → Interface.*
  ScriptRequest.* → Request.*
  ScriptEngine.* → Engine.*
  ScriptConversions.* → Conversions.*
  ScriptExceptions.* → Exceptions.*
  ScriptForward.* → ForwardDeclarations.*
  ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
  Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
  ScriptInterface_impl → Interface_impl
  ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
  macro) by adding them to suppressions-list.txt (these are not caused
  by this refactor)

Fixes #7516
2026-06-20 17:43:00 +02:00
Vladislav Belov d23f9e1da3 Adds a storage check for resolve PBR shader
We need to check for storage support because we outpout result into a
storage. Note: it seems we might have a bug inside GL backend or inside
Mesa drivers which prevents us from running resolve on compute.
2026-06-20 13:29:14 +02:00
Vladislav Belov 7a19f38070 Allows floating point textures based on extension 2026-06-20 13:29:13 +02:00
Vladislav Belov f72c0c1c09 Enables fragment PBR resolve shader in PostProc 2026-06-20 13:29:11 +02:00
phosit 596c0c2ddd Split screenshot from main input handler
This enables the screenshot hotkeys in atlas.
2026-06-19 20:53:52 +02:00
Vladislav Belov 4259c78150 Removes unused Get/SetDepthTextureBits methods
Methods were added in f903b83674.
Methods became unused in 12e2428495.
2026-06-15 00:35:04 +02:00
Vladislav Belov 7607d6bdd8 Decouples acquire/present from SubmitScheduler
SubmitScheduler doesn't have to know anything about Acquire/Present as
its responsibility to schedule and submit command buffers to a queue.
2026-06-08 18:27:10 +02:00
Vladislav Belov 07e5ad5b23 Fixes acquire and submit semaphores syncronization
I forgot to finish CSubmitScheduler synchronization in
7c84c23114. Even ++m_FrameID was
forgotten. And it worked at the time. A proper synchronization is
described in renderer/backend/Vulkan/SwapChain.h.
2026-06-08 18:27:08 +02:00
Vladislav Belov 4d83aa28e5 Uses SwapChain instead of direct Device calls 2026-06-08 18:27:06 +02:00
Vladislav Belov cf4a4d8fd5 Adds SwapChain as an explicit DeviceObject
It allows us more flexibility on how we control swapchain. That includes
toggling V-Sync in real time.
2026-06-08 18:26:58 +02:00