summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSoftGPU/Sampler.cpp
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-03-27 16:26:50 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-06 11:32:24 +0200
commit4a9987558281c4ac4b235f7965ff323e5dba5673 (patch)
tree4204c0964347e1340234ca0906a7b9e36b3c3df3 /Userland/Libraries/LibSoftGPU/Sampler.cpp
parent1f3642ed48b6be1e1e913e5a550f2e38f299f07f (diff)
downloadserenity-4a9987558281c4ac4b235f7965ff323e5dba5673.zip
LibGL+LibGPU+LibSoftGPU: Add virtual base class for Images
This introduces a new device independent base class for Images in LibGPU that also keeps track of the device from which it was created in order to prevent assigning images across devices.
Diffstat (limited to 'Userland/Libraries/LibSoftGPU/Sampler.cpp')
-rw-r--r--Userland/Libraries/LibSoftGPU/Sampler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Sampler.cpp b/Userland/Libraries/LibSoftGPU/Sampler.cpp
index fa37aa6836..082760a4b9 100644
--- a/Userland/Libraries/LibSoftGPU/Sampler.cpp
+++ b/Userland/Libraries/LibSoftGPU/Sampler.cpp
@@ -109,7 +109,7 @@ Vector4<AK::SIMD::f32x4> Sampler::sample_2d(Vector2<AK::SIMD::f32x4> const& uv)
if (m_config.bound_image.is_null())
return expand4(FloatVector4 { 1, 0, 0, 1 });
- auto const& image = *m_config.bound_image;
+ auto const& image = *static_ptr_cast<Image>(m_config.bound_image);
// FIXME: Make base level configurable with glTexParameteri(GL_TEXTURE_BASE_LEVEL, base_level)
constexpr unsigned base_level = 0;
@@ -152,7 +152,7 @@ Vector4<AK::SIMD::f32x4> Sampler::sample_2d(Vector2<AK::SIMD::f32x4> const& uv)
Vector4<AK::SIMD::f32x4> Sampler::sample_2d_lod(Vector2<AK::SIMD::f32x4> const& uv, AK::SIMD::u32x4 level, GPU::TextureFilter filter) const
{
- auto const& image = *m_config.bound_image;
+ auto const& image = *static_ptr_cast<Image>(m_config.bound_image);
u32x4 const layer = expand4(0u);
u32x4 const width = {