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

Diligent Engine API Reference

TextureBase.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 "Texture.h"
30 #include "DeviceObjectBase.h"
31 #include "GraphicsAccessories.h"
32 #include "STDAllocator.h"
33 #include <memory>
34
35 namespace Diligent
36 {
37
38 void ValidateTextureDesc(const TextureDesc& TexDesc);
39 void ValidateUpdateDataParams( const TextureDesc &TexDesc, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData );
40 void VliadateCopyTextureDataParams( const TextureDesc &SrcTexDesc, Uint32 SrcMipLevel, Uint32 SrcSlice, const Box *pSrcBox,
41 const TextureDesc &DstTexDesc, Uint32 DstMipLevel, Uint32 DstSlice,
42 Uint32 DstX, Uint32 DstY, Uint32 DstZ );
43
45
51 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
52 class TextureBase : public DeviceObjectBase<BaseInterface, TextureDesc>
53 {
54 public:
55 typedef DeviceObjectBase<BaseInterface, TextureDesc> TDeviceObjectBase;
56
64 TextureBase( IReferenceCounters *pRefCounters,
65 TTexViewObjAllocator &TexViewObjAllocator,
66 IRenderDevice *pDevice,
67 const TextureDesc& Desc,
68 bool bIsDeviceInternal = false ) :
69 TDeviceObjectBase( pRefCounters, pDevice, Desc, bIsDeviceInternal ),
70 #ifdef _DEBUG
71 m_dbgTexViewObjAllocator(TexViewObjAllocator),
72 #endif
73 m_pDefaultSRV(nullptr, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>(TexViewObjAllocator)),
74 m_pDefaultRTV(nullptr, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>(TexViewObjAllocator)),
75 m_pDefaultDSV(nullptr, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>(TexViewObjAllocator)),
76 m_pDefaultUAV(nullptr, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>(TexViewObjAllocator))
77 {
78 if( this->m_Desc.MipLevels == 0 )
79 {
80 // Compute the number of levels in the full mipmap chain
81 if( this->m_Desc.Type == RESOURCE_DIM_TEX_1D ||
82 this->m_Desc.Type == RESOURCE_DIM_TEX_1D_ARRAY )
83 {
84 this->m_Desc.MipLevels = ComputeMipLevelsCount(this->m_Desc.Width);
85 }
86 else if( this->m_Desc.Type == RESOURCE_DIM_TEX_2D ||
87 this->m_Desc.Type == RESOURCE_DIM_TEX_2D_ARRAY ||
88 this->m_Desc.Type == RESOURCE_DIM_TEX_CUBE ||
89 this->m_Desc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY )
90 {
91 this->m_Desc.MipLevels = ComputeMipLevelsCount( this->m_Desc.Width, this->m_Desc.Height );
92 }
93 else if( this->m_Desc.Type == RESOURCE_DIM_TEX_3D )
94 {
95 this->m_Desc.MipLevels = ComputeMipLevelsCount( this->m_Desc.Width, this->m_Desc.Height, this->m_Desc.Depth );
96 }
97 else
98 {
99 UNEXPECTED( "Unkwnown texture type" );
100 }
101 }
102
103 // Validate correctness of texture description
104 ValidateTextureDesc( this->m_Desc );
105 }
106
107 IMPLEMENT_QUERY_INTERFACE_IN_PLACE( IID_Texture, TDeviceObjectBase )
108
109
110 virtual void CreateView( const struct TextureViewDesc &ViewDesc, ITextureView **ppView )override
112 {
113 CreateViewInternal( ViewDesc, ppView, false );
114 }
115
117 virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override = 0;
118
120 virtual void CopyData( IDeviceContext *pContext,
121 ITexture *pSrcTexture,
122 Uint32 SrcMipLevel,
123 Uint32 SrcSlice,
124 const Box *pSrcBox,
125 Uint32 DstMipLevel,
126 Uint32 DstSlice,
127 Uint32 DstX,
128 Uint32 DstY,
129 Uint32 DstZ )override = 0;
130
132 virtual void Map( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData )override = 0;
133
135 virtual void Unmap( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags )override = 0;
136
138
146 void CreateDefaultViews();
147
148 protected:
149
151 virtual void CreateViewInternal( const struct TextureViewDesc &ViewDesc, ITextureView **ppView, bool bIsDefaultView ) = 0;
152
153 #ifdef _DEBUG
154 TTexViewObjAllocator &m_dbgTexViewObjAllocator;
155 #endif
156 // WARNING! We cannot use ITextureView here, because ITextureView has no virtual dtor!
158 std::unique_ptr<TTextureViewImpl, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>> m_pDefaultSRV;
160 std::unique_ptr<TTextureViewImpl, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>> m_pDefaultRTV;
162 std::unique_ptr<TTextureViewImpl, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>> m_pDefaultDSV;
164 std::unique_ptr<TTextureViewImpl, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>> m_pDefaultUAV;
165
167 ITextureView* GetDefaultView( TEXTURE_VIEW_TYPE ViewType )override
168 {
169 switch( ViewType )
170 {
171 case TEXTURE_VIEW_SHADER_RESOURCE: return m_pDefaultSRV.get();
172 case TEXTURE_VIEW_RENDER_TARGET: return m_pDefaultRTV.get();
173 case TEXTURE_VIEW_DEPTH_STENCIL: return m_pDefaultDSV.get();
174 case TEXTURE_VIEW_UNORDERED_ACCESS: return m_pDefaultUAV.get();
175 default: UNEXPECTED( "Unknown view type" ); return nullptr;
176 }
177 }
178
179 void CorrectTextureViewDesc( struct TextureViewDesc &ViewDesc );
180 };
181
182
183 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
184 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: CorrectTextureViewDesc(struct TextureViewDesc &ViewDesc)
185 {
186 #define TEX_VIEW_VALIDATION_ERROR(...) LOG_ERROR_AND_THROW( "Texture view \"", ViewDesc.Name ? ViewDesc.Name : "", "\": ", ##__VA_ARGS__ )
187
188 if( !(ViewDesc.ViewType > TEXTURE_VIEW_UNDEFINED && ViewDesc.ViewType < TEXTURE_VIEW_NUM_VIEWS) )
189 TEX_VIEW_VALIDATION_ERROR( "Texture view type is not specified" );
190
191 if( ViewDesc.MostDetailedMip + ViewDesc.NumMipLevels > this->m_Desc.MipLevels )
192 TEX_VIEW_VALIDATION_ERROR( "Most detailed mip (", ViewDesc.MostDetailedMip, ") and number of mip levels in the view (", ViewDesc.NumMipLevels, ") specify more levels than target texture has (", this->m_Desc.MipLevels, ")" );
193
194 if( ViewDesc.Format == TEX_FORMAT_UNKNOWN )
195 ViewDesc.Format = GetDefaultTextureViewFormat( this->m_Desc.Format, ViewDesc.ViewType, this->m_Desc.BindFlags );
196
197 if( ViewDesc.TextureDim == RESOURCE_DIM_UNDEFINED )
198 {
199 if (this->m_Desc.Type == RESOURCE_DIM_TEX_CUBE || this->m_Desc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY)
200 {
201 switch (ViewDesc.ViewType)
202 {
203 case TEXTURE_VIEW_SHADER_RESOURCE:
204 ViewDesc.TextureDim = this->m_Desc.Type;
205 break;
206
207 case TEXTURE_VIEW_RENDER_TARGET:
208 case TEXTURE_VIEW_DEPTH_STENCIL:
209 case TEXTURE_VIEW_UNORDERED_ACCESS:
210 ViewDesc.TextureDim = RESOURCE_DIM_TEX_2D_ARRAY;
211 break;
212
213 default: UNEXPECTED("Unexpected view type");
214 }
215 }
216 else
217 {
218 ViewDesc.TextureDim = this->m_Desc.Type;
219 }
220 }
221
222 switch( this->m_Desc.Type )
223 {
224 case RESOURCE_DIM_TEX_1D:
225 if( ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D )
226 {
227 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 1D view: only Texture 1D is allowed" );
228 }
229 break;
230
231 case RESOURCE_DIM_TEX_1D_ARRAY:
232 if( ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D_ARRAY &&
233 ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D )
234 {
235 TEX_VIEW_VALIDATION_ERROR( "Incorrect view type for Texture 1D Array: only Texture 1D or Texture 1D Array are allowed" );
236 }
237 break;
238
239 case RESOURCE_DIM_TEX_2D:
240 if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D )
241 {
242 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 2D view: only Texture 2D is allowed" );
243 }
244 break;
245
246 case RESOURCE_DIM_TEX_2D_ARRAY:
247 if( ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY &&
248 ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D )
249 {
250 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 2D Array view: only Texture 2D or Texture 2D Array are allowed" );
251 }
252 break;
253
254 case RESOURCE_DIM_TEX_3D:
255 if( ViewDesc.TextureDim != RESOURCE_DIM_TEX_3D )
256 {
257 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture 3D view: only Texture 3D is allowed" );
258 }
259 break;
260
261 case RESOURCE_DIM_TEX_CUBE:
262 if(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE)
263 {
264 if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D &&
265 ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY &&
266 ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE)
267 {
268 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture cube SRV: Texture 2D, Texture 2D array or Texture Cube is allowed" );
269 }
270 }
271 else
272 {
273 if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D &&
274 ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY)
275 {
276 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture cube non-shader resource view: Texture 2D or Texture 2D array is allowed" );
277 }
278 }
279 break;
280
281 case RESOURCE_DIM_TEX_CUBE_ARRAY:
282 if(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE)
283 {
284 if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D &&
285 ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY &&
286 ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE &&
287 ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE_ARRAY)
288 {
289 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture cube array SRV: Texture 2D, Texture 2D array, Texture Cube or Texture Cube Array is allowed" );
290 }
291 }
292 else
293 {
294 if(ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D &&
295 ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY)
296 {
297 TEX_VIEW_VALIDATION_ERROR( "Incorrect texture type for Texture cube array non-shader resource view: Texture 2D or Texture 2D array is allowed" );
298 }
299 }
300 break;
301
302 default:
303 UNEXPECTED( "Unexpected texture type" );
304 break;
305 }
306
307 if ( ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE )
308 {
309 VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Unexpected view type: SRV is expected");
310 if(ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0)
311 TEX_VIEW_VALIDATION_ERROR( "Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided" );
312 if(ViewDesc.FirstArraySlice != 0)
313 TEX_VIEW_VALIDATION_ERROR( "First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture cube SRV" );
314 }
315 if ( ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY )
316 {
317 VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Unexpected view type: SRV is expected");
318 if((ViewDesc.NumArraySlices % 6) != 0)
319 TEX_VIEW_VALIDATION_ERROR( "Number of slices in texture cube array SRV is expected to be multiple of 6. ", ViewDesc.NumArraySlices, " slices provided." );
320 }
321
322 if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D ||
323 ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D)
324 {
325 if(ViewDesc.FirstArraySlice != 0)
326 TEX_VIEW_VALIDATION_ERROR( "First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture 1D/2D views" );
327
328 if(ViewDesc.NumArraySlices > 1)
329 TEX_VIEW_VALIDATION_ERROR( "Number of slices in the view (", ViewDesc.NumArraySlices, ") must be 1 (or 0) for non-array texture 1D/2D views" );
330 }
331 else if( ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
332 ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D_ARRAY ||
333 ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE ||
334 ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY )
335 {
336 if( ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > this->m_Desc.ArraySize )
337 TEX_VIEW_VALIDATION_ERROR( "First slice (", ViewDesc.FirstArraySlice, ") and number of slices in the view (", ViewDesc.NumArraySlices, ") specify more slices than target texture has (", this->m_Desc.ArraySize, ")" );
338 }
339 else if( ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D )
340 {
341 auto MipDepth = this->m_Desc.Depth >> ViewDesc.MostDetailedMip;
342 if( ViewDesc.FirstDepthSlice + ViewDesc.NumDepthSlices > MipDepth )
343 TEX_VIEW_VALIDATION_ERROR( "First slice (", ViewDesc.FirstDepthSlice, ") and number of slices in the view (", ViewDesc.NumDepthSlices, ") specify more slices than target 3D texture mip level has (", MipDepth, ")" );
344 }
345 else
346 {
347 UNEXPECTED("Unexpected texture dimension");
348 }
349
350 #undef TEX_VIEW_VALIDATION_ERROR
351
352 if( ViewDesc.NumMipLevels == 0 )
353 {
354 if( ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE )
355 ViewDesc.NumMipLevels = this->m_Desc.MipLevels - ViewDesc.MostDetailedMip;
356 else
357 ViewDesc.NumMipLevels = 1;
358 }
359
360 if( ViewDesc.NumArraySlices == 0 )
361 {
362 if( ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
363 ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D_ARRAY ||
364 ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE ||
365 ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY )
366 ViewDesc.NumArraySlices = this->m_Desc.ArraySize - ViewDesc.FirstArraySlice;
367 else if( ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D )
368 {
369 auto MipDepth = this->m_Desc.Depth >> ViewDesc.MostDetailedMip;
370 ViewDesc.NumDepthSlices = MipDepth - ViewDesc.FirstDepthSlice;
371 }
372 else
373 ViewDesc.NumArraySlices = 1;
374 }
375
376 if( (ViewDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET) &&
377 ( ViewDesc.Format == TEX_FORMAT_R8_SNORM || ViewDesc.Format == TEX_FORMAT_RG8_SNORM || ViewDesc.Format == TEX_FORMAT_RGBA8_SNORM ||
378 ViewDesc.Format == TEX_FORMAT_R16_SNORM || ViewDesc.Format == TEX_FORMAT_RG16_SNORM || ViewDesc.Format == TEX_FORMAT_RGBA16_SNORM ) )
379 {
380 const auto *FmtName = GetTextureFormatAttribs( ViewDesc.Format ).Name;
381 LOG_WARNING_MESSAGE( FmtName, " render target view is created.\n"
382 "There might be an issue in OpenGL driver on NVidia hardware: when rendering to SNORM textures, all negative values are clamped to zero.\n"
383 "Use UNORM format instead." );
384 }
385 }
386
387 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
388 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: CreateDefaultViews()
389 {
390 const auto& TexFmtAttribs = GetTextureFormatAttribs(this->m_Desc.Format);
391 if (TexFmtAttribs.ComponentType == COMPONENT_TYPE_UNDEFINED)
392 {
393 // Cannot create default view for TYPELESS formats
394 return;
395 }
396
397 if(this->m_Desc.BindFlags & BIND_SHADER_RESOURCE )
398 {
399 TextureViewDesc ViewDesc;
400 ViewDesc.ViewType = TEXTURE_VIEW_SHADER_RESOURCE;
401 ITextureView *pSRV = nullptr;
402 CreateViewInternal( ViewDesc, &pSRV, true );
403 m_pDefaultSRV.reset( static_cast<TTextureViewImpl*>(pSRV) );
404 VERIFY( m_pDefaultSRV->GetDesc().ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Unexpected view type" );
405 }
406
407 if(this->m_Desc.BindFlags & BIND_RENDER_TARGET )
408 {
409 TextureViewDesc ViewDesc;
410 ViewDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET;
411 ITextureView *pRTV = nullptr;
412 CreateViewInternal( ViewDesc, &pRTV, true );
413 m_pDefaultRTV.reset( static_cast<TTextureViewImpl*>(pRTV) );
414 VERIFY( m_pDefaultRTV->GetDesc().ViewType == TEXTURE_VIEW_RENDER_TARGET, "Unexpected view type" );
415 }
416
417 if(this->m_Desc.BindFlags & BIND_DEPTH_STENCIL )
418 {
419 TextureViewDesc ViewDesc;
420 ViewDesc.ViewType = TEXTURE_VIEW_DEPTH_STENCIL;
421 ITextureView *pDSV = nullptr;
422 CreateViewInternal( ViewDesc, &pDSV, true );
423 m_pDefaultDSV.reset( static_cast<TTextureViewImpl*>(pDSV) );
424 VERIFY( m_pDefaultDSV->GetDesc().ViewType == TEXTURE_VIEW_DEPTH_STENCIL, "Unexpected view type" );
425 }
426
427 if(this->m_Desc.BindFlags & BIND_UNORDERED_ACCESS )
428 {
429 TextureViewDesc ViewDesc;
430 ViewDesc.ViewType = TEXTURE_VIEW_UNORDERED_ACCESS;
431 ViewDesc.AccessFlags = UAV_ACCESS_FLAG_READ_WRITE;
432 ITextureView *pUAV = nullptr;
433 CreateViewInternal( ViewDesc, &pUAV, true );
434 m_pDefaultUAV.reset( static_cast<TTextureViewImpl*>(pUAV) );
435 VERIFY( m_pDefaultUAV->GetDesc().ViewType == TEXTURE_VIEW_UNORDERED_ACCESS, "Unexpected view type" );
436 }
437 }
438
439
440 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
441 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )
442 {
443 ValidateUpdateDataParams( this->m_Desc, MipLevel, Slice, DstBox, SubresData );
444 }
445
446 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
447 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: CopyData( IDeviceContext *pContext,
448 ITexture *pSrcTexture,
449 Uint32 SrcMipLevel,
450 Uint32 SrcSlice,
451 const Box *pSrcBox,
452 Uint32 DstMipLevel,
453 Uint32 DstSlice,
454 Uint32 DstX,
455 Uint32 DstY,
456 Uint32 DstZ )
457 {
458 VERIFY( pContext, "pContext is null" );
459 VERIFY( pSrcTexture, "pSrcTexture is null" );
460 VliadateCopyTextureDataParams( pSrcTexture->GetDesc(), SrcMipLevel, SrcSlice, pSrcBox,
461 this->GetDesc(), DstMipLevel, DstSlice, DstX, DstY, DstZ );
462 }
463
464 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
465 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: Map( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData )
466 {
467 }
468
469 template<class BaseInterface, class TTextureViewImpl, class TTexViewObjAllocator>
470 void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: Unmap( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags )
471 {
472 }
473
474 }
Diligent::RESOURCE_DIM_TEX_CUBE
Cube-map texture.
Definition: GraphicsTypes.h:181
Diligent::TextureBase::Unmap
virtual void Unmap(IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags) override=0
Base implementaiton of ITexture::Unmap()
Definition: TextureBase.h:470
Diligent::TextureDesc
Texture description.
Definition: Texture.h:82
Diligent::RESOURCE_DIM_TEX_2D
Two-dimensional texture.
Definition: GraphicsTypes.h:178
Diligent::BIND_RENDER_TARGET
A texture can be bound as a render target.
Definition: GraphicsTypes.h:71
Diligent::RESOURCE_DIM_TEX_1D
One-dimensional texture.
Definition: GraphicsTypes.h:176
Diligent::TEXTURE_VIEW_TYPE
TEXTURE_VIEW_TYPE
Texture view type.
Definition: GraphicsTypes.h:190
Diligent::IRenderDevice
Render device interface.
Definition: RenderDevice.h:55
Diligent::TEX_FORMAT_UNKNOWN
Unknown format.
Definition: GraphicsTypes.h:247
Diligent::TEX_FORMAT_RG16_SNORM
Two-component 32-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:409
Diligent::TextureBase::CreateDefaultViews
void CreateDefaultViews()
Creates default texture views.
Definition: TextureBase.h:388
Diligent::ITexture::GetDesc
virtual const TextureDesc & GetDesc() const =0
Returns the texture description used to create the object.
Diligent::TextureBase::GetDefaultView
ITextureView * GetDefaultView(TEXTURE_VIEW_TYPE ViewType) override
Implementation of ITexture::GetDefaultView().
Definition: TextureBase.h:167
Diligent::RESOURCE_DIM_TEX_CUBE_ARRAY
Cube-map array texture.
Definition: GraphicsTypes.h:182
Diligent::TEXTURE_VIEW_NUM_VIEWS
Helper value that stores that total number of texture views.
Definition: GraphicsTypes.h:212
Diligent::BIND_SHADER_RESOURCE
A buffer or a texture can be bound as a shader resource.
Definition: GraphicsTypes.h:68
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::TEXTURE_VIEW_UNDEFINED
Undefined view type.
Definition: GraphicsTypes.h:193
Diligent::TextureBase::UpdateData
virtual void UpdateData(IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData) override=0
Base implementaiton of ITexture::UpdateData(); validates input parameters.
Definition: TextureBase.h:441
Diligent::TextureSubResData
Describes data for one subresource.
Definition: Texture.h:193
Diligent::COMPONENT_TYPE_UNDEFINED
Undefined component type.
Definition: GraphicsTypes.h:1029
Diligent::TEX_FORMAT_RGBA8_SNORM
Four-component 32-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_F...
Definition: GraphicsTypes.h:381
Diligent::TextureDesc::MipLevels
Uint32 MipLevels
Number of Mip levels in the texture. Multisampled textures can only have 1 Mip level. Specify 0 to generate full mipmap chain.
Definition: Texture.h:106
Diligent::TextureDesc::Width
Uint32 Width
Texture width, in pixels.
Definition: Texture.h:88
Diligent::IDeviceContext
Device context interface.
Definition: DeviceContext.h:443
Diligent::BIND_DEPTH_STENCIL
A texture can be bound as a depth-stencil target.
Definition: GraphicsTypes.h:72
Diligent::Box
Box.
Definition: GraphicsTypes.h:1005
Diligent::TEXTURE_VIEW_DEPTH_STENCIL
A texture view will define a depth stencil view that will be used as the target for rendering operati...
Definition: GraphicsTypes.h:205
Diligent::ITextureView
Texture view interface.
Definition: TextureView.h:163
Diligent::TextureBase::CopyData
virtual void CopyData(IDeviceContext *pContext, ITexture *pSrcTexture, Uint32 SrcMipLevel, Uint32 SrcSlice, const Box *pSrcBox, Uint32 DstMipLevel, Uint32 DstSlice, Uint32 DstX, Uint32 DstY, Uint32 DstZ) override=0
Base implementaiton of ITexture::CopyData(); validates input parameters.
Definition: TextureBase.h:447
Diligent::TEX_FORMAT_RGBA16_SNORM
Four-component 64-bit signed-normalized-integer format with 16-bit channels. D3D counterpart: DXGI_...
Definition: GraphicsTypes.h:308
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::DeviceObjectBase< BaseInterface, TextureDesc >::m_Desc
TextureDesc m_Desc
Object description.
Definition: DeviceObjectBase.h:138
Diligent::RESOURCE_DIM_TEX_1D_ARRAY
One-dimensional texture array.
Definition: GraphicsTypes.h:177
Diligent::BIND_UNORDERED_ACCESS
A buffer or a texture can be bound as an unordered access view.
Definition: GraphicsTypes.h:73
Diligent::TEX_FORMAT_R8_SNORM
Single-component 8-bit signed-normalized-integer format. D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
Definition: GraphicsTypes.h:518
Diligent::TextureBase::Map
virtual void Map(IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData) override=0
Base implementaiton of ITexture::Map()
Definition: TextureBase.h:465
Diligent::TextureDesc::Type
RESOURCE_DIMENSION Type
Texture type. See Diligent::RESOURCE_DIMENSION for details.
Definition: Texture.h:85
Diligent::TEXTURE_VIEW_UNORDERED_ACCESS
A texture view will define an unordered access view that will be used for unordered read/write operat...
Definition: GraphicsTypes.h:209
Diligent::RESOURCE_DIM_TEX_3D
Three-dimensional texture.
Definition: GraphicsTypes.h:180
Diligent::TextureBase::m_pDefaultUAV
std::unique_ptr< TTextureViewImpl, STDDeleter< TTextureViewImpl, TTexViewObjAllocator > > m_pDefaultUAV
Default UAV addressing the entire texture.
Definition: TextureBase.h:164
Diligent::TextureBase::TextureBase
TextureBase(IReferenceCounters *pRefCounters, TTexViewObjAllocator &TexViewObjAllocator, IRenderDevice *pDevice, const TextureDesc &Desc, bool bIsDeviceInternal=false)
Definition: TextureBase.h:64
Diligent::TextureBase::m_pDefaultSRV
std::unique_ptr< TTextureViewImpl, STDDeleter< TTextureViewImpl, TTexViewObjAllocator > > m_pDefaultSRV
Default SRV addressing the entire texture.
Definition: TextureBase.h:158
Diligent::TextureBase::m_pDefaultRTV
std::unique_ptr< TTextureViewImpl, STDDeleter< TTextureViewImpl, TTexViewObjAllocator > > m_pDefaultRTV
Default RTV addressing the most detailed mip level.
Definition: TextureBase.h:160
Diligent::TEX_FORMAT_RG8_SNORM
Two-component 16-bit signed-normalized-integer format with 8-bit channels. D3D counterpart: DXGI_FO...
Definition: GraphicsTypes.h:466
Diligent::RESOURCE_DIM_UNDEFINED
Texture type undefined.
Definition: GraphicsTypes.h:174
Diligent::TEXTURE_VIEW_SHADER_RESOURCE
A texture view will define a shader resource view that will be used as the source for the shader read...
Definition: GraphicsTypes.h:197
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::DeviceObjectBase
Template class implementing base functionality for a device object.
Definition: DeviceObjectBase.h:42
Diligent::TextureBase::m_pDefaultDSV
std::unique_ptr< TTextureViewImpl, STDDeleter< TTextureViewImpl, TTexViewObjAllocator > > m_pDefaultDSV
Default DSV addressing the most detailed mip level.
Definition: TextureBase.h:162
Diligent::TextureBase
Base implementation of the ITexture interface.
Definition: TextureBase.h:52
Diligent::MAP_TYPE
MAP_TYPE
Resource mapping type.
Definition: GraphicsTypes.h:125
Diligent::TextureBase::CreateViewInternal
virtual void CreateViewInternal(const struct TextureViewDesc &ViewDesc, ITextureView **ppView, bool bIsDefaultView)=0
Pure virtual function that creates texture view for the specific engine implementation.
Diligent::TEX_FORMAT_R16_SNORM
Single-component 16-bit signed-normalized-integer format. D3D counterpart: DXGI_FORMAT_R16_SNORM. OpenGL counterpart: GL_R16_SNORM. OpenGLES: GL_EXT_texture_norm16 extension is required.
Definition: GraphicsTypes.h:498
Diligent::TEXTURE_VIEW_RENDER_TARGET
A texture view will define a render target view that will be used as the target for rendering operati...
Definition: GraphicsTypes.h:201
Diligent::RESOURCE_DIM_TEX_2D_ARRAY
Two-dimensional texture array.
Definition: GraphicsTypes.h:179
Diligent::ITexture
Texture inteface.
Definition: Texture.h:276
Diligent::TextureBase::CreateView
virtual void CreateView(const struct TextureViewDesc &ViewDesc, ITextureView **ppView) override
Implementaiton of ITexture::CreateView(); calls CreateViewInternal() virtual function that creates te...
Definition: TextureBase.h:111