Commit Graph

48 Commits

Author SHA1 Message Date
Stephan Unverwerth
5f0eb812ac LibGPU: Add basic shader IR
This adds a header to LibGPU with a basic IR for vertex and fragment
shaders.
2022-12-17 22:39:09 -07:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
cflip
abc0c44f0b LibGL+LibGPU+LibSoftGPU: Report maximum texture size 2022-10-19 22:07:05 +02:00
Andrew Kaster
1ae0cfd08b CMake+Userland: Use CMakeLists from Userland to build Lagom Libraries
Also do this for Shell.

This greatly simplifies the CMakeLists in Lagom, replacing many glob
patterns with a big list of libraries. There are still a few special
libraries that need some help to conform to the pattern, like LibELF and
LibWebView.

It also lets us remove essentially all of the Serenity or Lagom binary
directory detection logic from code generators, as now both projects
directories enter the generator logic from the same place.
2022-10-16 16:36:39 +02:00
Andrew Kaster
828441852f Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY
Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
2022-10-10 12:23:12 +02:00
Ben Wiederhake
c214d31c5e Everywhere: Fix order of includes and #pragma once 2022-09-18 18:30:05 -07:00
Ben Wiederhake
a99cd09891 Libraries: Add missing includes, add namespace qualifiers
This remained undetected for a long time as HeaderCheck is disabled by
default. This commit makes the following file compile again:

    // file: compile_me.cpp
    #include <LibDNS/Question.h>
    // That's it, this was enough to cause a compilation error.

Likewise for most other files touched by this commit.
2022-09-18 13:27:24 -04:00
Andrew Kaster
eef989f9ed LibGPU: Don't use relative paths for libsoftgpu in Lagom environments
We can count on the dynamic loader for each platform, and the RPATH of
our build infrastrucuture, to load the lib up automagically.
2022-09-16 15:32:38 +02:00
Jelle Raaijmakers
1aa1c89afa LibGL+LibGPU+LibSoftGPU: Report texture clamp to edge support 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
00d46e5d77 LibGL+LibGPU+LibSoftGPU: Implement matrix stack per texture unit
Each texture unit now has its own texture transformation matrix stack.
Introduce a new texture unit configuration that is synced when changed.
Because we're no longer passing a silly `Vector` when drawing each
primitive, this results in a slightly improved frames per second :^)
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
1540c56e6c LibGL+LibGPU+LibSoftGPU: Implement GL_GENERATE_MIPMAP
We can now generate texture mipmaps on the fly if the client requests
it. This fixes the missing textures in our PrBoom+ port.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
dda5987684 LibGL+LibGPU+LibSoftGPU: Remove concept of layer in favor of depth
Looking at how Khronos defines layers:

  https://www.khronos.org/opengl/wiki/Array_Texture

We both have 3D textures and layers of 2D textures, which can both be
encoded in our existing `Typed3DBuffer` as depth. Since we support
depth already in the GPU API, remove layer everywhere.

Also pass in `Texture2D::LOG2_MAX_TEXTURE_SIZE` as the maximum number
of mipmap levels, so we do not allocate 999 levels on each Image
instantiation.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
44953a4301 LibGL+LibGPU+LibSoftGPU: Implement glCopyTex(Sub)?Image2d
These two methods copy from the frame buffer to (part of) a texture.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
eb81b66b4e LibGL+LibGPU+LibSoftGPU: Rename blit_color_buffer_to
This makes it consistent with our other `blit_from_color_buffer` and
paves the way for a third method that will be introduced in one of the
next commits.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
1d36bfdac1 LibGL+LibSoftGPU: Implement fixed pipeline support for GL_COMBINE
`GL_COMBINE` is basically a fixed function calculator to perform simple
arithmetics on configurable fragment sources. This patch implements a
number of texture env parameters with support for the RGBA internal
format.
2022-09-11 22:37:07 +01:00
Tim Schumacher
da0e28dccc LibC: Remove the LibDl interface target 2022-09-05 10:12:02 +01:00
Tim Schumacher
27bfb81702 Everywhere: Refer to dlfcn*.h by its non-prefixed name 2022-09-05 10:12:02 +01:00
Jelle Raaijmakers
94f016b363 LibGL+LibGPU+LibSoftGPU: Report texture env add extension
The Quake 3 port makes use of this extension to determine a more
efficient multitexturing strategy. Since LibSoftGPU supports it, let's
report the extension in LibGL. :^)
2022-08-28 23:45:43 +01:00
Jelle Raaijmakers
84c4b66721 LibGL+LibGPU+LibSoftGPU: Implement texture pixel format support
In OpenGL this is called the (base) internal format which is an
expectation expressed by the client for the minimum supported texel
storage format in the GPU for textures.

Since we store everything as RGBA in a `FloatVector4`, the only thing
we do in this patch is remember the expected internal format, and when
we write new texels we fixate the value for the alpha channel to 1 for
two formats that require it.

`PixelConverter` has learned how to transform pixels during transfer to
support this.
2022-08-27 12:28:05 +02:00
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