mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
LibGL+LibSoftGPU: Implement the stencil buffer
This implements an 8-bit front stencil buffer. Stencil operations are SIMD optimized. LibGL changes include: * New `glStencilMask` and `glStencilMaskSeparate` functions * New context parameter `GL_STENCIL_CLEAR_VALUE`
This commit is contained in:
parent
6386671944
commit
11c807ebd1
13 changed files with 430 additions and 77 deletions
33
Userland/Libraries/LibSoftGPU/StencilBuffer.h
Normal file
33
Userland/Libraries/LibSoftGPU/StencilBuffer.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jelle Raaijmakers <jelle@gmta.nl>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/FixedArray.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Size.h>
|
||||
|
||||
namespace SoftGPU {
|
||||
|
||||
class StencilBuffer final {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<StencilBuffer>> try_create(Gfx::IntSize const& size);
|
||||
|
||||
void clear(Gfx::IntRect rect, u8 value);
|
||||
Gfx::IntRect const& rect() const { return m_rect; }
|
||||
u8* scanline(int y);
|
||||
|
||||
private:
|
||||
StencilBuffer(Gfx::IntRect const& rect, FixedArray<u8> data);
|
||||
|
||||
FixedArray<u8> m_data;
|
||||
Gfx::IntRect m_rect;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue