2 * Copyright (c) 2007-2010 SlimDX Group
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 /// Describes a buffer resource.
33 /// <unmanaged>D3D11_BUFFER_DESC</unmanaged>
34 public value class BufferDescription : System::IEquatable<BufferDescription>
38 ResourceUsage m_Usage;
39 BindFlags m_BindFlags;
40 CpuAccessFlags m_CPUAccessFlags;
41 ResourceOptionFlags m_MiscFlags;
42 int m_StructureByteStride;
45 BufferDescription( const D3D11_BUFFER_DESC& native );
49 /// Gets or sets the size, in bytes, of the buffer.
51 property int SizeInBytes
54 void set( int value );
58 /// Gets or sets the intended usage pattern of the buffer.
60 property ResourceUsage Usage
63 void set( ResourceUsage value );
67 /// Gets or sets the flags specifying how the buffer is bound to the pipeline.
69 property Direct3D11::BindFlags BindFlags
71 Direct3D11::BindFlags get();
72 void set( Direct3D11::BindFlags value );
76 /// Gets or sets the flags specifying how the CPU will be allowed to access the buffer.
78 property Direct3D11::CpuAccessFlags CpuAccessFlags
80 Direct3D11::CpuAccessFlags get();
81 void set( Direct3D11::CpuAccessFlags value );
85 /// Gets or sets the flags specifying miscellaneous resource options.
87 property ResourceOptionFlags OptionFlags
89 ResourceOptionFlags get();
90 void set( ResourceOptionFlags value );
94 /// Gets or sets the size (in bytes) of the structure used for elements of a structured buffer.
96 property int StructureByteStride
99 void set( int value );
103 /// Initializes a new instance of the <see cref="BufferDescription"/> struct.
105 /// <param name="sizeInBytes">The size, in bytes, of the buffer.</param>
106 /// <param name="usage">The usage pattern for the buffer.</param>
107 /// <param name="bindFlags">Flags specifying how the buffer will be bound to the pipeline.</param>
108 /// <param name="accessFlags">Flags specifying how the buffer will be accessible from the CPU.</param>
109 /// <param name="optionFlags">Miscellaneous resource options.</param>
110 /// <param name="structureByteStride">The size (in bytes) of the structure for a structured buffer.</param>
111 BufferDescription( int sizeInBytes, ResourceUsage usage, Direct3D11::BindFlags bindFlags, Direct3D11::CpuAccessFlags accessFlags, ResourceOptionFlags optionFlags, int structureByteStride );
114 /// Tests for equality between two BufferDescriptions.
116 /// <param name="left">The first value to compare.</param>
117 /// <param name="right">The second value to compare.</param>
118 /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
119 static bool operator == ( BufferDescription left, BufferDescription right );
122 /// Tests for inequality between two BufferDescriptions.
124 /// <param name="left">The first value to compare.</param>
125 /// <param name="right">The second value to compare.</param>
126 /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
127 static bool operator != ( BufferDescription left, BufferDescription right );
130 /// Returns the hash code for this instance.
132 /// <returns>A 32-bit signed integer hash code.</returns>
133 virtual int GetHashCode() override;
136 /// Returns a value indicating whether this instance is equal to the specified object.
138 /// <param name="obj">An object to compare with this instance.</param>
139 /// <returns><c>true</c> if <paramref name="obj"/> has the same value as this instance; otherwise, <c>false</c>.</returns>
140 virtual bool Equals( System::Object^ obj ) override;
143 /// Returns a value indicating whether this instance is equal to the specified object.
145 /// <param name="other">A <see cref="BufferDescription"/> to compare with this instance.</param>
146 /// <returns><c>true</c> if <paramref name="other"/> has the same value as this instance; otherwise, <c>false</c>.</returns>
147 virtual bool Equals( BufferDescription other );
150 /// Returns a value indicating whether the two BufferDescriptions are equivalent.
152 /// <param name="value1">The first value to compare.</param>
153 /// <param name="value2">The second value to compare.</param>
154 /// <returns><c>true</c> if <paramref name="value1"/> has the same value as <paramref name="value2"/>; otherwise, <c>false</c>.</returns>
155 static bool Equals( BufferDescription% value1, BufferDescription% value2 );