Commit Graph

7485 Commits

Author SHA1 Message Date
Brian Gianforcaro
a62669ebcf LibCore: Add Core::System::getcwd() wrapper 2021-12-24 14:29:52 -08:00
Brian Gianforcaro
49749e279a LibC: Implement _setjmp and _longjmp
These are aliases to `setjmp()` and `longjmp()` on our system,
as our implementations don't modify the signal mask.

This is required for the syzkaller executor process.
2021-12-24 05:26:21 -08:00
Sam Atkins
f6633a1026 LibGUI+Userland: Make SortingProxyModel::create() return ErrorOr
Unfortunately, most of the users are inside constructors, (and two
others are inside callback lambdas) so the error can't propagate, but
that can be improved later.
2021-12-24 05:11:52 -08:00
Stephan Unverwerth
c72a996542 LibSoftGPU: Add method to copy texels between images
Adds a method `copy_texels()` to class `Image` that copies a rect of
texels from source image to destination.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
5e9d99474d LibGL: Remove image storage from MipMap
Images are stored on the device side. Texture2D and MipMap are now only
used to store imformation about the texture and reference to the device
image.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
4c944eaa41 LibGL: Remove sampling code from Sampler2D
Texture sampling now happens entirely in SoftGPU thus this class will
now only be used to hold the sampler configuration.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
39995548e4 LibGL+LibSoftGPU: Add method to query device info
This adds a method `info()` to SoftGPU that returns the name of the
hardware vendor and device name, as well as the number of texture untis.

LibGL uses the returned texture unit count to initialize its internal
texture unit array.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
1a758d7bf2 LibSoftGPU: Move enums into separate file 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
f7c40b25ac LibSoftGPU: Remove GLenum used for selecting rendered primitive type
This removes the last reference to LibGL from LibSoftGPU. The GLenum
has been replaced by our own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
de0069188f LibSoftGPU: Remove OpenGL type for polygon mode
Replaces the GLenum used to setup polygon mode in RasterizerOptions with
our own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
f4d29bf665 LibSoftGPU: Remove OpenGL type for fog mode
Replaces the GLenum used to set up the fog mode in RasterizerOptions
with out own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
74ed7713fa LibSoftGPU: Remove OpenGL type for depth test func
Replaces the GLenum used in the RasterizerConfig for selecting the depth
test function with out own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
33e601800c LibSoftGPU: Remove OpenGL type for draw buffer selection
Replaces the GLenum used in RasterizerConfig to select the draw buffer
with a simple boolean that disabled color output when the draw buffer
is set to GL_NONE on the OpenGL side.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
1904be0370 LibSoftGPU: Remove OpenGL type for culled side selection
Replaces the GLenum in RasterizerConfig, that selects the triangle sides
to be culled, with two booleans.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
24c76741e8 LibSoftGPU: Remove OpenGL type for front face selection
Replaces the GLenum used for selecting the frontface in the rasterizer
config with out own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
c720cd00db LibSoftGPU: Remove OpenGL type for alpha blend factors
Replaces the GLenum used for configuring alpha blend factors in the
SoftGPU device with out own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
40bd73bdef LibSoftGPU: Remove OpenGL type for alpha test func
Replaces the OpenGL enum used for setting the alpha test func in
RasterizerOptions with out own enum.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
7d49015403 LibSoftGPU: Remove simple OpenGL types from RasterizerConfig
Replace GLfloat and GLboolean types in RasterizerConfig with their c++
native equivalent.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
d8c17c8838 LibGL+LibSoftGPU: Use device samplers for rendering
We now sample textures from the device owned image samplers.
Passing of enabled texture units has been simplified by only passing a
list of texture unit indices.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
f69de5e850 LibGL: Synchronize device config before rendering if anything changed 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
39545d4b49 LibGL: Attach device image to texture object and upload image data 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
908a6339ec LibSoftGPU: Add legacy texture env mode to sampler config 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
b41ad28654 LibSoftGPU: Add methods to read and write image data
This adds two methods, write_texels and read_texels, to the Image class.
Conversion between image formats happens automatically. The layout of
the client image data is passed in via ImageDataLayout struct.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
2a72d14336 LibSoftGPU: Make samplers part of device
This adds a sampler array to the device implementation and adds a method
`set_sampler_config` to configure samplers.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
b8bb72abbe LibSoftGPU: Add device method for creating images 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
91ccf9958f LibSoftGPU: Add Image class
This serves as the storage for all image types. 1D, 2D, 3D, Cube and
image arrays.

Upon construction a full mipmap chain is generated and the image is
immutable afterwards with respect to its layout.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
a9e27b9a0f LibSoftGPU: Rename class SoftwareRasterizer to Device
This class does everything related to rendering now. It is the software
implementation of a full GPU device.
2021-12-24 05:10:28 -08:00
Stephan Unverwerth
178b28b469 LibGL: Remove unused GLStruct.h 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
251f3c007f LibGL+LibSoftGPU: Move Vertex and Triangle structs to LibSoftGPU 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
73ba208ee7 LibGL+LibSoftGPU: Move primitive assembly and clipping into LibSoftGPU 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
2f35135743 LibGL+LibSoftGPU: Add face culling state to rasterizer options 2021-12-24 05:10:28 -08:00
Stephan Unverwerth
ad3d5d43bd LibGL+LibSoftGPU: Move rendering related code to LibSoftGPU library
This introduces a new library, LibSoftGPU, that incorporates all
rendering related features that formerly resided within LibGL itself.

