Commit graph

207 commits

Author SHA1 Message Date
Andrei Alexeyev
68871bbe88
renderer/glcommon: remove dead code 2024-10-06 07:09:01 +02:00
Andrei Alexeyev
321ba481d9
renderer/common/sprite_batch: don't pass NULL to r_uniform_sampler 2024-10-04 16:27:28 +02:00
Andrei Alexeyev
7c82cbba9b
gl33: remove avoid_sampler_uniform_updates workaround and make it the default 2024-10-04 16:27:28 +02:00
Andrei Alexeyev
5274cec283
gl33: use glTexStorage* and glInvalidateTexImage* when available
glTexStorage is mostly intended to work around a regression in ANGLE's
Metal backend; see https://issues.chromium.org/issues/355605685

Potentially fixes #386
2024-10-01 04:22:30 +02:00
Andrei Alexeyev
22e6f9b4de
renderer/common/sprite_batch: r_draw_sprite optimizations 2024-09-22 21:18:31 +02:00
Andrei Alexeyev
7f570d2338
renderer/common/sprite_batch: remove string fields from SpriteParams 2024-09-22 21:18:31 +02:00
Andrei Alexeyev
fda8556a39
src: deprecate strdup(), use mem_strdup() explicitly
This fixes a nasty bug that manifests on windows when building without
precompiled headers. util/stringops.h used to silently replace strdup
with a macro that's compatible with mem_free(). This header would
typically be included everywhere due to PCH, but without it the strdup
from libc would sometimes be in scope. On most platforms mem_free() is
equivalent to free(), but not on windows, because we have to use
_aligned_free() there. Attempting to mem_free() the result of a libc
strdup() would segfault in such a configuration.

Avoid the footgun by banning strdup() entirely. Maybe redefining libc
names isn't such a great idea, who knew?
2024-09-10 14:31:55 +02:00
Andrei Alexeyev
c150f4cd13
gl33: fix gl33_framebuffer_finalize_read_requests() 2024-09-03 01:52:50 +02:00
Andrei Alexeyev
49bcbac838
renderer: remove PRIM_LINE_LOOP 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
48568b9227
renderer: add r_unclaim_window API
Must be called before destroying a window. Implementation is optional.
2024-08-30 11:52:47 +02:00
Andrei Alexeyev
47c8f5bee3
gl33: don't try to fall back to r_shader_standard() if active shader is deleted
This prevents clean shutdown in tests that don't bring up the whole
resource system, and is not really a sane fallback anyway.
2024-08-30 11:52:47 +02:00
Andrei Alexeyev
043f09c668
gl33: remove magic _SIZE uniform handling
Only FXAA ever used this, and it's trivial to implement in client code
2024-08-30 11:52:47 +02:00
Andrei Alexeyev
be06946a31
renderer/api: add NUM_TEXTURE_CLASSES constant 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
26959c4a1f
renderer/common/sprite_batch: replace tex_aux array in shaders with plain samplers
SDL_gpu doesn't support sampler arrays
2024-08-30 11:52:47 +02:00
Andrei Alexeyev
7cd47e9404
renderer: move magic uniform definitions to common 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
4ebd7ba14b
gl33: remove trailing [0] from array uniform names 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
50056eb41a
renderer: decouple models and sprite_batch init/shutdown from main render system 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
2fdf9baf36
renderer/api: remove dead struct 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
b48e4e7714
build,renderer: dispose of gles20's rotting corpse 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
6a84f1aee3
shaderlib/lang_spirv_aux: support SPIR-V output in spirv_transpile 2024-08-30 11:52:47 +02:00
Andrei Alexeyev
8b37d1cbf2
src: the great #include massacre of 2024 2024-05-17 14:11:48 +02:00
Andrei Alexeyev
be7905d6a3
src: run upkeep 2024-05-17 04:58:47 +02:00
Andrei Alexeyev
83dfe8d5fa
renderer/api: init matrix and state stacks early 2024-05-13 03:29:43 +02:00
Andrei Alexeyev
8d5ffe4b91
renderer: remove old r_screenshot() API 2024-05-01 01:07:18 +02:00
Andrei Alexeyev
f11a09649d
gl33: implement sync fallback for framebuffer async read 2024-05-01 01:01:09 +02:00
Andrei Alexeyev
783172861a
renderer: simplify async readback API; use glMapBufferRange
glGetBufferSubData is not available on GLES
2024-05-01 00:19:07 +02:00
Andrei Alexeyev
c6d92f7407
renderer: add asynchronous framebuffer readback API
Used to download rendered images from the GPU with minimal (if any)
pipeline stalling. Implemented with PBOs in OpenGL.
2024-04-29 01:15:15 +02:00
Andrei Alexeyev
f5553a2125
renderer/glcommon: add glcommon_get_texture_formats() 2024-04-29 00:53:30 +02:00
Andrei Alexeyev
e54b144973
gl33: fix scissor test 2024-04-11 18:04:22 +02:00
Andrei Alexeyev
cc01be15fe
all: use the clamp() macro 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
8f8ca2beca
all: use min/max macros; avoid some unnecessary conversions 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
c15934f666
dynarray: get rid of memset and add optional initializer arg to dynarray_append 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
c2810e228d
all: use re()/im() macros 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
5d54618667
glcommon: disable norm16 formats on nouveau
These seem to be broken
2023-08-31 00:51:49 +02:00
Andrei Alexeyev
cab432f843
gles: create angle context in webgl mode on windows
Cubemaps are broken in ANGLE's D3D11 backend, except in WebGL mode for
some reason. This is a terrible workaround, but it beats fucked up
rendering in stage backgrounds.
2023-08-28 19:15:40 +02:00
Andrei Alexeyev
6cc8bf2d47
gl33: shut up -Wunreachable-code on emscripten builds 2023-07-30 03:01:58 +02:00
Andrei Alexeyev
c74ac7874a
gles30: alternative webgl framebuffer_copy impl to work around chrome bug 2023-06-18 14:56:00 +02:00
Andrei Alexeyev
9dade8ad33
resource: lifetime management redesign (WIP) 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
ad295005db
resource: more consistent API function names 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
190da85628
gl33,glescommon: fix screenshots
Broken by b50b57803e
2023-04-18 12:47:19 +02:00
Andrei Alexeyev
b50b57803e
renderer: add r_framebuffer_copy 2023-04-10 06:47:55 +02:00
Andrei Alexeyev
3dc0faec9e
renderer/api: rename ClearBufferFlags to BufferKindFlags 2023-04-10 06:47:55 +02:00
Andrei Alexeyev
711edc218f
util/assert: add optional message to assert, assume, and static_assert
Removed static_assert_nomsg, since static_assert's message argument is
optional now. In C2X mode this uses the native _Static_assert
functionality, otherwise it falls back to a macro-based overload.

