Sampler.h 759 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefPtr.h>
  8. #include <AK/SIMD.h>
  9. #include <LibGPU/SamplerConfig.h>
  10. #include <LibGfx/Vector2.h>
  11. #include <LibGfx/Vector4.h>
  12. #include <LibSoftGPU/Image.h>
  13. namespace SoftGPU {
  14. class Sampler final {
  15. public:
  16. Vector4<AK::SIMD::f32x4> sample_2d(Vector2<AK::SIMD::f32x4> const& uv) const;
  17. void set_config(GPU::SamplerConfig const& config) { m_config = config; }
  18. GPU::SamplerConfig const& config() const { return m_config; }
  19. private:
  20. Vector4<AK::SIMD::f32x4> sample_2d_lod(Vector2<AK::SIMD::f32x4> const& uv, AK::SIMD::u32x4 level, GPU::TextureFilter) const;
  21. GPU::SamplerConfig m_config;
  22. };
  23. }