1
0
forked from mirrors/0ad

1146 Commits

Author SHA1 Message Date
Vladislav Belov a7967d4ad9 Adds PBR output texture to PostProc 2026-04-29 19:25:14 +02:00
Vladislav Belov 1a277269d3 Adds floating point textures to backends
R8G8B8A8_UNORM isn't enough to store HDR data as the scene can brighter
than 1.0 especially when looking into sun speculars.
2026-04-29 19:25:11 +02:00
Vladislav Belov c4fb0eed3a Adds slider to developer overlay
Also adds PBR config values. Refs #8535
2026-04-29 19:25:03 +02:00
Vladislav Belov 456e2a0b56 Removes dummy GL functions as replaced by core 2026-04-25 17:47:06 +02:00
Vladislav Belov dd9124ae99 Fixes Vulkan uniform buffer size after 9e371824c2
32 was accidentally added during debugging.
2026-04-25 11:55:12 +02:00
Vladislav Belov cb1fe07540 Removes GetDeviceCommandContext call from CFont
We need remove all occurences of GetDeviceCommandContext to be able to
add multithreading support in the future.
2026-04-10 23:53:23 +02:00
Vantha 1d3cdec48d Move cutscene mode to renderer
This patch splits "cutscene mode" (disabling silhouttes, territory
borders and other visual overlays) from the cinema manager component
and moves it to the renderer, since it doesn't influence the simulation
anyway. The mode can now be independently controlled by the GUI. This
is done so it can also be used for other narrative elements like speech
or dialogue in the future. Cutscene mode is still always enabled while
cinema paths are playing, though.
By design, this also fixes the issue that range overlays weren't hidden
during cutscene mode.
2026-03-03 11:25:52 +01:00
Vladislav Belov aae957ec7b Adds fixed orientation to particles
New features:

* Relative position
* Relative and absolute fixed axis
* Local space
* Axis along velocity vector
2026-02-20 22:46:49 +01:00
Vladislav Belov 0432b86de7 Removes ARB (legacy OpenGL) backend
ARB is a legacy backend which uses old assembly shaders. It makes
writing shaders more complex. According to the stats
https://feedback.wildfiregames.com we small amount of players with
ARB.

Fixes #8533
2026-02-20 22:07:38 +01:00
phosit df18e22277 Remove Script::CreateArray
It's better to construct a js-array from a `JS::RootedValueVector`.
Because it is more strongly typed and the index doesn't has to be
specified when appending an element.
Some usages are replaced with `JS::RootedValueArray`.

Fixes: #8702
2026-02-08 19:27:50 +01:00
Vladislav Belov cce01f4d6c Fixes compilation after #8621
Fixes #8685
2026-01-25 16:29:16 +01:00
Chrzanof 5daae13525 Pass device command context by reference in DebugRenderer
Improve the DebugRenderer API by passing the IDeviceCommandContext
as a reference instead of calling g_Renderer.

Fixes: #6650
2026-01-24 11:54:01 +01:00
Vladislav Belov f43e98da09 Fixes uninitialized GPUSkinning in Atlas
Currently CRenderingOptions are initialized only once on the application
start. It means changed m_GPUSkinning wasn't reset on the switch to Atlas.

Fixes #8596
2025-12-27 21:02:48 +01:00
Vladislav Belov c0ea17f06e Replaces choosedDeviceIt by chosenDeviceIt 2025-11-11 01:51:16 +01:00
Vladislav Belov 485200342d Disables Vulkan devices sorting by default
Currently we always choose the best device. But it's not always
desirable. A more safe approach is to use the default device (with
index 0). The only downside of that is if a user didn't adjust
settings then the game might run on an integrated GPU instead of a
discrete one. In the future it'll be solved by selecting GPU in
options: #8529

Fixes #8455
2025-11-11 01:50:58 +01:00
Vladislav Belov c4bc6c9627 Adds an option to destroy Vulkan old swapchain before
Now it's possible to destroy the old swapchain before creating a new
one. It might make the swapchain creation a bit slower but with a
lower memory peak.
2025-11-10 00:06:52 +01:00
Vladislav Belov 8a64182ca2 Waits Vulkan device idle also on window resize
Fixes the case when a swapchain was recreated on resize rather than
by VK_ERROR_OUT_OF_DATE_KHR.
2025-11-10 00:06:51 +01:00
Vladislav Belov de36c75023 Deletes Vulkan resources on swapchain recreation
The change tries to minimize a memory peak during a window resizing.

