Commit graph

83 commits

Author SHA1 Message Date
Filippos Karapetis
4e7752b923 GRAPHICS: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
unknown
c2f4ec7fce TINYGL: Fix off by one access error
The TGL_TRIANLE_FAN was looping past the valid array size due to the way the
loop is written, relying on i and i+1 to draw the fan. Reducing iteration to
cnt - 1 fixes the access violation and the triangle fan draws properly.
2025-03-25 05:50:36 +01:00
unknown
2cb01134be TINYGL: Fix TGL_TRIANGLE_FAN iteration
Triangle fans need to use a vertex from the previous triangle to create the next
one. The original TGL code does this properly but it was edited at some time and
the iteration changed to move on to the next triangle rather than using the previous
vertex, causing the triangle fan to skip a triangle and render a weird rays thing.
2025-03-25 05:50:36 +01:00
Cameron Cawley
89c57d29ef COMMON: Move more maths functions into the Math namespace 2024-07-27 14:00:48 +03:00
neuromancer
00a0346983 TINYGL: make sure stipple pattern is copied into the internal states instead of using pointers 2024-06-01 15:33:50 +02:00
neuromancer
fdd84fd08a TINYGL: initial implementation of tglPolygonStipple 2024-06-01 15:33:50 +02:00
Cameron Cawley
f40c2ccfbd TINYGL: Remove unused tglBlitNoBlend function 2023-03-03 09:59:41 +00:00
Paweł Kołodziejski
cdaec9de8d
TINYGL: Added fog support. 2022-06-05 20:59:38 +02:00
Paweł Kołodziejski
cf8b3cc1f9 TINYGL: Move function to GLContext 2022-01-01 17:42:32 +01:00
Paweł Kołodziejski
c3a73efa8d TINYGL: No need to check for current_texture 2022-01-01 17:38:48 +01:00
Paweł Kołodziejski
20cb0ae228
ALL: Cleanup ResidualVM -> ScummVM 2021-12-26 21:19:38 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Paweł Kołodziejski
ed93e09f92
STARK: Fixed minority coverity warnings 2021-12-20 19:42:50 +01:00
Paweł Kołodziejski
c66ca22cbb
TINYGL,GRIM: Replace custom shadows to stencil buffer solution 2021-12-10 18:37:24 +01:00
Cameron Cawley
06e79f2adf TINYGL: Use the existing list of rectangles when copying to the screen 2021-12-09 22:01:46 +01:00
Paweł Kołodziejski
6a591146c8
TINYGL: Added stencil buffer implementation 2021-12-09 21:10:53 +01:00
Paweł Kołodziejski
a395700d1f
TINYGL: Put debug dirty rects code into runtime condition 2021-12-09 12:38:41 +01:00
Paweł Kołodziejski
96248ef6ef
TINYGL: Fixed dirtyrect debug display compilation 2021-12-09 09:24:58 +01:00
Paweł Kołodziejski
3b9f9804ee
TINYGL: Rearrange access to TinyGL 2021-12-08 14:52:18 +01:00
Paweł Kołodziejski
87594a052f
TINYGL: Cleanup more FrameBuffer class entries 2021-12-07 22:11:55 +01:00
Paweł Kołodziejski
10f6a79ce8
TINYGL: More work on accessing FrameBuffer class 2021-12-07 20:40:32 +01:00
Paweł Kołodziejski
2368991ab6
TINYGL: Rearrange access gl context access from/to frame buffer class 2021-12-07 19:58:03 +01:00
Paweł Kołodziejski
4e34da3746
TINYGL: Eliminate passing context 2021-12-07 09:54:19 +01:00
Paweł Kołodziejski
c1512a5c40
TINYGL: Eliminate passing context where possible 2021-12-07 00:58:14 +01:00
Paweł Kołodziejski
d80bd265d2
TINYGL: Rearrange visibility various functions 2021-12-06 13:57:41 +01:00
Paweł Kołodziejski
eab1fe4097
TINYGL: Implemented tglPolygonOffset function 2021-10-26 21:59:04 +02:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Vincent Pelletier
f8c72b5967 TINYGL: Move texture resampling from create time to render time
Thanks to pixel repacking using cpu data cache, this has a low runtime
cost even for TGL_LINEAR.
Adds support for TGL_NEAREST.
Adds support for TGL_MIRRORED_REPEAT, TGL_CLAMP_TO_EDGE and TGL_REPEAT.
Also, add support for more texture clamping and resampling options.

Mipmaps are not supported, although their sampling modes will be
applied - but to the full-size texture instead of selected mipmap.

Note: Texture sampler is still chosen at texture creation time.
2020-11-12 08:15:39 +01:00
Mathias Parnaudeau
2cad855184 TINYGL: Fix wrong access to the list of dirty rects
The function end() of a list does not return the last element but a fake element
after the last one, for the need of the iterator.
Trying to access to the data of the element returned by end() and that has no
such field, that caused a stack buffer overflow, reading uninitialized data.

