17 D3D11_TEXTURE2D_DESC desc;
18 desc.Width = textureArray->
GetWidth();
22 desc.Format =
static_cast<DXGI_FORMAT
>(textureArray->
GetFormat());
23 desc.SampleDesc.Count = 1;
24 desc.SampleDesc.Quality = 0;
25 desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
30 desc.Usage = D3D11_USAGE_IMMUTABLE;
35 desc.Usage = D3D11_USAGE_DYNAMIC;
36 desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
40 desc.Usage = D3D11_USAGE_DEFAULT;
41 desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
47 desc.Usage = D3D11_USAGE_DEFAULT;
48 desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
50 desc.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
54 ID3D11Texture2D* dxTexture =
nullptr;
59 std::vector<D3D11_SUBRESOURCE_DATA>
data(numSubresources);
64 data[
index].SysMemPitch = sr.rowPitch;
65 data[
index].SysMemSlicePitch = 0;
67 hr = device->CreateTexture2D(&desc, &data[0], &dxTexture);
71 hr = device->CreateTexture2D(&desc,
nullptr, &dxTexture);
78 if (textureArray->
GetUsage() == Resource::SHADER_OUTPUT)
92 ID3D11DeviceContext* context;
93 device->GetImmediateContext(&context);
103 return std::make_shared<DX11Texture2Array>(
104 reinterpret_cast<ID3D11Device*
>(device),
105 static_cast<Texture2Array const*>(
object));
114 D3D11_TEXTURE2D_DESC desc;
115 desc.Width = tx.Width;
116 desc.Height = tx.Height;
117 desc.MipLevels = tx.MipLevels;
118 desc.ArraySize = tx.ArraySize;
119 desc.Format = tx.Format;
120 desc.SampleDesc.Count = tx.SampleDesc.Count;
121 desc.SampleDesc.Quality = tx.SampleDesc.Quality;
122 desc.Usage = D3D11_USAGE_STAGING;
127 HRESULT hr = device->CreateTexture2D(&desc,
nullptr,
128 reinterpret_cast<ID3D11Texture2D**>(&
mStaging));
134 D3D11_SHADER_RESOURCE_VIEW_DESC desc;
135 desc.Format = tx.Format;
136 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
137 desc.Texture2DArray.MostDetailedMip = 0;
138 desc.Texture2DArray.MipLevels = tx.MipLevels;
139 desc.Texture2DArray.FirstArraySlice = 0;
140 desc.Texture2DArray.ArraySize = tx.ArraySize;
148 D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
149 desc.Format = tx.Format;
150 desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
151 desc.Texture2DArray.MipSlice = 0;
152 desc.Texture2DArray.FirstArraySlice = 0;
153 desc.Texture2DArray.ArraySize = tx.ArraySize;
#define D3D11_RESOURCE_MISC_NONE
#define CHECK_HR_RETURN_NONE(msg)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
GraphicsObjectType GetType() const
ID3D11UnorderedAccessView * mUAView
unsigned int GetWidth() const
ID3D11Resource * mStaging
#define LogError(message)
ID3D11DeviceChild * mDXObject
unsigned int GetHeight() const
char const * GetData() const
unsigned int GetNumItems() const
unsigned int GetNumLevels() const
void CreateStaging(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
GLsizeiptr const void GLenum usage
Subresource GetSubresource(unsigned int index) const
void CreateUAView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
#define D3D11_CPU_ACCESS_NONE
Texture2Array * GetTextureArray() const
static UINT const msStagingAccess[]
CopyType GetCopyType() const
void CreateSRView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
bool WantAutogenerateMipmaps() const
ID3D11ShaderResourceView * mSRView
ID3D11Texture2D * GetDXTextureArray() const
DX11Texture2Array(ID3D11Device *device, Texture2Array const *textureArray)
unsigned int GetNumSubresources() const