Refs #6864
2025-11-10 00:06:41 +01:00
Vladislav Belov 8b1b1d28f8 Fixes missing Vulkan application version
Missing after dc830ccf55.
2025-11-09 12:58:16 +01:00
Vladislav Belov e8d9a8db67 Adds Vulkan timestamp limits to report 2025-10-16 00:36:02 +02:00
Vladislav Belov f2752f7230 Removes ARBShader capability 2025-10-14 13:04:16 +02:00
Vladislav Belov 893f192eaa Makes TextRenderer allocates using LinearAllocator
Also replaces DynamicArena for model and terrain rendering by
LinearAllocator.
2025-10-12 00:53:12 +02:00
Vladislav Belov 3ffb5ec5a0 Removes USE_FOG define and switches to a shader parameter.
Refs #8385
2025-10-11 08:11:35 +02:00
Vladislav Belov 199f4cb666 Fixes uninitialized water textures.
Fixes #8052
2025-10-05 14:13:49 +02:00
Vladislav Belov e8a5103f8c Fixes #8057 by properly initializing atlas texture.
Fixes #8057
Fixes #8184
Fixes #8345
2025-09-17 14:31:16 +02:00
Vladislav Belov e2d9450d0d Revert "Font: make atlas uploads queue-aware on Vulkan"
This reverts commit 256dff7fd4.
2025-09-17 12:32:08 +02:00
Ralph Sennhauser 2cedb48de2 Remove custom span and use std::span
With C++20 the custom container PS:span, which was a backport of
std::span is no longer needed.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-24 11:09:57 +02:00
Ralph Sennhauser 2daa5385a8 Remove obsolete warning suppression
This was needed for old Visualstudio and is no longer needed with
VS2022.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-24 11:09:57 +02:00
Ralph Sennhauser 5b5f678e3f Fix some includes all over the place
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.

Add markers to precompiled.h header includes to avoid
include-what-you-use wanting them to be removed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-14 20:15:30 +02:00
trompetin17 690838e3dc Add [locale] inline tag for per-locale fonts
New `[locale='xx']...[/locale]` markup lets GUI text sections render
with a locale-specific font (e.g. CJK) while the rest of the caption
keeps the current game font.

guiObject.caption = "Hello [locale='ja']世界[/locale], how do you
[locale='zh']感覺[/locale]" This is ideal for language pickers and
similar UI where you want the language name shown in its own script.

This commit unlocks richer, self-explanatory international UI while
keeping the legacy text behaviour unchanged.
2025-08-04 09:35:41 -05:00
phosit 971525a41b Remove TIMER_BEGIN and TIMER_END
`TIMER` messages where printed to stdout which lead to noise.

Refs: #1003
2025-07-29 18:19:59 +02:00
phosit f721f56ad4 Replace TIMER with PROFILE2
`TIMER` messages where printed to stdout which lead to noise.

Refs: #1003
2025-07-29 18:19:49 +02:00
phosit eb3f0166f8 Prefer [[maybe_unused]] over UNUSED2
`[[maybe_unused]]` is in the C++ standard.
2025-07-28 13:16:37 +02:00
phosit 5be02743fa Don't use UNUSED2 on always unused variables
Not introducing a variable enforces that the variable is not used.
`UNUSED2` on the other hand is used to silence the warning.
2025-07-28 13:16:37 +02:00
phosit c0f20171f8 Remove wrong UNUSED2
Some variable are marked unused even though they are used.
2025-07-28 13:16:37 +02:00
Ralph Sennhauser f9e1e742bf Fix includes in source/renderer
Make include-what-you-use happy with files in source/renderer and
fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-27 16:07:14 +02:00
Stan ef69c37f66 Add VS2022 support with the v143 toolset 2025-07-23 09:19:29 +02:00
Ralph Sennhauser 47b2733183 Fix some includes in source/renderer
Make include-what-you-use happy with some files in source/renderer and
fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-12 12:19:41 +02:00
trompetin17 256dff7fd4 Font: make atlas uploads queue-aware on Vulkan
Goal
----
Avoid corrupting the dynamic font-atlas on Vulkan by blocking any
re-uploads until the command buffer that created / last updated the
texture has actually been submitted.

