Commit Graph

438 Commits

Author SHA1 Message Date
Bastiaan van der Plaat
494a8cb816 AK: Add to_radians and to_degrees math functions 2023-09-10 08:38:29 +01:00
Timothy Flynn
c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Jelle Raaijmakers
ea2f88a483 LibGL: Implement support for the GL_RGB5_A1 internal image format
We already support this in all other logic and in LibSoftGPU, I just
forgot to add this constant to this list.
2023-05-04 16:11:28 +02:00
Linus Groh
e76394d96c AK: Remove infallible version of StringBuilder::to_byte_buffer
Also drop the try_ prefix from the fallible function, as it is no longer
needed to distinguish the two.
2023-03-09 15:51:00 +00:00
Karol Baraniecki
fc4d37eea5 LibGL: Use fallible version of StringBuilder::to_byte_buffer 2023-03-09 12:59:57 +00:00
Andreas Kling
c837e7bbf3 LibGL: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Timothy Flynn
4a916cd379 Everywhere: Remove needless copies of Error / ErrorOr instances
Either take the underlying objects with release_* methods or move() the
instances around.
2023-02-10 09:08:52 +00:00
Jelle Raaijmakers
e3f8ac2c05 LibGL: Remove DeprecatedString usage
We only use it for the extension string, which we now convert into a
`ByteBuffer` object containing the null-terminated bytes :^)
2023-01-30 13:49:52 -05:00
Timothy Flynn
f1de4f8872 Everywhere: Convert known short-strings to the infallible String factory
For now, this is limited to strings that are 3 bytes or less. We can use
7 bytes on 64-bit platforms, but we do not yet assume 64-bit for Lagom
hosts (e.g. wasm).
2023-01-20 14:24:12 -05:00
Jelle Raaijmakers
d57e9b53a0 LibGL: Implement GL_BLEND_DST and GL_BLEND_SRC
These context parameters are used to retrieve the active blend
functions.
2023-01-03 19:49:31 -05:00
Jelle Raaijmakers
456a8436b5 LibGL: Remove i686 data types in favor of 64-bit types 2023-01-03 18:11:37 +01:00
Jelle Raaijmakers
62092a329d LibGL: Make GLsizeiptr signed
The Khronos description of a "non-negative binary integer" does not mean
an unsigned type, just that it should not be negative.
2023-01-03 18:11:37 +01:00
Ben Wiederhake
a55360781b LibGL: Move AK/Debug.h include to where it is used 2023-01-02 20:27:20 -05:00
Jelle Raaijmakers
ee4039caf8 LibGL: Stop unnecessarily casting to float
If the `GLContext`'s internal state uses a `float`, it makes no sense
casting to and from `double`s.
2023-01-01 23:33:50 +01:00
Jelle Raaijmakers
474f9e9c69 LibGL: Implement GL_TEXTURE_ENV_COLOR
This sets a constant color in the texture's environment for the fixed
function pipeline.
2023-01-01 23:33:26 +01:00
Jelle Raaijmakers
ae82b14e59 LibGL+LibWeb: Remove WebGL-specific API from GLContext
The OpenGL API has ways to retrieve these values, so let's make sure to
implement them. :^)
2022-12-25 15:48:59 +01:00
Jelle Raaijmakers
2da1c1c10e LibGL: Generate the API wrappers
We now generate all LibGL API wrappers from a single API method
definition list stored in `GLAPI.json`. Since a significant portion of
the OpenGL API methods are relatively consistent variants, we take
advantage of this to generate a lot of these variants at once.

The autogenerated methods check for the non-nullness of the current
`GLContext`, and only perform an action if a `GLContext` is present.
This prevents a crash in ports like GLTron, who assume you can still
call the OpenGL API without an active context.

This increases our API wrapper method count from 211 to 356.