Going forward we will make both libraries completely independent from
each other allowing LibGL to load different, possibly accelerated,
rendering backends.
2021-12-24 05:10:28 -08:00
Elyse
c78a8b94c5 Everywhere: Refactor 'muted' to 'main_mix_muted' in all AudioConnections
The 'muted' methods referred to the 'main mix muted' but it wasn't
really clear from the name. This change will be useful because in the
next commit, a 'self muted' state will be added to each audio client
connection.
2021-12-24 00:19:01 -08:00
Arne Elster
60c3ad9ae8 LibFileSystemAccessClient: Allow custom access rights for open/save
There can be cases when one wants to open a file not just for reading
but also for writing. It was already possible to have a custom open mode
for request_file, now it is also possible through the open/save dialogs.
2021-12-23 23:25:47 -08:00
FrHun
86363ffe6e LibGUI: Add visual clue to Scrollbar gutter
This adds a visual clue to scrolling by clicking on the Scrollbar
gutter. This gives the user a hint that scrolling will continue in the
direction of the darkened gutter, until the mouse is released.
It is inspired by very similar behavior on old windows.
2021-12-23 23:19:42 -08:00
Michel Hermier
682f89d5bc LibC: Allow multiple includes of <assert.h>
ISO C requires in section 7.2:
The assert macro is redefined according to the current state of NDEBUG
each time that <assert.h> is included.

Also add tests for `assert` multiple inclusion accordingly.
2021-12-23 17:53:46 -08:00
Brian Gianforcaro
a47f43d4cb LibGfx: Harden TTF parsing against fuzzers
Instead of asserting this edge case, bail out instead.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42653
2021-12-23 17:43:31 -08:00
Brian Gianforcaro
0a827eaa02 LibGfx: Fix incorrect error handling in ICOLoader
This was found by OSS Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42188
2021-12-23 17:43:31 -08:00
Linus Groh
3ab1c52e2b LibJS: Require 'T' prefix for ambiguous time-only strings
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/514ede3
2021-12-24 00:07:52 +01:00
Daniel Bertalan
8e3d1a42e3 Kernel+UE+LibC: Store address as void* in SC_m{re,}map_params
Most other syscalls pass address arguments as `void*` instead of
`uintptr_t`, so let's do that here too. Besides improving consistency,
this commit makes `strace` correctly pretty-print these arguments in
hex.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
d1ef8e63f7 LibELF: Use MAP_FIXED_NOREPLACE for address space reservation
This ensures that we don't corrupt our address space if a non-PIE
program's requested address space happens to coincide with memory we
already use.
2021-12-23 23:08:10 +01:00
Hendiadyoin1
d001f8ba70 LibX86: Mark two InstructionDescriptor functions as const
Thanks clang-tidy
2021-12-23 12:45:36 -08:00
James Puleo
bf714efa41 LibMain: Make "Runtime error" warnln red
Stealing what Andreas did for the `dbgln` output, I think it also looks
nice inside of Terminal :^)
2021-12-23 12:41:13 -08:00
Brian Gianforcaro
c724955d54 LibC: Add support for posix_madvise(..)
Add the `posix_madvise(..)` LibC implementation that just forwards
to the normal `madvise(..)` implementation.

Also define a few POSIX_MADV_DONTNEED and POSIX_MADV_NORMAL as they
are part of the POSIX API for `posix_madvise(..)`.

This is needed by the `fio` port.
2021-12-22 13:28:13 -08:00
Timothy Flynn
9ce4ff4265 LibJS: Avoid crashing when the Unicode data generators are disabled
The general idea when ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF has been
that the Intl APIs will provide obviously incorrect results, but should
not crash. This regressed a bit with NumberFormat and DateTimeFormat.
2021-12-22 17:30:43 +01:00
Linus Groh
c56e5139f5 LibJS: Fix modulo in get_iso_parts_from_epoch() for negative epoch ns
This now matches the spec change from reminder() to modulo which was
done here: https://github.com/tc39/proposal-temporal/commit/bdf60f5
2021-12-22 11:27:31 +01:00
Linus Groh
61410e05eb LibJS: Add modulo(x, y) overload for Crypto::{Unsigned,Signed}BigInteger
Just like with integral and floating numbers, doing it manually is
error-prone: when we get a negative remainder, y has to be added to the
result to match the spec's modulo.
Solve this by just adding another (templated) overload to also permit
using the function for LibCrypto BigInts.
2021-12-22 11:27:31 +01:00
Linus Groh
0c424c4dab LibCrypto: Add the BigInteger concept
This makes it much easier to write (template) functions that accept
either a signed or unsigned bigint parameter.
2021-12-22 11:27:31 +01:00
Linus Groh
9c209b8079 LibJS: Support modulo(x, y) with different types
It's a bit annoying having to add '.0' to y given that it's an integral
number in most cases.
This turns the single template parameter T into T and U to permit that.
2021-12-22 11:27:31 +01:00
Itamar
a02d8e5710 LibDebug: Add optional setup_child() callback to debugger
If set, this callback gets called right after fork() in the child
process.

It can be used by the caller if it wants to perform some logic in the
child process before it starts executing the debuggee program.
2021-12-22 02:14:32 -08:00