Called function back() instead, to get the last element of the list.
2020-02-21 07:20:11 +01:00
Vincent Pelletier
a6af3a38a3 TINYGL: Fix vertice color when clipped and lighting is disabled
longcurrent_color is assigned per vertex, but it is not saved on each
vertex on creation (unlike their "color" attribute, used when lighting
is enabled).
As a consequence, and because rendering happens asynchronously (rather,
following the draw call queue managed by zdirtyrect.cpp when requested
to flip current buffer), longcurrent_color at clipping time can be
different to the one at vertex declaration time, causing color artifacts.

The effect is most noticeable in EMI set shi, in the grog dispenser +
shipyard manager closeup angle, when Guybrush exits the screen by
crossing its right border: dark triangles become visible on his face.

Instead, always use the color attribute, which is already properly
initialised on vertex creation.
2017-07-20 01:51:07 +00:00
Vincent Pelletier
d797461fa9 TINYGL: Clip dirty rectangle to render rectangle.
As all dirty rectangles are inflated by 1 pixel to the right and one to the
bottom, they may exceed render rectangle. So clip them again. There should
be very few rectangles at this point, so this should be cheap.
2017-05-02 09:57:09 +00:00
Vincent Pelletier
5f993ac66f TINYGL: TGL_LINE_STRIP and TGL_LINE_LOOP are one line appart 2017-04-28 21:54:11 +00:00
Vincent Pelletier
fc37fabf0d TINYGL: Fix assertion failure during EMI intro video.
This is a regression introduced by
commit 6a63f544f0
    TINYGL: Avoid duplicating gl_transform_to_viewport.
2017-04-25 00:58:24 +00:00
Vincent Pelletier
2a1ab0a622 TINYGL: Do not queue invisible draw calls.
When dirty rectangles are enabled, we know at this point whether a draw
operation will have any effect on screen. Do not queue it if it will not.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
bf319b5437 TINYGL: Cache and clip dirty rect on all DrawCall subclasses.
getDirtyRegion will be called twice on each DrawCall instance, so make
repeated work as short as possible.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
6a63f544f0 TINYGL: Avoid duplicating gl_transform_to_viewport.
Replace local implementation by always setting GLVertex zp property.
Replace pointInsideVolume by clip_code, allowing to properly handle
polygons whose vertices are all off-screen but still have a part visible.
Also, replace 2-pixels offset with a more accurate bounding box
computation.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
064bd1d47b fixup! TINYGL: ClearBufferDrawCall should obey its parameters.
Fixes an undeclared property error.
2017-04-23 11:54:53 +00:00
Vincent Pelletier
6087492dbd TINYGL: Simplify setting & disabling scissors. 2017-04-23 10:35:04 +00:00
Vincent Pelletier
e1de3407f1 TINYGL: Make scissors follow Common::Rect semantics.
As per Common::Rect data model, right and bottom border are excluded, so:
- Make FrameBuffer::scissorPixel reject bottom & right borders.
- Update bounding rectangle definition for dirty rectangle operations
  ClearBufferDrawCall::getDirtyRegion is already correct.
- zblit was almost following, except for an off-by-one mistake.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
3acde7d900 TINYGL: static-ify zdirtyrect.cpp 2017-04-23 10:35:04 +00:00
Vincent Pelletier
2fb2d87dc9 TINYGL: Skip drawing when there is no dirty rectangle 2017-04-23 10:35:04 +00:00
Vincent Pelletier
72389d23df TINYGL: Simplify _drawCallAllocator switch & reset. 2017-04-23 10:35:04 +00:00
Vincent Pelletier
580578fa20 TINYGL: Containment is just a special case of intersection. 2017-04-23 10:35:04 +00:00
Vincent Pelletier
3f4a22354e TINYGL: Remove redundant condition.
Empty call queue condition is tested in contained "for" loop already.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
5cbdabb69d TINYGL: Continue comparing past first divergence
It is common that the same number of calls are done in the same order, so
do not stop comparing after the first divergence. This saves a significant
number of dirty rectangle in crowded scenes, like sets cn and bi where a few
calls may differ in the middle of call sequence, but later calls would stay
the same.
As a consequence, move current-frame-has-fewer-calls handling to its own
loop.
Also, factorise and extend code appending dirty rectangles.
Also, skip conseutive identical rectangles.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
ce97ff4e8f TINYGL: ClearBufferDrawCall should obey its parameters.
Given dirty rectangle may cover more buffer area than what it was told to
clear.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
112ca82363 TINYGL: Manage BlitImages with a refcount.
So that zdirtyrect can keep an image alive for longer than its creator
intended.
2016-07-28 23:32:43 +00:00
Vincent Pelletier
47a1e826e7 TINYGL: Free draw call lists in glClose. 2016-07-28 01:55:48 +00:00
Vincent Pelletier
46329cca87 TINYGL: Do not compute dirty region when its result is not used. 2016-07-21 16:42:24 +02:00
Vincent Pelletier
a1418732ec TINYGL: Typo in disabled code. 2016-07-21 16:41:24 +02:00