Fixes #15814.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
8c094699db LibGL: Implement glLightModel integer normalization
For the ambient light model, integers need to be remapped to a range of
`-1.` through `1.`. Add the `+` and `-` operators to `VectorN` to make
it a bit easier to normalize 4 values at once.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
a074b7e871 LibGL: Support glLightModel inside lists
We now dereference the pointer given to us before adding the arguments
to an active list. This also factors out the switching logic from the
API wrappers, which helps us with a future commit where we autogenerate
all API wrapper functions.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
403c560a7a LibGL: Correct GL_LIGHT_MODEL_LOCAL_VIEWER comparison
We were comparing the `x` parameter to `1.f` instead of `0.f`.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
6d68f47495 LibGL: Dereference pointer in a consistent way for glMaterial* 2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
7c4bbdc398 LibGL: Simplify transposing input matrices
We do not need to templatize the output type - it's always `float`.
Also, the input type can be inferred. Finally, use template
specialization instead of a conditional to deal with same type input and
output matrices.
2022-12-20 10:42:31 +01:00
Stephan Unverwerth
28ad49bcbd LibGL: Pass generated GPU IR to GPU side compiler when linking program 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
93ab2db80f LibGL+LibSoftGPU: Add GPU side shader infrastructure
This adds a shader class to LibSoftGPU and makes use of it when linking
GLSL program in LibGL. Also adds actual rendering code to the shader
tests.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
4ad41e6680 LibGL: Use LibGLSL to compile shaders 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
67b2f8d68d LibGLSL: Add LibGLSL
This adds a new library, LibGLSL for parsing and compiling GLSL programs
to LibGPU IR. Currently the compiler consists only of stubs.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
1b7b6e6c91 LibGL: Implement glGetProgramiv 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
424e0a2792 LibGL: Implement glGetShaderiv 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
69171e7a05 LibGL: Implement glUseProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
848f1d2689 LibGL: Make shader compilation and program linking always succeed
This will help with testing until the actual compilation infrastructure
is in place.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
fdd76639d8 LibGL: Implement glLinkProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
7f062e35a4 LibGL: Implement glAttachShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
42ef5c9e12 LibGL: Implement glCompileShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
d5277ecdfe LibGL: Implement glShaderSource 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
962d088e4e LibGL: Implement glCreateProgram and glDeleteProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
a0adbfbf81 LibGL: Implement glCreateShader and glDeleteShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
b975569a40 LibGL: Add Shader and Program class stubs 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
cd7d2c3446 LibGL: Remove Texture note leftovers from the NameAllocator class
The NameAllocator class is not only about Textures, so let's change a
comment being related to it.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
4568dcbb55 LibGL: Add stubs for shader and program related functions 2022-12-17 22:39:09 -07:00
Marcus Nilsson
f76c7f3788 LibGL: Generate GL_OUT_OF_MEMORY error in glBufferData when OOM 2022-12-07 11:46:37 +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
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
cflip
b83181ef93 LibGL: Use buffers in vertex pointer functions and glDrawElements
Many of these functions will treat the 'pointer' parameter as an offset
into a buffer if one is currently bound.

This makes it possible to run ClassiCube with OpenGL 1.5 support!
2022-11-26 09:38:13 +01:00
cflip
59df2e62ee LibGL: Add simple implementation of buffer objects
For now, buffers are only implemented on the LibGL side, however in the
future buffer objects should be stored in LibGPU.
2022-11-26 09:38:13 +01:00
cflip
892006218a LibGL: Refactor TextureNameAllocator to a more general NameAllocator
This functionality can also be used for other types of objects.
2022-11-26 09:38:13 +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
Jelle Raaijmakers
91cec51b99 LibGL: Correctly normalize different vertex attribute type pointers
According to the OpenGL 2.0 spec § 2.8, the data for each attribute type
pointer is normalized according to the type. The only exception to this
is `glVertexAttribPointer` which accepts a `normalized` parameter, but
we have not yet implemented that API.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
00b21fba57 LibGL: Return GLboolean value in glIsEnabled 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
fe5419da0f LibGL: Implement state for all pixel store parameters
This implements the state and context parameters for all packing and
unpacking parameters accepted by `glPixelStore*`.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
e2b151812e LibGL: Don't repeat ourselves in read_from_vertex_attribute_pointer 2022-10-19 22:22:58 +02:00