Sampler.h 706 B

1234567891011121314151617181920212223242526272829
  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/SIMD.h>
  8. #include <LibGPU/SamplerConfig.h>
  9. #include <LibGfx/Vector2.h>
  10. #include <LibGfx/Vector4.h>
  11. namespace SoftGPU {
  12. class Sampler final {
  13. public:
  14. Vector4<AK::SIMD::f32x4> sample_2d(Vector2<AK::SIMD::f32x4> const& uv) const;
  15. void set_config(GPU::SamplerConfig const& config) { m_config = config; }
  16. GPU::SamplerConfig const& config() const { return m_config; }
  17. private:
  18. Vector4<AK::SIMD::f32x4> sample_2d_lod(Vector2<AK::SIMD::f32x4> const& uv, AK::SIMD::u32x4 level, GPU::TextureFilter) const;
  19. GPU::SamplerConfig m_config;
  20. };
  21. }