TextureBase: Make the constructor/destructor protected.

Bug: dawn:1451
Change-Id: Iff38001768c6e135512ab310f6fa935fccdf9d1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92660
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2022-06-06 14:53:13 +00:00 committed by Dawn LUCI CQ
parent 25c8d51657
commit 4ef134c19d
3 changed files with 12 additions and 4 deletions

View File

@ -47,9 +47,6 @@ class TextureBase : public ApiObjectBase {
enum class TextureState { OwnedInternal, OwnedExternal, Destroyed };
enum class ClearValue { Zero, NonZero };
TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
~TextureBase() override;
static TextureBase* MakeError(DeviceBase* device);
ObjectType GetType() const override;
@ -101,8 +98,11 @@ class TextureBase : public ApiObjectBase {
void APIDestroy();
protected:
TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
// Constructor used only for mocking and testing.
TextureBase(DeviceBase* device, TextureState state);
~TextureBase() override;
void DestroyImpl() override;
private:

View File

@ -506,4 +506,7 @@ float Device::GetTimestampPeriodInNS() const {
return 1.0f;
}
Texture::Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state)
: TextureBase(device, descriptor, state) {}
} // namespace dawn::native::null

View File

@ -55,7 +55,7 @@ class RenderPipeline;
using Sampler = SamplerBase;
class ShaderModule;
class SwapChain;
using Texture = TextureBase;
class Texture;
using TextureView = TextureViewBase;
struct NullBackendTraits {
@ -335,6 +335,11 @@ class StagingBuffer : public StagingBufferBase {
std::unique_ptr<uint8_t[]> mBuffer;
};
class Texture : public TextureBase {
public:
Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
};
} // namespace dawn::native::null
#endif // SRC_DAWN_NATIVE_NULL_DEVICENULL_H_