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 {
43 
46 
49 
52 };
53 
56 {
59 
66 
70 
73 
79  Uint32 NumMipLevels;
80 
81  union
82  {
85 
88  };
89 
90  union
91  {
95 
99  };
100 
103  Uint32 AccessFlags;
104 
105 
107 
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 &&
146  NumMipLevels == RHS.NumMipLevels &&
151  AccessFlags == RHS.AccessFlags;
152  }
153 };
154 
156 
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 }
TEXTURE_FORMAT
Texture formats.
Definition: GraphicsTypes.h:244
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
TEXTURE_VIEW_TYPE
Texture view type.
Definition: GraphicsTypes.h:190
virtual void GenerateMips(IDeviceContext *pContext)=0
Generates a mipmap chain.
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Unknown format.
Definition: GraphicsTypes.h:247
Allow read operations on the UAV.
Definition: TextureView.h:45
Allow read and write operations on the UAV.
Definition: TextureView.h:51
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Uint32 FirstDepthSlice
For a 3D texture, first depth slice to address the view.
Definition: TextureView.h:87
UAV_ACCESS_FLAG
Describes allowed unordered access view mode.
Definition: TextureView.h:39
Undefined view type.
Definition: GraphicsTypes.h:193
Uint32 MostDetailedMip
Most detailed mip level to use.
Definition: TextureView.h:72
TextureViewDesc()
Initializes the structure members with default values.
Definition: TextureView.h:119
Device context interface.
Definition: DeviceContext.h:443
Access mode is unspecified.
Definition: TextureView.h:42
Texture view interface.
Definition: TextureView.h:163
Texture view description.
Definition: TextureView.h:55
TEXTURE_VIEW_TYPE ViewType
Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
Definition: TextureView.h:58
virtual const TextureViewDesc & GetDesc() const =0
Returns the texture view description used to create the object.
RESOURCE_DIMENSION
Describes resource dimension.
Definition: GraphicsTypes.h:172
virtual ISampler * GetSampler()=0
Returns the pointer to the sampler object set by the ITextureView::SetSampler().
Describes common device object attributes.
Definition: GraphicsTypes.h:900
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
bool operator==(const TextureViewDesc &RHS) const
Tests if two structures are equivalent.
Definition: TextureView.h:137
Texture sampler interface.
Definition: Sampler.h:180
virtual class ITexture * GetTexture()=0
Returns the pointer to the referenced texture object.
Texture type undefined.
Definition: GraphicsTypes.h:174
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
TEXTURE_FORMAT Format
View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided, the view format will match th...
Definition: TextureView.h:69
Allow write operations on the UAV.
Definition: TextureView.h:48
virtual void SetSampler(class ISampler *pSampler)=0
Sets the texture sampler to use for filtering operations when accessing a texture from shaders...
Uint32 AccessFlags
For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG for details...
Definition: TextureView.h:103
virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
Queries the specific interface, see IObject::QueryInterface() for details.
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
Texture inteface.
Definition: Texture.h:276
Uint32 FirstArraySlice
For a texture array, first array slice to address in the view.
Definition: TextureView.h:84