What changed
------------
* **Queue-aware textures**
  * Added `queueSubmitAware` flag to `IDevice::CreateTexture*` APIs.
  * `Vulkan::CTexture` now stores two booleans:
      - `m_QueueSubmitAware` – opt-in per texture.
      - `m_PendingQueueSubmit` – set to *true* the moment an upload
        is recorded, cleared once the submit scheduler has flushed.
  * `CRingCommandContext::ScheduleUpload` marks the texture as
    pending (`SetPendingQueueSubmit(true)`).

* **Device-side watcher**
  * `Vulkan::CDevice` keeps a
    `m_TextureUploadWatcherQueue`. Each frame it checks textures that
    were uploaded ≥ `NUMBER_OF_FRAMES_IN_FLIGHT` frames ago and
    clears their pending flag.
  * New helpers
    `ScheduleTextureUploadWatch `,
    `ProcessTextureUploadWatchQueue()`.

* **Font code**
  * Atlas texture is now created with
    `queueSubmitAware = true`.
  * `CFont::UploadTextureAtlasToGPU()` early-outs when
    `IsPendingQueueSubmit()` returns *true*, instead of tracking a
    submit-handle or the manual `m_IsLoadingTextureToGPU` flag
    (removed).

Why this is better
------------------
The logic to wait for a flush is localised inside the rendering
backend, so `CFont` only needs to ask *“is my texture busy?”*.
This removes the fragile submit-handle bookkeeping and works even if
the scheduler issues multiple submits per frame in future.

Result
------
Atlas uploads are deferred until the previous submit completes,
eliminating the intermittent glyph corruption on the Vulkan backend
while leaving GL and the dummy backend unchanged.
2025-07-09 13:09:46 -05:00
Ralph Sennhauser 8a8f2596ea Fix a warning on Windows
5e4b49f65f introduced a warning, silence it as it's in spidermonkey and
only leaks while on vs2017.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-09 19:24:51 +02:00
Ralph Sennhauser e7f44ca6ca Fix some includes in source/renderer
Make include-what-you-use happy with some files in source/renderer and
fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-09 09:04:50 +02:00
Ralph Sennhauser 5e4b49f65f Fix some includes in source/renderer
Make include-what-you-use happy with some files in source/renderer and
fix what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-07 17:45:54 +02:00
phosit 891908b801 Remove UNUSED
The `UNUSED` macro is used to mark a variable as unused but with a name.
Those usages are replaced with comments so that `UNUSED` can be removed.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-26 17:25:05 +02:00
phosit d9795d29fe Remove the name of some unused arguments
Remove some usage of the `UNUSED` macro. Remove only those cases where
the names can be deduced from their type.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-18 12:49:59 +02:00
Ralph Sennhauser 58219b974c Fix trailing whitespace and add pre-commit hook
Some have their editor configured to remove trailing whitespace and
editing such a file would "fix" it, adding an unrelated change.

Fix whitespace violations excluding third party libs and generated files
like glad or patches.

Enable pre-commit hook trailing-whitespace to enforce it in the future.

Fixes: #8016
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-15 20:08:48 +02:00
trompetin17 734386ce9f Use freetype for font rendering
Replace premade bitmap fonts with FreeType2 and dynamic texture atlas.

Switched from static, premade bitmap fonts to runtime-generated glyphs using FreeType2.
Glyphs are rendered on demand into a dynamic texture atlas, improving scalability,
font quality, and support for internationalization.

Currently using RGBA format for compatibility across all render
paths while initial support for R8_UNORM is being added.
This prepares for future optimizations in VRAM and performance

Includes groundwork for gamma-corrected blending and future swizzling support.
2025-05-16 14:57:59 -05:00
Lancelot de Ferrière cf952b34e4 Fix silhouette calculation after 8a40673
Fixes #7804
2025-05-11 09:56:24 +02:00
Lancelot de Ferrière 8a40673dab Avoid overflow in silhouette occluder bounds
This triggered a debug_warn in some cases.
2025-04-26 16:48:06 +02:00
Vladislav Belov 2264807ad0 Fixes runtime switch of the GPU skinning.
Fixes #7572, #7630.
2025-04-25 20:13:59 +02:00
Vladislav Belov e65879bdbf Fixes non-PCH compilation after 0b33921c06. 2025-04-17 23:26:23 +02:00