Loading...
Searching...
No Matches
texture.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HGI_GL_TEXTURE_H
8#define PXR_IMAGING_HGI_GL_TEXTURE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hgiGL/api.h"
12#include "pxr/imaging/hgiGL/hgi.h"
13#include "pxr/imaging/hgi/texture.h"
14
17
18
19PXR_NAMESPACE_OPEN_SCOPE
20
22class FramebufferCacheItem;
24
33class HgiGLTexture final : public HgiTexture, public TfWeakBase
34{
35public:
36 HGIGL_API
37 ~HgiGLTexture() override;
38
39 HGIGL_API
40 size_t GetByteSizeOfResource() const override;
41
42 HGIGL_API
43 uint64_t GetRawResource() const override;
44
46 uint32_t GetTextureId() const {return _textureId;}
47
49 HGIGL_API
51
55 HGIGL_API
56 HgiTextureUsage SubmitLayoutChange(HgiTextureUsage newLayout) override;
57
58 HGIGL_API
59 void AddFramebuffer(
60 std::weak_ptr<FramebufferCacheItem> cacheItem,
61 HgiGLContextArena* arena);
62
63protected:
64 friend class HgiGL;
65
66 HGIGL_API
67 HgiGLTexture(HgiTextureDesc const & desc);
68
69 HGIGL_API
70 HgiGLTexture(HgiTextureViewDesc const & desc);
71
72private:
73 HgiGLTexture() = delete;
74 HgiGLTexture & operator=(const HgiGLTexture&) = delete;
75 HgiGLTexture(const HgiGLTexture&) = delete;
76
77 uint32_t _textureId;
78 uint64_t _bindlessHandle;
79 std::vector<
80 std::pair<std::weak_ptr<FramebufferCacheItem>, HgiGLContextArena*>>
81 _framebuffers;
82};
83
84
85PXR_NAMESPACE_CLOSE_SCOPE
86
87#endif
Represents an arena for the HgiGL instance to manage container object resources that are tied to the ...
OpenGL implementation of the Hydra Graphics Interface.
Definition hgi.h:55
Represents a OpenGL GPU texture resource.
Definition texture.h:34
uint32_t GetTextureId() const
Returns the OpenGL id / name of the texture.
Definition texture.h:46
HGIGL_API size_t GetByteSizeOfResource() const override
Returns the byte size of the GPU texture.
HGIGL_API uint64_t GetBindlessHandle()
Returns the bindless gpu handle (caller must verify extension support)
HGIGL_API uint64_t GetRawResource() const override
This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
HGIGL_API HgiTextureUsage SubmitLayoutChange(HgiTextureUsage newLayout) override
This function does not do anything.
Represents a graphics platform independent GPU texture resource.
Definition texture.h:144
Enable a concrete base class for use with TfWeakPtr.
Definition weakBase.h:124
Standard pointer typedefs.
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition declarePtrs.h:45
Describes the properties needed to create a GPU texture.
Definition texture.h:91
Describes the properties needed to create a GPU texture view from an existing GPU texture object.
Definition texture.h:229