25 D3D11_BUFFER_DESC desc;
27 desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
28 desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
29 desc.StructureByteStride = 0;
33 desc.Usage = D3D11_USAGE_IMMUTABLE;
38 desc.Usage = D3D11_USAGE_DYNAMIC;
39 desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
43 desc.Usage = D3D11_USAGE_DEFAULT;
44 desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
49 ID3D11Buffer*
buffer =
nullptr;
53 D3D11_SUBRESOURCE_DATA
data;
54 data.pSysMem = rbuffer->
GetData();
56 data.SysMemSlicePitch = 0;
57 hr = device->CreateBuffer(&desc, &data, &buffer);
61 hr = device->CreateBuffer(&desc,
nullptr, &buffer);
68 if (usage == Resource::SHADER_OUTPUT)
84 return std::make_shared<DX11RawBuffer>(
85 reinterpret_cast<ID3D11Device*
>(device),
86 static_cast<RawBuffer const*>(
object));
107 D3D11_SHADER_RESOURCE_VIEW_DESC desc;
108 desc.Format = DXGI_FORMAT_R32_TYPELESS;
109 desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
110 desc.BufferEx.FirstElement = 0;
112 desc.BufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG_RAW;
113 HRESULT hr = device->CreateShaderResourceView(dxBuffer, &desc, &
mSRView);
122 D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
123 desc.Format = DXGI_FORMAT_R32_TYPELESS;
124 desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
125 desc.Buffer.FirstElement = 0;
127 desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
128 HRESULT hr = device->CreateUnorderedAccessView(dxBuffer, &desc, &
mUAView);
unsigned int GetNumElements() const
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
#define CHECK_HR_RETURN_NONE(msg)
ID3D11Buffer * GetDXBuffer() const
HRESULT SetPrivateName(ID3D11DeviceChild *object, std::string const &name)
void CreateSRView(ID3D11Device *device)
ID3D11UnorderedAccessView * mUAView
ID3D11ShaderResourceView * mSRView
GraphicsObjectType GetType() const
GLuint const GLchar * name
ULONG FinalRelease(T *&object)
void CreateUAView(ID3D11Device *device)
RawBuffer * GetRawBuffer() const
GLsizei const GLchar *const * string
#define LogError(message)
ID3D11DeviceChild * mDXObject
unsigned int GetNumBytes() const
void CreateStaging(ID3D11Device *device, D3D11_BUFFER_DESC const &bf)
char const * GetData() const
virtual void SetName(std::string const &name)
GLsizeiptr const void GLenum usage
#define D3D11_CPU_ACCESS_NONE
DX11RawBuffer(ID3D11Device *device, RawBuffer const *rbuffer)
CopyType GetCopyType() const
virtual void SetName(std::string const &name) override