Peter Nelson
d2ee2add28
Codechange: Remove ZOOM_LVL_GUI macro. ( #14423 )
2025-07-09 11:05:06 +01:00
Peter Nelson
8c4f8af66e
Codechange: Move std::unique_ptr out of LRUCache implementation.
...
This is an implementation detail of how OpenGLSprites are stored.
2025-05-06 18:09:00 +01:00
frosch
8571af9833
Codechange: Turn ZoomLevel into enum class.
2025-05-03 23:21:09 +02:00
frosch
c0d4ab69d0
Codechange: Add a container to index data by zoom level.
2025-05-03 23:21:09 +02:00
frosch
02082a0211
Codechange: Deduplicate array lookup.
2025-05-03 18:43:20 +02:00
frosch
bb767608de
Codechange: Pass SpriteType as direct parameter to SpriteEncoder::Encoder.
2025-05-03 18:43:20 +02:00
Rubidium
c79abc6da6
Codechange: reduce dependence on C-style strings in OpenGL
2025-05-03 14:24:49 +02:00
frosch
79b2202f2e
Codechange: Use StringConsumer for parsing more strings.
2025-04-29 20:14:56 +02:00
frosch
2a62eea005
Codefix: Comment style. ( #14064 )
2025-04-21 17:25:09 +02:00
Peter Nelson
653e886d26
Codechange: Use std::array in OpenGLSprite to remove MemSetT.
2025-03-15 20:09:38 +00:00
Rubidium
649ed702cc
Codefix: potential unintended sign extension
2025-03-12 17:03:35 +01:00
Rubidium
b50cf8f252
Codechange: rework OpenGL backend to not need emplacement new and manual deconstructor calls
2025-02-23 14:44:11 +01:00
Peter Nelson
ba20ea5d18
Codechange: Use EnumBitSet for SpriteComponent. ( #13509 )
2025-02-09 18:37:01 +00:00
Peter Nelson
7b717fcccb
Codechange: Replace AllocatorProc with SpriteAllocator class.
...
This allows for state to be passed to or maintained by the allocator.
2024-05-30 20:16:28 +01:00
Peter Nelson
5e689ce25e
Codechange: Store cursor sprites in vector. ( #12564 )
...
Combine two separate fixed length arrays to allow simpler iteration.
No need to check that arrays are all the same length.
No need to separately store the number of sprites to draw.
Removes the upper limit of the number of sprites that can be drawn.
Removes lengthof and array indices.
2024-04-24 21:26:07 +01:00
Peter Nelson
332cbca36e
Codechange: Pass std::string_view from drivers instead of char *.
2024-04-10 22:02:04 +01:00
Peter Nelson
3c94e81665
Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
...
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Peter Nelson
b85ecf9ac2
Codechange: Replace pointer to Sprite array with reference to SpriteCollection. ( #11580 )
...
Add `SpriteLoader::SpriteCollection` type which is an array of `SpriteLoad::Sprite`.
This removes the ambiguity of what `SpriteLoader::Sprite *` is pointing to,
and cleans up mismatches using both dereference -> and array access [] for the
same object.
2023-12-20 20:38:21 +00:00
rubidium42
cb8612ba79
Remove: ZOOM_LVL_COUNT
...
This is the only enumeration with a COUNT and END. The logic of the COUNT
implied that BEGIN could be non-zero, but all but two uses of zoom level
assume that BEGIN is zero, making the separate count only confusing.
2023-11-29 21:12:28 -04:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
PeterN
d086f288cd
Codechange: Remove duplicated includes. ( #10888 )
...
These are now included by stdafx.h so don't need to be included again.
2023-05-29 14:29:00 +01:00
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
2023-05-17 10:14:41 +01:00
PeterN
e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. ( #10663 )
...
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Tyler Trahan
066ae6f3fb
Codechange: Simplify some CodeQL-flagged trivial switches
2023-03-25 18:03:16 -04:00
rubidium42
6ba55e663e
Codechange: do not hide variables with other variables
2023-01-29 07:21:34 +01:00
Patric Stout
1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" ( #10306 )
...
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
PeterN
4031894aef
Cleanup: Remove svn-style $Id$
comments. ( #10122 )
2022-11-01 18:24:31 -06:00
Niels Martin Hansen
345dcd3c7b
Add: Show current video driver info in Options window
2022-05-03 21:03:30 +02:00
Michael Lutz
883e21dbb7
Codechange: [OSX] We use OpenGL even if Apple doesn't like it.
2021-06-22 21:09:37 +02:00
Rubidium
357af686dc
Cleanup: use true/false instead of 1/0 where applicable
2021-06-17 16:18:30 +02:00
Rubidium
f904aef176
Cleanup: use nullptr instead of 0 or NULL
2021-06-17 16:18:30 +02:00
rubidium42
55a11710a6
Codechange: convert printf DEBUG statements to fmt Debug statements
2021-06-13 12:45:45 +02:00
Michael Lutz
97722931a9
Fix: [OpenGL] Increase timeout when waiting for the GPU to be done with the drawing buffer.
...
The old timeout could be too short if v-sync was on on lower refresh rates.
2021-05-23 12:22:59 +02:00
Michael Lutz
f4d5c8d99e
Fix: [OpenGL] Main loop expects to start with the video buffer unmapped. ( #9100 )
2021-04-25 00:43:38 +02:00
Michael Lutz
d1dd997f07
Change: [Win32] Limit the OpenGL video driver to OpenGL 3.2 or newer on Windows.
2021-04-22 21:04:04 +02:00
Michael Lutz
e53313391a
Fix: [OpenGL] Check maximum supported texture size against screen resolution.
2021-04-21 22:44:59 +02:00
Michael Lutz
433602b072
Fix #9028 : [OpenGL] Clear cursor cache on destroying the OpenGL backend.
2021-04-12 22:40:40 +02:00
Jonathan G Rennison
39b7ef31f8
Fix: Data races on cursor state in OpenGL backends
2021-04-10 18:31:42 +02:00
Jonathan G Rennison
fbd0a2e65a
Fix: Thread unsafe use of sprite cache in OpenGLBackend::DrawMouseCursor
...
See also: #8870
See also: #8977
2021-04-10 18:31:42 +02:00
Milek7
7a886cb4d4
Change: Do not disallow persistent buffer mapping on AMD GPUs, as it is actually faster.
2021-03-25 19:37:24 +00:00
Michael Lutz
df958dc907
Fix f0f96e31
: [OpenGL] Broken window resizing due to invalid buffer pitch on texture creation.
2021-03-21 22:26:55 +01:00
frosch
0230624359
Fix f0f96e31
: [OpenGL] warning: comparison of integer expressions of different signedness. ( #8881 )
2021-03-21 18:38:51 +01:00
Michael Lutz
f0f96e3103
Fix #8871 : [OpenGL] Initialize all buffers after resize and clear back buffer. ( #8877 )
2021-03-20 19:43:54 +01:00
Michael Lutz
436cdf1fc8
Fix #8825 : [OpenGL] Don't clear cursor cache from the game loop thread.
2021-03-08 21:35:35 +01:00
Patric Stout
e56d2c63c3
Add: [Video] move GameLoop into its own thread
...
This allows drawing to happen while the GameLoop is doing an
iteration too.
Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.
Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.
This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
2021-03-08 19:18:55 +01:00
Michael Lutz
d79398a1d5
Fix #8763 : [OpenGL] Cursor sprite origin can be negative.
2021-02-28 11:12:13 +01:00
Michael Lutz
77854d561b
Fix: [OpenGL] Don't use OpenGL on MESA software renderers.
...
Performance in this case is worse than not using OpenGL, so just let
OTTD fall back to a different video driver.
2021-02-27 19:01:34 +01:00
frosch
dfa141818b
Fix: OpenGL cursor did not consider sprite offsets of cursor sprites.
2021-02-27 14:52:11 +01:00