Diligent Engine API Reference
BufferView.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 // {E2E83490-E9D2-495B-9A83-ABB413A38B07}
35 static constexpr INTERFACE_ID IID_BufferView =
36 { 0xe2e83490, 0xe9d2, 0x495b, { 0x9a, 0x83, 0xab, 0xb4, 0x13, 0xa3, 0x8b, 0x7 } };
37 
40 {
43 
46  Uint32 ByteOffset;
47 
49  Uint32 ByteWidth;
50 
52 
61  ByteOffset(0),
62  ByteWidth(0)
63  {
64  }
65 
67 
74  bool operator == (const BufferViewDesc& RHS)const
75  {
76  // Name is primarily used for debug purposes and does not affect the view.
77  // It is ignored in comparison operation.
78  return //strcmp(Name, RHS.Name) == 0 &&
79  ViewType == RHS.ViewType &&
80  ByteOffset== RHS.ByteOffset &&
81  ByteWidth == RHS.ByteWidth;
82  }
83 };
84 
86 
91 class IBufferView : public IDeviceObject
92 {
93 public:
95  virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) = 0;
96 
98  virtual const BufferViewDesc& GetDesc()const = 0;
99 
101 
104  virtual IBuffer* GetBuffer() = 0;
105 };
106 
107 }
virtual IBuffer * GetBuffer()=0
Returns pointer to the referenced buffer object.
BUFFER_VIEW_TYPE ViewType
View type. See Diligent::BUFFER_VIEW_TYPE for details.
Definition: BufferView.h:42
virtual const BufferViewDesc & GetDesc() const =0
Returns the buffer view description used to create the object.
Buffer view description.
Definition: BufferView.h:39
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Undefined view type.
Definition: GraphicsTypes.h:222
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Uint32 ByteOffset
Offset in bytes from the beginnig of the buffer to the start of the buffer region referenced by the v...
Definition: BufferView.h:46
bool operator==(const BufferViewDesc &RHS) const
Comparison operator tests if two structures are equivalent.
Definition: BufferView.h:74
virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
Queries the specific interface, see IObject::QueryInterface() for details.
Buffer interface.
Definition: Buffer.h:200
Uint32 ByteWidth
Size in bytes of the referenced buffer region.
Definition: BufferView.h:49
Describes common device object attributes.
Definition: GraphicsTypes.h:900
BufferViewDesc()
Initializes the structure members with default values.
Definition: BufferView.h:59
Buffer view interface.
Definition: BufferView.h:91
BUFFER_VIEW_TYPE
Buffer view type.
Definition: GraphicsTypes.h:219