17 D3D11_TEXTURE2D_DESC desc;
22 desc.Format =
static_cast<DXGI_FORMAT
>(textureCube->
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;
59 unsigned int const numSubresources =
61 std::vector<D3D11_SUBRESOURCE_DATA>
data(numSubresources);
66 data[
index].SysMemPitch = sr.rowPitch;
67 data[
index].SysMemSlicePitch = 0;
69 hr = device->CreateTexture2D(&desc, &data[0], &dxTexture);
73 hr = device->CreateTexture2D(&desc,
nullptr, &dxTexture);
80 if (textureCube->
GetUsage() == Resource::SHADER_OUTPUT)
94 ID3D11DeviceContext* context;
95 device->GetImmediateContext(&context);
105 return std::make_shared<DX11TextureCube>(
106 reinterpret_cast<ID3D11Device*
>(device),
107 static_cast<TextureCube const*>(
object));
116 D3D11_TEXTURE2D_DESC desc;
117 desc.Width = tx.Width;
118 desc.Height = tx.Height;
119 desc.MipLevels = tx.MipLevels;
120 desc.ArraySize = tx.ArraySize;
121 desc.Format = tx.Format;
122 desc.SampleDesc.Count = tx.SampleDesc.Count;
123 desc.SampleDesc.Quality = tx.SampleDesc.Quality;
124 desc.Usage = D3D11_USAGE_STAGING;
129 HRESULT hr = device->CreateTexture2D(&desc,
nullptr,
130 reinterpret_cast<ID3D11Texture2D**>(&
mStaging));
136 D3D11_SHADER_RESOURCE_VIEW_DESC desc;
137 desc.Format = tx.Format;
138 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
139 desc.TextureCube.MostDetailedMip = 0;
140 desc.TextureCube.MipLevels = tx.MipLevels;
147 D3D11_UNORDERED_ACCESS_VIEW_DESC desc;
148 desc.Format = tx.Format;
149 desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
150 desc.Texture2DArray.MipSlice = 0;
151 desc.Texture2DArray.FirstArraySlice = 0;
152 desc.Texture2DArray.ArraySize = tx.ArraySize;
void CreateStaging(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
#define D3D11_RESOURCE_MISC_NONE
void CreateUAView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
DX11TextureCube(ID3D11Device *device, TextureCube const *textureCube)
#define CHECK_HR_RETURN_NONE(msg)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
GraphicsObjectType GetType() const
unsigned int GetLength() const
ID3D11UnorderedAccessView * mUAView
ID3D11Resource * mStaging
#define LogError(message)
ID3D11DeviceChild * mDXObject
char const * GetData() const
void CreateSRView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
unsigned int GetNumItems() const
unsigned int GetNumLevels() const
GLsizeiptr const void GLenum usage
Subresource GetSubresource(unsigned int index) const
#define D3D11_CPU_ACCESS_NONE
#define CHECK_HR_RETURN_VOID(msg)
static UINT const msStagingAccess[]
CopyType GetCopyType() const
TextureCube * GetTexture() const
ID3D11Texture2D * GetDXTexture() const
bool WantAutogenerateMipmaps() const
ID3D11ShaderResourceView * mSRView
unsigned int GetNumSubresources() const