ladybird/Userland/Libraries/LibSoftGPU/StencilBuffer.h
Jelle Raaijmakers 11c807ebd1 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`
2022-01-17 12:49:00 +01:00

33 lines
679 B
C++

/*
* 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;
};
}