23 D3D11_TEXTURE2D_DESC desc;
28 desc.Format =
static_cast<DXGI_FORMAT
>(texture->
GetFormat());
29 desc.SampleDesc.Count = 1;
30 desc.SampleDesc.Quality = 0;
31 desc.Usage = D3D11_USAGE_DEFAULT;
32 desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
34 desc.MiscFlags = (texture->
IsShared() ?
37 if (texture->
GetUsage() == Resource::SHADER_OUTPUT)
39 desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
44 desc.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
48 ID3D11Texture2D* dxTexture =
nullptr;
53 std::vector<D3D11_SUBRESOURCE_DATA>
data(numSubresources);
58 data[
index].SysMemPitch = sr.rowPitch;
59 data[
index].SysMemSlicePitch = 0;
61 hr = device->CreateTexture2D(&desc, &data[0], &dxTexture);
65 hr = device->CreateTexture2D(&desc,
nullptr, &dxTexture);
73 if (texture->
GetUsage() == Resource::SHADER_OUTPUT)
87 ID3D11DeviceContext* context;
88 device->GetImmediateContext(&context);
101 D3D11_TEXTURE2D_DESC desc;
102 dxShared->GetDesc(&desc);
110 return std::make_shared<DX11TextureRT>(
111 reinterpret_cast<ID3D11Device*
>(device),
112 static_cast<TextureRT const*>(
object));
128 D3D11_RENDER_TARGET_VIEW_DESC desc;
129 desc.Format = tx.Format;
130 desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
131 desc.Texture2D.MipSlice = 0;
virtual void SetName(std::string const &name) override
unsigned int GetWidth() const
void CreateRTView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
#define D3D11_RESOURCE_MISC_NONE
DX11TextureRT(ID3D11Device *device, TextureRT const *texture)
#define CHECK_HR_RETURN_NONE(msg)
void CreateSRView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
HRESULT SetPrivateName(ID3D11DeviceChild *object, std::string const &name)
Texture2 * GetTexture() const
GraphicsObjectType GetType() const
GLuint const GLchar * name
ULONG FinalRelease(T *&object)
ID3D11RenderTargetView * mRTView
void CreateUAView(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
ID3D11Texture2D * GetDXTexture() const
GLsizei const GLchar *const * string
virtual void SetName(std::string const &name)
#define LogError(message)
unsigned int GetHeight() const
ID3D11DeviceChild * mDXObject
char const * GetData() const
void CreateStaging(ID3D11Device *device, D3D11_TEXTURE2D_DESC const &tx)
unsigned int GetNumLevels() const
Subresource GetSubresource(unsigned int index) const
#define D3D11_CPU_ACCESS_NONE
#define CHECK_HR_RETURN_VOID(msg)
CopyType GetCopyType() const
ID3D11Texture2D * CreateSharedDXObject(ID3D11Device *device) const
bool WantAutogenerateMipmaps() const
ID3D11ShaderResourceView * mSRView
unsigned int GetNumSubresources() const