Commit Graph

31622 Commits

Author SHA1 Message Date
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
46b1c2d609 SoundPlayer: Add a keyboard shortcut 'M' to mute the player
This shortcut let us mute/unmute the player, but it still doesn't update
the volume slider because the actual volume widget can't display a muted
state.
2021-12-24 00:19:01 -08:00
Elyse
8f2161c0ee SoundPlayer: Add 'mute' methods to Player
These methods allow us to mute/unmute the player without needing to
modify the volume level that it has.
2021-12-24 00:19:01 -08:00
Elyse
fb109ab3b4 AudioServer: Ignore 'muted' clients when computing the 'output mix' 2021-12-24 00:19:01 -08:00
Elyse
bb747c471f AudioServer: Add a 'self_muted' state to each client connection
This new state will allow us to ignore muted clients when computing the
'output mix' in the Mixer.
2021-12-24 00:19:01 -08:00
Elyse
ce5f5f543f AudioServer: Add 'mute' member and methods to ClientAudioStream
When computing the 'output mix', the Mixer iterates over all client
audio streams and computes a 'mixed sample' taking into account mainly
the client's volume.

This new member and methods will allow us to ignore a muted client
when computing that mix.
2021-12-24 00:19:01 -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
Max Trussell
60fa8ac109 AudioServer/Mixer: Fix remaining samples underflow
The `m_remaining_samples` attribute was underflowing at the end of an
audio stream. This fix guards against the underflow by only decrementing
the attribute when it is greater than zero.

I found this bug because the SoundPlayer userland application was not
correctly detecting when an audio stream was completed. This was
happening because the remaining samples being returned from the client
audio connection was an underflowed 16 bit integer instead of zero.
2021-12-24 00:05:35 -08:00
Max Trussell
c8eab80b3d SoundPlayer: Sync startup loop and show playlist settings in GUI
This fix syncs up the AudioPlayer's internal state for showing
playlist information with the AudioPlayer's GUI. Before, if the
AudioPlayer was opened with a playlist file (.m3u or .m3u8) it would
automatically show the playlist information in the GUI and set the
loop mode to playlist, but the menu options would be unchecked. In
order to hide the playlist information, the menu option would then
have to be toggled twice -- once on and again off.
2021-12-24 00:05:35 -08:00
Arne Elster
277ac48649 HexEditor: Don't unnecessarily abbreviate variable names
There's enough line space to use readable variable names.
2021-12-23 23:25:47 -08:00
Arne Elster
9f38966105 HexEditor: Make HexDocuments final
There's no reason as to why someone would inherit those, so might
aswell make them final.
2021-12-23 23:25:47 -08:00
Arne Elster
af754211fa HexEditor: Scroll back to the top when opening another file
When a file is opened and scrolled to some position and the user opens
another file, the current scroll position stays the same. That's
disorienting. Therefore, when opening another file, scroll back to the
top.
2021-12-23 23:25:47 -08:00
Arne Elster
fd66dda1d7 HexEditor: Stream input files instead of keeping them in memory
To support editing of large files it is an advantage to not load the
entire file into memory but only load whatever is needed for display at
the moment. To make it work, file access is abstracted into a socalled
HexDocument, of which there two: a memory based and a file based one.
The former can be used for newly created documents, the latter for file
based editing.

Hex documents now do track changes instead of the HexEditor. HexEditor
only sets new values. This frees HexEditor of some responsibility.
2021-12-23 23:25:47 -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
Liav A
52e01b46eb Kernel: Move Multi Processor Parser code to a separate directory 2021-12-23 23:18:58 -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
Michel Hermier
7b8398ea0d Meta: Allow to skip #pragma once check
Some headers migth need to be reentered multiple times (eg. <assert.h>)
so a mecanism to skip that check is necessary.
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
Guilherme Gonçalves
da6aef9fff Kernel: Make msync return EINVAL when regions are too large
As a small cleanup, this also makes `page_round_up` verify its
precondition with `page_round_up_would_wrap` (which callers are expected
to call), rather than having its own logic.

