Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngine/interface/TextureView.h Source File

Diligent Engine API Reference

TextureView.h
1 /* Copyright 2015-2018 Egor Yusov
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12 *
13 * In no event and under no legal theory, whether in tort (including negligence),
14 * contract, or otherwise, unless required by applicable law (such as deliberate
15 * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16 * liable for any damages, including any direct, indirect, special, incidental,
17 * or consequential damages of any character arising as a result of this License or
18 * out of the use or inability to use the software (including but not limited to damages
19 * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20 * all other commercial damages or losses), even if such Contributor has been advised
21 * of the possibility of such damages.
22 */
23
24 #pragma once
25
28
29 #include "DeviceObject.h"
30
31 namespace Diligent
32 {
33
34 // {5B2EA04E-8128-45E4-AA4D-6DC7E70DC424}
35 static constexpr INTERFACE_ID IID_TextureView =
36 { 0x5b2ea04e, 0x8128, 0x45e4, { 0xaa, 0x4d, 0x6d, 0xc7, 0xe7, 0xd, 0xc4, 0x24 } };
37
39 enum UAV_ACCESS_FLAG : Int32
40 {
42 UAV_ACCESS_UNSPECIFIED = 0x00,
43
45 UAV_ACCESS_FLAG_READ = 0x01,
46
48 UAV_ACCESS_FLAG_WRITE = 0x02,
49
51 UAV_ACCESS_FLAG_READ_WRITE = UAV_ACCESS_FLAG_READ | UAV_ACCESS_FLAG_WRITE
52 };
53
55 struct TextureViewDesc : DeviceObjectAttribs
56 {
58 TEXTURE_VIEW_TYPE ViewType;
59
65 RESOURCE_DIMENSION TextureDim;
66
69 TEXTURE_FORMAT Format;
70
72 Uint32 MostDetailedMip;
73
79 Uint32 NumMipLevels;
80
81 union
82 {
84 Uint32 FirstArraySlice;
85
87 Uint32 FirstDepthSlice;
88 };
89
90 union
91 {
94 Uint32 NumArraySlices;
95
98 Uint32 NumDepthSlices;
99 };
100
103 Uint32 AccessFlags;
104
105
107
119 TextureViewDesc() :
120 ViewType( TEXTURE_VIEW_UNDEFINED ),
121 TextureDim( RESOURCE_DIM_UNDEFINED ),
122 Format(TEX_FORMAT_UNKNOWN),
123 MostDetailedMip(0),
124 NumMipLevels(0),
125 FirstArraySlice(0),
126 NumArraySlices(0),
127 AccessFlags(0)
128 {
129 }
130
132
137 bool operator == (const TextureViewDesc& RHS)const
138 {
139 // Name is primarily used for debug purposes and does not affect the view.
140 // It is ignored in comparison operation.
141 return //strcmp(Name, RHS.Name) == 0 &&
142 ViewType == RHS.ViewType &&
143 TextureDim == RHS.TextureDim &&
144 Format == RHS.Format &&
145 MostDetailedMip == RHS.MostDetailedMip &&
146 NumMipLevels == RHS.NumMipLevels &&
147 FirstArraySlice == RHS.FirstArraySlice &&
148 FirstDepthSlice == RHS.FirstDepthSlice &&
149 NumArraySlices == RHS.NumArraySlices &&
150 NumDepthSlices == RHS.NumDepthSlices &&
151 AccessFlags == RHS.AccessFlags;
152 }
153 };
154
156
163 class ITextureView : public IDeviceObject
164 {
165 public:
167 virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) = 0;
168
170 virtual const TextureViewDesc& GetDesc()const = 0;
171
176 virtual void SetSampler( class ISampler *pSampler ) = 0;
177
179
182 virtual ISampler* GetSampler() = 0;
183
184
186
189 virtual class ITexture* GetTexture() = 0;
190
192
195 virtual void GenerateMips(IDeviceContext *pContext ) = 0;
196 };
197
198 }
Diligent::TEXTURE_FORMAT
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
Diligent::TextureViewDesc::TextureDim
RESOURCE_DIMENSION TextureDim
View interpretation of the original texture. For instance, one slice of a 2D texture array can be vie...
Definition: TextureView.h:65
Diligent::TEXTURE_VIEW_TYPE
TEXTURE_VIEW_TYPE
Texture view type.
Definition: GraphicsTypes.h:190
Diligent::ITextureView::GenerateMips
virtual void GenerateMips(IDeviceContext *pContext)=0
Generates a mipmap chain.
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Diligent::TEX_FORMAT_UNKNOWN
Unknown format.
Definition: GraphicsTypes.h:247
Diligent::UAV_ACCESS_FLAG_READ
Allow read operations on the UAV.
Definition: TextureView.h:45
Diligent::UAV_ACCESS_FLAG_READ_WRITE
Allow read and write operations on the UAV.
Definition: TextureView.h:51
Diligent
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Diligent::TextureViewDesc::FirstDepthSlice
Uint32 FirstDepthSlice
For a 3D texture, first depth slice to address the view.
Definition: TextureView.h:87
Diligent::UAV_ACCESS_FLAG
UAV_ACCESS_FLAG
Describes allowed unordered access view mode.
Definition: TextureView.h:39
Diligent::TEXTURE_VIEW_UNDEFINED
Undefined view type.
Definition: GraphicsTypes.h:193
Diligent::TextureViewDesc::MostDetailedMip
Uint32 MostDetailedMip
Most detailed mip level to use.
Definition: TextureView.h:72
Diligent::TextureViewDesc::TextureViewDesc
TextureViewDesc()
Initializes the structure members with default values.
Definition: TextureView.h:119
Diligent::IDeviceContext
Device context interface.
Definition: DeviceContext.h:443
Diligent::UAV_ACCESS_UNSPECIFIED
Access mode is unspecified.
Definition: TextureView.h:42
Diligent::ITextureView
Texture view interface.
Definition: TextureView.h:163
Diligent::TextureViewDesc
Texture view description.
Definition: TextureView.h:55
Diligent::TextureViewDesc::ViewType
TEXTURE_VIEW_TYPE ViewType
Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
Definition: TextureView.h:58
Diligent::ITextureView::GetDesc
virtual const TextureViewDesc & GetDesc() const =0
Returns the texture view description used to create the object.
Diligent::RESOURCE_DIMENSION
RESOURCE_DIMENSION
Describes resource dimension.
Definition: GraphicsTypes.h:172
Diligent::ITextureView::GetSampler
virtual ISampler * GetSampler()=0
Returns the pointer to the sampler object set by the ITextureView::SetSampler().
Diligent::DeviceObjectAttribs
Describes common device object attributes.
Definition: GraphicsTypes.h:900
Diligent::TextureViewDesc::NumMipLevels
Uint32 NumMipLevels
Total number of mip levels for the view of the texture. Render target and depth stencil views can add...
Definition: TextureView.h:79
Diligent::TextureViewDesc::operator==
bool operator==(const TextureViewDesc &RHS) const
Tests if two structures are equivalent.
Definition: TextureView.h:137
Diligent::ISampler
Texture sampler interface.
Definition: Sampler.h:180
Diligent::ITextureView::GetTexture
virtual class ITexture * GetTexture()=0
Returns the pointer to the referenced texture object.
Diligent::RESOURCE_DIM_UNDEFINED
Texture type undefined.
Definition: GraphicsTypes.h:174
Diligent::TextureViewDesc::NumArraySlices
Uint32 NumArraySlices
For a texture array, number of array slices to address in the view. Set to 0 to address all array sli...
Definition: TextureView.h:94
Diligent::TextureViewDesc::Format
TEXTURE_FORMAT Format
View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided, the view format will match th...
Definition: TextureView.h:69
Diligent::UAV_ACCESS_FLAG_WRITE
Allow write operations on the UAV.
Definition: TextureView.h:48
Diligent::ITextureView::SetSampler
virtual void SetSampler(class ISampler *pSampler)=0
Sets the texture sampler to use for filtering operations when accessing a texture from shaders...
Diligent::TextureViewDesc::AccessFlags
Uint32 AccessFlags
For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG for details...
Definition: TextureView.h:103
Diligent::ITextureView::QueryInterface
virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
Queries the specific interface, see IObject::QueryInterface() for details.
Diligent::TextureViewDesc::NumDepthSlices
Uint32 NumDepthSlices
For a 3D texture, number of depth slices to address in the view Set to 0 to address all depth slices...
Definition: TextureView.h:98
Diligent::ITexture
Texture inteface.
Definition: Texture.h:276
Diligent::TextureViewDesc::FirstArraySlice
Uint32 FirstArraySlice
For a texture array, first array slice to address in the view.
Definition: TextureView.h:84