summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSoftGPU/Device.h
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-01-31 17:45:14 +0100
committerLinus Groh <mail@linusgroh.de>2022-02-22 23:48:59 +0000
commit8c9fa50c61ae92f3eaf45c225b1aea9f82689955 (patch)
tree4533804f1f75387dacfce17b3058985d87d91d4a /Userland/Libraries/LibSoftGPU/Device.h
parent38326564645ef3f469b619ee21083996281d3d73 (diff)
downloadserenity-8c9fa50c61ae92f3eaf45c225b1aea9f82689955.zip
LibSoftGPU: Apply regular cartesian coordinate system
Currently, LibSoftGPU is still OpenGL-minded in that it uses a coordinate system with the origin of `(0, 0)` at the lower-left of textures, buffers and window coordinates. Because we are blitting to a `Gfx::Bitmap` that has the origin at the top-left, we need to flip the Y-coordinates somewhere in the rasterization logic. We used to do this during conversion of NDC-coordinates to window coordinates. This resulted in some incorrect behavior when rasterization did not pass through the vertex transformation logic, e.g. when calling `glDrawPixels`. This changes the coordinate system to OpenGL's throughout, only to blit the final color buffer upside down to the target bitmap. This fixes drawing to the depth buffer directly resulting in upside down images.
Diffstat (limited to 'Userland/Libraries/LibSoftGPU/Device.h')
-rw-r--r--Userland/Libraries/LibSoftGPU/Device.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h
index f2e74b510c..ad1aa0b8c9 100644
--- a/Userland/Libraries/LibSoftGPU/Device.h
+++ b/Userland/Libraries/LibSoftGPU/Device.h
@@ -143,8 +143,7 @@ public:
private:
void draw_statistics_overlay(Gfx::Bitmap&);
- Gfx::IntRect raster_rect_in_target_coordinates(Gfx::IntSize size);
- Gfx::IntRect window_coordinates_to_target_coordinates(Gfx::IntRect const&);
+ Gfx::IntRect get_rasterization_rect_of_size(Gfx::IntSize size);
void rasterize_triangle(const Triangle& triangle);
void setup_blend_factors();