Commit Graph

27 Commits

Author SHA1 Message Date
Jelle Raaijmakers
6c80d12111 LibGPU+LibSoftGPU: Add PixelFormat::Intensity 2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
eb7c3d16fb LibGL+LibGPU+LibSoftGPU: Implement flexible pixel format conversion
A GPU (driver) is now responsible for reading and writing pixels from
and to user data. The client (LibGL) is responsible for specifying how
the user data must be interpreted or written to.

This allows us to centralize all pixel format conversion in one class,
`LibSoftGPU::PixelConverter`. For both the input and output image, it
takes a specification containing the image dimensions, the pixel type
and the selection (basically a clipping rect), and converts the pixels
from the input image to the output image.

Effectively this means we now support almost all OpenGL 1.5 formats,
and all custom logic has disappeared from:
  - `glDrawPixels`
  - `glReadPixels`
  - `glTexImage2D`
  - `glTexSubImage2D`

The new logic is still unoptimized, but on my machine I experienced no
noticeable slowdown. :^)
2022-08-27 12:28:05 +02:00
Luke Wilde
7d1fcb0cb3 LibGPU: Do not load LibSoftGPU via symlink inside Serenity
For unknown reasons, unveil() does not work on symlinks. This prevents
it from being used in an unveil environment such as WebContent.
2022-06-13 21:45:27 +01:00
RKBethke
0836912a6d LibGL+LibGPU+LibSoftGPU: Implement and expose glClipPlane
This commit implements glClipPlane and its supporting calls, backed
by new support for user-defined clip planes in the software GPU clipper.

This fixes some visual bugs seen in the Quake III port, in which mirrors
would only reflect correctly from close distances.
2022-05-11 23:09:47 +02:00
Jelle Raaijmakers
a20bf80b05 LibGL+LibGPU+LibSoftGPU: Implement point and line drawing
Implement (anti)aliased point drawing and anti-aliased line drawing.
Supported through LibGL's `GL_POINTS`, `GL_LINES`, `GL_LINE_LOOP` and
`GL_LINE_STRIP`.

In order to support this, `LibSoftGPU`s rasterization logic was
reworked. Now, any primitive can be drawn by invoking `rasterize()`
which takes care of the quad loop and fragment testing logic. Three
callbacks need to be passed:

* `set_coverage_mask`: the primitive needs to provide initial coverage
   mask information so fragments can be discarded early.
* `set_quad_depth`: fragments survived stencil testing, so depth values
  need to be set so depth testing can take place.
* `set_quad_attributes`: fragments survived depth testing, so fragment
  shading is going to take place. All attributes like color, tex coords
  and fog depth need to be set so alpha testing and eventually,
  fragment rasterization can take place.

As of this commit, there are four instantiations of this function:

* Triangle rasterization
* Points - aliased
* Points - anti-aliased
* Lines - anti-aliased

In order to standardize vertex processing for all primitive types,
things like vertex transformation, lighting and tex coord generation
are now taking place before clipping.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
582fb3f263 LibGL+LibGPU: Copy line width to rasterizer in glLineWidth 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
0abb7df09b LibGL+LibGPU: Implement GL_LINE_SMOOTH context parameter 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
f13d4cd3a0 LibGL+LibGPU: Implement GL_POINT_SMOOTH context parameter 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
0dcb23ee96 LibGL+LibGPU: Implement glPointSize 2022-05-09 21:49:48 +02:00
Jesse Buhagiar
c9f44c746a LibGL+LibSoftGPU: Add GL_ADD Texture Environment 2022-04-09 11:40:33 +02:00
Sahan Fernando
154cb4e368 LibGPU: Don't dlopen using absolute path 2022-04-07 17:11:22 +02:00
Stephan Unverwerth
5bb76e9b63 LibGL+LibGPU+LibSoftGPU: Load SoftGPU driver dynamically
This loads libsoftgpu.so during GLContext creation and instantiates the
device class which is then passed into the GLContext constructor.
2022-04-06 11:32:24 +02:00
Stephan Unverwerth
211d24a218 LibGL+LibGPU+LibSoftGPU: Add virtual base class for devices
This adds a virtual base class for GPU devices located in LibGPU.
The OpenGL context now only talks to this device agnostic interface.

Currently the device interface is simply a copy of the existing SoftGPU
interface to get things going :^)
2022-04-06 11:32:24 +02:00
Stephan Unverwerth
4a99875582 LibGL+LibGPU+LibSoftGPU: Add virtual base class for Images
This introduces a new device independent base class for Images in LibGPU
that also keeps track of the device from which it was created in order
to prevent assigning images across devices.
2022-04-06 11:32:24 +02:00
Stephan Unverwerth
1f3642ed48 LibGPU+LibSoftGPU: Move RasterizerOptions into LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
5d2740217f LibGL+LibGPU+LibSoftGPU: Move Vertex.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
5bf224708f LibGPU+LibSoftGPU: Move LightModelParameters into LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
5a5596b381 LibGL+LibGPU+LibSoftGPU: Move TexCoordGenerationConfig into LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
8f359bf758 LibGPU+LibSoftGPU: Move RasterPosition into its own header in LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
e416380826 LibGL+LibGPU+LibSoftGPU: Move StencilConfiguration.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
b652db1f54 LibGL+LibGPU+LibSoftGPU: Move Material.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
7da9447619 LibGL+LibGPU+LibSoftGPU: Move Light.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
e7450fa940 LibGL+LibGPU+LibSoftGPU: Move SamplerConfig to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
54307a9cd3 LibGL+LibGPU+LibSoftGPU: Move ImageDataLayout.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
4e0643ae97 LibGL+LibGPU+LibSoftGPU: Move ImageFormat.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
24d420312c LibGL+LibGPU+LibSoftGPU: Move Enums.h to LibGPU 2022-04-06 11:32:24 +02:00
Stephan Unverwerth
ac033dd9b6 LibGL+LibGPU+LibSoftGPU: Move DeviceConfig to LibGPU
This introduces a new abstraction layer, LibGPU, that serves as the
usermode interface to GPU devices. To get started we just move the
DeviceConfig there and make sure everything still works :^)
2022-04-06 11:32:24 +02:00