Fixes #11297.
2021-12-23 17:43:12 -08:00
creator1creeper1
615c2cbcce FlappyBug: Make bitmap() methods return NonnullRefPtrs
We are already storing these as NonnullRefPtrs, so we might
as well make the functions return them as such.
2021-12-23 17:42:05 -08:00
creator1creeper1
6f592a32cc FlappyBug: Propagate errors in Cloud class
Move-construct Cloud into the Game class to improve
error handling.
2021-12-23 17:42:05 -08:00
creator1creeper1
ff359c27e3 FlappyBug: Propagate errors in Bug class
Move-construct Bug into the Game class to improve
error handling.
2021-12-23 17:42:05 -08:00
creator1creeper1
a67afa735c FlappyBug: Reposition Game constructor in file
This will become important later on because
the constructor will depend on the helper structs
2021-12-23 17:42:05 -08:00
creator1creeper1
81eb450369 FlappyBug: Make helper structs public
They will need to be referenced by main later on.
2021-12-23 17:42:05 -08:00
Lady Gegga
05d91b5843 Base: Add Elbasan characters to font Katica Regular 10
10500-10527 https://www.unicode.org/charts/PDF/U10500.pdf
2021-12-23 17:39:24 -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
a73c71e877 strace: Fix out-of-bounds read when formatting realpath()
The actual length of the resulting string is encoded in the return
value; treating the entire buffer as a string leads to reading
uninitialized memory.
2021-12-23 23:08:10 +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
Daniel Bertalan
77f9272aaf Kernel+UE: Add MAP_FIXED_NOREPLACE mmap() flag
This feature was introduced in version 4.17 of the Linux kernel, and
while it's not specified by POSIX, I think it will be a nice addition to
our system.

MAP_FIXED_NOREPLACE provides a less error-prone alternative to
MAP_FIXED: while regular fixed mappings would cause any intersecting
ranges to be unmapped, MAP_FIXED_NOREPLACE returns EEXIST instead. This
ensures that we don't corrupt our process's address space if something
is already at the requested address.

Note that the more portable way to do this is to use regular
MAP_ANONYMOUS, and check afterwards whether the returned address matches
what we wanted. This, however, has a large performance impact on
programs like Wine which try to reserve large portions of the address
space at once, as the non-matching addresses have to be unmapped
separately.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
4195a7ef4b Kernel: Return EEXIST in VirtualRangeAllocator::try_allocate_specific()
This error only ever gets propagated to the userspace if
MAP_FIXED_NOREPLACE is requested, as MAP_FIXED unmaps intersecting
ranges beforehand, and non-fixed mmap() calls will just fall back to
allocating anywhere.

Linux specifies MAP_FIXED_NOREPLACE to return EEXIST when it can't
allocate, we now match that behavior.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
143dbba562 UserspaceEmulator: Replace intersecting ranges if MAP_FIXED is specified
This commit changes UserspaceEmulator to match the behavior that the
kernel has since ce1bf37.
2021-12-23 23:08:10 +01:00
Liav A
9eb08bdb0f Kernel: Make major and minor numbers to be DistinctNumerics
This helps avoid confusion in general, and make constructors, methods
and code patterns much more clean and understandable.
2021-12-23 23:02:39 +01:00
Hendiadyoin1
6d14940053 Profiler: Use AK::any_of for process filtration
Equivalent to std::ranges::any_of as clang-tidy suggests.
2021-12-23 12:45:36 -08:00
Hendiadyoin1
071d72b494 Profiler: Always use FlyString const&'s in ProfileNode construction
No need to copy and move them around, just to pass them as a
`String const&` to the constructor.

We still end up copying it to a normal String in the end though...
2021-12-23 12:45:36 -08:00
Hendiadyoin1
e3469391d3 Profiler: Remove one else-after-return 2021-12-23 12:45:36 -08:00
Hendiadyoin1
e727605007 Profiler: Don't return constant copies of GUI::ModelIndex 2021-12-23 12:45:36 -08:00