17 D3D11_TEXTURE2D_DESC desc;
18 desc.Width = textureCubeArray->
GetLength();
19 desc.Height = textureCubeArray->
GetLength();
22 desc.Format =
static_cast<DXGI_FORMAT
>(textureCubeArray->
GetFormat());
23 desc.SampleDesc.Count = 1;
24 desc.SampleDesc.Quality = 0;
25 desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
26 desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
30 desc.Usage = D3D11_USAGE_IMMUTABLE;
36 desc.Usage = D3D11_USAGE_DEFAULT;
41 desc.Usage = D3D11_USAGE_DEFAULT;
42 desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
48 desc.Usage = D3D11_USAGE_DEFAULT;
49 desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
51 desc.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
55 ID3D11Texture2D* dxTexture =
nullptr;
57 if (textureCubeArray->
GetData())
60 std::vector<D3D11_SUBRESOURCE_DATA>
data(numSubresources);
65 data[
index].SysMemPitch = sr.rowPitch;
66 data[
index].SysMemSlicePitch = 0;
68 hr = device->CreateTexture2D(&desc, &data[0], &dxTexture);
72 hr = device->CreateTexture2D(&desc,
nullptr, &dxTexture);
79 if (textureCubeArray->
GetUsage() == Resource::SHADER_OUTPUT)
93 ID3D11DeviceContext* context;
94 device->GetImmediateContext(&context);
104 return std::make_shared<DX11TextureCubeArray>(
105 reinterpret_cast<ID3D11Device*
>(device),
106 static_cast<TextureCubeArray const*>(
object));
115 D3D11_TEXTURE2D_DESC desc;
116 desc.Width = tx.Width;
117 desc.Height = tx.Height;
118 desc.MipLevels = tx.MipLevels;
119 desc.ArraySize = tx.ArraySize;
120 desc.Format = tx.Format;
121 desc.SampleDesc.Count = tx.SampleDesc.Count;
122 desc.SampleDesc.Quality = tx.SampleDesc.Quality;
123 desc.Usage = D3D11_USAGE_STAGING;
128 HRESULT hr = device->CreateTexture2D(&desc,
nullptr,
129 reinterpret_cast<ID3D11Texture2D**>(&
mStaging));
135 D3D11_SHADER_RESOURCE_VIEW_DESC desc;
136 desc.Format = tx.Format;
137 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
138 desc.TextureCubeArray.MostDetailedMip = 0;
139 desc.TextureCubeArray.MipLevels = tx.MipLevels;
140 desc.TextureCubeArray.First2DArrayFace = 0;
141 desc.TextureCubeArray.NumCubes = tx.ArraySize / 6;
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;
ID3D11Texture2D * GetDXTextureArray() const
#define D3D11_RESOURCE_MISC_NONE
void CreateUAView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
#define CHECK_HR_RETURN_NONE(msg)
GraphicsObjectType GetType() const
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
ID3D11UnorderedAccessView * mUAView
ID3D11Resource * mStaging
#define LogError(message)
ID3D11DeviceChild * mDXObject
char const * GetData() const
unsigned int GetLength() const
unsigned int GetNumItems() const
unsigned int GetNumLevels() const
GLsizeiptr const void GLenum usage
Subresource GetSubresource(unsigned int index) const
#define D3D11_CPU_ACCESS_NONE
void CreateStaging(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
static UINT const msStagingAccess[]
CopyType GetCopyType() const
TextureCubeArray * GetTextureArray() const
void CreateSRView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
bool WantAutogenerateMipmaps() const
ID3D11ShaderResourceView * mSRView
DX11TextureCubeArray(ID3D11Device *device, TextureCubeArray const *textureCubeArray)
unsigned int GetNumSubresources() const