/* * Copyright (c) 2022, Stephan Unverwerth * Copyright (c) 2022, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace GPU { class Device { public: virtual ~Device() = default; virtual DeviceInfo info() const = 0; virtual void draw_primitives(PrimitiveType, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform, FloatMatrix4x4 const& texture_transform, Vector& vertices, Vector const& enabled_texture_units) = 0; virtual void resize(Gfx::IntSize const& min_size) = 0; virtual void clear_color(FloatVector4 const&) = 0; virtual void clear_depth(DepthType) = 0; virtual void clear_stencil(StencilType) = 0; virtual void blit_color_buffer_to(Gfx::Bitmap& target) = 0; virtual void blit_from_color_buffer(void*, Vector2 offset, GPU::ImageDataLayout const&) = 0; virtual void blit_from_depth_buffer(void*, Vector2 offset, GPU::ImageDataLayout const&) = 0; virtual void blit_to_color_buffer_at_raster_position(void const*, GPU::ImageDataLayout const&) = 0; virtual void blit_to_depth_buffer_at_raster_position(void const*, GPU::ImageDataLayout const&) = 0; virtual void set_options(RasterizerOptions const&) = 0; virtual void set_light_model_params(LightModelParameters const&) = 0; virtual RasterizerOptions options() const = 0; virtual LightModelParameters light_model() const = 0; virtual NonnullRefPtr create_image(PixelFormat const&, u32 width, u32 height, u32 depth, u32 levels, u32 layers) = 0; virtual void set_sampler_config(unsigned, SamplerConfig const&) = 0; virtual void set_light_state(unsigned, Light const&) = 0; virtual void set_material_state(Face, Material const&) = 0; virtual void set_stencil_configuration(Face, StencilConfiguration const&) = 0; virtual void set_clip_planes(Vector const&) = 0; virtual RasterPosition raster_position() const = 0; virtual void set_raster_position(RasterPosition const& raster_position) = 0; virtual void set_raster_position(FloatVector4 const& position, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform) = 0; }; } typedef GPU::Device* (*serenity_gpu_create_device_t)(Gfx::IntSize const& size); extern "C" GPU::Device* serenity_gpu_create_device(Gfx::IntSize const& size);