Additionally, rewrote the assert macro so it correctly marks the failing
branch as a dead end.
2023-03-26 01:52:41 +01:00
Andrei Alexeyev
77dc94bb71
menu,renderer,vfs: fix -Wcast-function-type-strict on clang 16 2023-03-22 22:38:52 +01:00
Andrei Alexeyev
c12b41fa3b
resource: remove deprecated getters 2023-02-24 18:15:02 +01:00
Stone Tickle
08c4723f92
build: fix errors found by muon analyze (#358)
I found a few small errors while testing muon analyze on this project.
2023-02-23 22:06:56 +02:00
Andrei Alexeyev
b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
Andrei Alexeyev
95363b9c0e
build: auto-disable shader_transpiler if offline translation used 2023-01-05 04:25:21 +01:00
Andrei Alexeyev
267f47fc0e
build,ci: Build system maintenance (#350)
Squashed commit of the following:

commit 9ab0197ee1
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 28 23:05:58 2022 +0100

    build: add dummy descriptions for deprecated options

commit b0c41d4719
Author: Alice D <alice@starwitch.productions>
Date:   Mon Dec 26 15:18:09 2022 -0500

    update docker containers with ones containing meson 0.63.3

commit a2dd4173fc
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:20:44 2022 +0100

    build: featurize audio options

commit 7c59e2a569
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:20:35 2022 +0100

    build: remove dead code

commit cf500af137
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:07:37 2022 +0100

    doc: update BUILD.rst

commit 9764ac706f
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 17:12:37 2022 +0100

    ci: disable WGI joystick backend for SDL

    Fails to build with latest llvm-mingw

commit 2d4f310b90
Author: p-sam <p-sam@d3vs.net>
Date:   Sun Dec 25 17:03:47 2022 +0100

    switch: fix missing include

commit 9264f1649d
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 24 14:36:41 2022 +0100

    ci: update meson to 0.63.3 due to a bug

commit 3e37be3d8f
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 24 13:42:34 2022 +0100

    ci: update build options

commit 281a39a4f5
Author: Alice D <alice@starwitch.productions>
Date:   Sun Dec 18 00:17:07 2022 -0500

    ci: change when apt is cleaned up for switch image

commit 2f2100a84c
Author: Alice D <alice@starwitch.productions>
Date:   Sun Dec 18 00:11:08 2022 -0500

    ci: bump switch homebrew container version

commit ebaff59260
Author: Alice D <alice@starwitch.productions>
Date:   Sat Dec 17 22:55:39 2022 -0500

    ci: bump windows container version

commit 7ce6f23419
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 07:36:28 2022 +0100

    build: featurize renderer options

commit a345f21b35
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 07:33:30 2022 +0100

    build: revert to explicit fallback for libzstd

    Implicit fallback causes conflicts in the basis_universal subproject

    https://github.com/mesonbuild/meson/issues/11189

commit b2de61f5c5
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 05:29:29 2022 +0100

    build: remove debug_opengl

    This option was always misdocumented, as it only controlled whether GL
    debugging is on by default. You can still control it with the
    TAISEI_GL_DEBUG environment variable, which is set to 1 in meson devenv.

commit 4c659ba195
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Fri Dec 16 08:03:37 2022 +0100

    build: set up useful env vars for meson devenv

    Makes Taisei load resources from the source tree, making live reload
    work; enables OpenGL debugging by default; works around ASan stack use
    after return false positives.

commit 1ddc58b84a
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 08:06:32 2022 +0100

    build: featurize docs; always install licenses

commit c3a94d7f5b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:46:28 2022 +0100

    build: featurize shader_transpiler

commit 619d82ae36
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:38:30 2022 +0100

    build: allow libzip fallback by default

commit 79ab72292a
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:35:51 2022 +0100

    build: featurize use_libcrypto

commit b393077f71
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 05:03:20 2022 +0100

    build: featurize validate_glsl

commit 7d76484079
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 04:34:31 2022 +0100

    build: featurize some more installation options

commit 17c0bda205
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 03:24:46 2022 +0100

    build: deprecate enable_zip for vfs_zip; convert package_data into feature

commit 9a4ef8c091
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 02:37:55 2022 +0100

    build: deprecate developer=auto; default to false

commit 807240e508
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 02:24:04 2022 +0100

    build: move subproject fallback info into wraps

commit 08c953f487
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:57:33 2022 +0100

    build: deprecate 'static' option

    Meson has a built-in `prefer_static` now

commit c575601537
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:49:31 2022 +0100

    build: remove complicated shaderc detection logic

    Meson does all of this internally since 0.51.0

commit cd2d460d4b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:45:17 2022 +0100

    build: Require meson >=0.63.0

commit 10abd790f7
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 05:16:47 2022 +0100

    ci: remove meson dist version workaround from release workflow

    Meson should know the correct version now

commit 31a07d8c3c
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 03:46:28 2022 +0100

    build: use built-in summary() function

commit 0c47f6d14b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 04:33:01 2022 +0100

    build: remove -Dversion_fallback and introduce .VERSION file

    The version script will now first try to read the version from a
    .VERSION file in the source root. If that file does not exist, it will
    query git. The .VERSION file is not included in the git repository, it
    is generated for inclusion in source tarballs.

    Package maintainers who had any use for -Dversion_fallback may want to
    create the .VERSION file themselves.

    Additionally, some git-specific files have been removed from source
    tarballs.

commit d32332a5e3
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 03:00:07 2022 +0100

    build: set the "real" version in project()

commit f9a3fbc729
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 01:50:08 2022 +0100

    build: raise meson_version and remove some legacy workarounds

    Effectively 0.56.0 was already required since we started using some of
    its features at some point.

    This also fixes all current meson warnings.
2022-12-28 23:15:55 +01:00
Andrei Alexeyev
0adaf17d5f
sprite: handle virtual paddings transparently
Most client code no longer needs to care about paddings at all, aside
from some very special cases involving dynamic creation of padded
sprites. So far we only have one known example of this in portrait_render().

This should let us optimize most of our sprites with autotrimming in the
future.

Additionally, support for deprecated offset_{x,y} keys in sprite files
has been removed.
2022-11-27 20:14:05 +01:00