46 Commits
Author SHA1 Message Date
Gleb Mazovetskiy e5881688f4 text_render: Replace optional args with struct
4 options args are a bit unwieldy, especially when you want
to pass only the first and the last one.

With a struct, there is no need to specify the default values
for the args in between.
2023-10-25 09:19:14 +01:00
Gleb Mazovetskiy fa155d4ffd Dungeon tiles: Port over some cleanups from #6636 2023-09-23 18:02:43 +01:00
Gleb Mazovetskiy 3477d2f33f Revert "dun_render: Add DunTileColorMap for baked light"
This reverts commit 827eb9705d.
2023-09-23 18:02:43 +01:00
Gleb Mazovetskiy 827eb9705d dun_render: Add DunTileColorMap for baked light
Refs #6631
2023-09-19 18:04:36 +01:00
Gleb Mazovetskiy b64ee0e190 Use if constexpr in clx/dun_render 2023-09-10 10:22:19 +01:00
Gleb Mazovetskiy 5355146d51 Use structured bindings 2023-08-29 12:56:49 +01:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy c19bfe87fa Remove utils/stdcompat/algorithm.hpp 2023-08-14 01:54:29 +01:00
qndel c362808165 debug path command (#6101) 2023-05-13 10:20:15 +01:00
Anders Jenbo 1d90730b0a Correct use of local instead of global lightTableIndex
It looks like this was mistakenly using LightTableIndex instead of lightTableIndex. Found by @qndel
2023-05-11 20:04:01 +02:00
Anders Jenbo dc2d97c112 Split lighting shades from trn tables 2023-04-21 07:40:19 +02:00
Gleb Mazovetskiy e81f8affba Fix rendering issues introduced by #5913
Fixes #5914
2023-03-23 11:43:50 +01:00
Gleb Mazovetskiy 774993c6d0 dun_renderer: Avoid calling 0-width Blit*
A slight optimization to avoid calling blit functions entirely
when the width is zero.
2023-03-22 10:30:06 +00:00
Gleb Mazovetskiy 397529bf0f Rendering: Unify and optimize pixel blitters
1. Unifies the underlying CLX and dun_render blitters.
2. Optimizes them by unrolling loops and using pointer comparison rather
   than length comparison (saves a length decrement).
3. In `dun_render`, extracts `RenderLineTransparent/Opaque` branches into
   functions via explicit template specialization.

Example RG-99 FPS (non-PGO'd): 17.4->18.4
2023-03-21 13:42:23 +00:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
Gleb Mazovetskiy f4b8edb5dc Surface.pitch(): int -> uint16_t 2022-12-14 10:12:24 +01:00
Gleb Mazovetskiy e06ca9a016 dun_render: Remove unused argument from RenderTile
Now that we pass the mask into `RenderTile`, we no longer need to pass
`levelPieceId`.
2022-12-14 10:12:24 +01:00
Gleb Mazovetskiy 1addfc9e54 dun_render: Deduplicate trapezoid upper half 2022-12-05 05:17:24 +01:00
Gleb Mazovetskiy 63a042d0e3 dun_render: Simplify non-masked primitives
As we recently confirmed, Square and Left/RightTriangle primitives
never use masks other than Transparent and Solid.

Simplify the code to take advantage of that.
2022-12-05 05:17:24 +01:00
Gleb Mazovetskiy 55d25fd079 dun_render: Swap32LE the data offset 2022-12-05 05:05:55 +01:00
Gleb Mazovetskiy 79b330825d dun_render: Avoid Invalid tile type
1. Do not call `RenderTile` with invalid values to begin with.
2. Move mask selection out of `RenderTile`.
2022-12-05 01:32:29 +01:00
Gleb Mazovetskiy 44ed0296d8 dun_render: Overhaul mask handling
We notice that masks can be described by 2 parameters:

1. Whether they have 0 or 1 as their high bits.
2. Whether they shift to the left or to the right on the next line.

Describing masks this way allows us to lift them to template variables and simplify the code.
We also avoid handling the mask in the `RenderLine` loop entirely.

Also fixes a foliage rendering bug: Transparent foliage pixels were previously blended but they should have been simply skipped.
2022-12-04 21:53:52 +01:00
Gleb Mazovetskiy aca4aae3c1 dun_render: Remove the use of LightTableIndex
Replaces the global with an argument.
2022-11-25 15:00:04 +01:00
Gleb Mazovetskiy 3afef6299f Level renderer: Remove cel_transparency/foliage_active globals 2022-11-25 15:00:04 +01:00
Gleb Mazovetskiy 1293dfb86d Level renderer: Remove level_piece_id global
`DrawFloor` now passes the piece ID into RenderTile.
Previously, `DrawFloor` did not set `level_piece_id`.
2022-11-25 14:16:30 +01:00
Gleb Mazovetskiy c616e0d6d2 Level renderer: Remove arch_draw_type global 2022-11-25 14:16:30 +01:00
Gleb Mazovetskiy 69c429bb68 Level renderer: Remove level_cel_block global 2022-11-25 14:16:30 +01:00
Gleb Mazovetskiy 4cf0053ece Set underlying type for all the enums
Reduces rg99 binary size by 3 KiB.
2022-08-11 01:43:54 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy eb8721885d Fix clang warnings
As seen in the Xbox NDK build.
2022-07-04 09:39:41 +01:00
Anders Jenbo 860bd1cebf Operate directly on SOL data 2022-06-18 21:27:05 +02:00
Anders Jenbo 0508311959 Cleanup block_lvid checks 2022-05-29 22:32:14 +02:00
Anders Jenbo b6bdbcfc98 Stip stippled transparency 2021-12-21 12:55:30 +01:00
obligaron 6273f700fa Add some Graphic Settings to Settingsmenu (#3617) 2021-11-27 00:25:48 +01:00
Juliano Leal Goncalves 7da37da8c9 ♻️ Leverage 'Point' in 'RenderTile' function 2021-09-06 00:31:25 +02:00
Anders Jenbo dce78dde62 Rename lighting globals 2021-07-08 02:01:14 -07:00
Gleb Mazovetskiy cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Anders Jenbo 8e07ef8fe5 Clang-tidy: misc-unused-parameters 2021-06-27 17:34:32 +02:00
Anders Jenbo 2bdb6caa07 Cleanup majority of remaning implicit bool conversions (#2234) 2021-06-26 21:05:45 +02:00
Anders Jenbo af254601d6 ♻️ Apply clang-tidy to engine 2021-06-25 13:22:08 +02:00
Gleb Mazovetskiy f624b9788c 🔥 Mark dun_render functions as hot 2021-05-13 01:54:27 +02:00
Gleb Mazovetskiy 4d10642b3d 🧹 Add and use a DVL_ALWAYS_INLINE macro
Also moves attribute macros out of miniwin into a new header.
2021-05-13 01:54:27 +02:00
Gleb Mazovetskiy fb27ee3907 💨 dun_render.cpp: Faster RenderLine
Turns RenderLine line branches into template parameters, allowing the
compiler to eliminate the branches and also fully inline it.

Example FPS change

* In dungeon: 1450 -> 1530
* In town: 1655 -> 1700

Also splits RenderLine into 3 functions

Easier to read and also gives more useful profiling.
Apparently the most time is spent in `RenderLineOpaque`.

Also, mark them `inline` because that apparently hints GCC to inline
the function (in a later refactoring we can introduce attribute
always_inline instead where supported).
2021-05-12 08:17:14 +02:00
Gleb Mazovetskiy 59dd42692f 🚚 Move render.cpp to engine/render/dun_render.cpp 2021-05-06 21:30:06 +02:00