2021-12-19 00:02:32 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-01-06 17:06:46 +01:00
|
|
|
#include <AK/SIMD.h>
|
2022-03-27 14:55:31 +02:00
|
|
|
#include <LibGPU/SamplerConfig.h>
|
2021-12-19 00:02:32 +01:00
|
|
|
#include <LibGfx/Vector2.h>
|
|
|
|
|
#include <LibGfx/Vector4.h>
|
|
|
|
|
|
|
|
|
|
namespace SoftGPU {
|
|
|
|
|
|
|
|
|
|
class Sampler final {
|
|
|
|
|
public:
|
2022-01-06 17:06:46 +01:00
|
|
|
Vector4<AK::SIMD::f32x4> sample_2d(Vector2<AK::SIMD::f32x4> const& uv) const;
|
2021-12-19 00:02:32 +01:00
|
|
|
|
2022-03-27 14:55:31 +02:00
|
|
|
void set_config(GPU::SamplerConfig const& config) { m_config = config; }
|
|
|
|
|
GPU::SamplerConfig const& config() const { return m_config; }
|
2021-12-19 00:02:32 +01:00
|
|
|
|
|
|
|
|
private:
|
2022-03-27 14:55:31 +02:00
|
|
|
Vector4<AK::SIMD::f32x4> sample_2d_lod(Vector2<AK::SIMD::f32x4> const& uv, AK::SIMD::u32x4 level, GPU::TextureFilter) const;
|
2022-02-19 02:16:44 +01:00
|
|
|
|
2022-03-27 14:55:31 +02:00
|
|
|
GPU::SamplerConfig m_config;
|
2021-12-19 00:02:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|