mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
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.
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/RefCounted.h>
|
|
#include <LibGPU/ImageDataLayout.h>
|
|
#include <LibGfx/Vector3.h>
|
|
|
|
namespace GPU {
|
|
|
|
class Image : public RefCounted<Image> {
|
|
public:
|
|
Image(void const* ownership_token)
|
|
: m_ownership_token { ownership_token }
|
|
{
|
|
}
|
|
|
|
virtual ~Image() { }
|
|
|
|
virtual void write_texels(unsigned layer, unsigned level, Vector3<unsigned> const& offset, Vector3<unsigned> const& size, void const* data, ImageDataLayout const& layout) = 0;
|
|
virtual void read_texels(unsigned layer, unsigned level, Vector3<unsigned> const& offset, Vector3<unsigned> const& size, void* data, ImageDataLayout const& layout) const = 0;
|
|
virtual void copy_texels(Image const& source, unsigned source_layer, unsigned source_level, Vector3<unsigned> const& source_offset, Vector3<unsigned> const& size, unsigned destination_layer, unsigned destination_level, Vector3<unsigned> const& destination_offset) = 0;
|
|
|
|
void const* ownership_token() const { return m_ownership_token; }
|
|
bool has_same_ownership_token(Image const& other) const { return other.ownership_token() == ownership_token(); }
|
|
|
|
private:
|
|
void const* const m_ownership_token { nullptr };
|
|
};
|
|
|
|
}
|