void RenderDeviceD3D11Impl :: CreateTexture(const TextureDesc& TexDesc, const TextureData &Data, ITexture **ppTexture) { CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { TextureBaseD3D11 *pTextureD3D11 = nullptr; switch( TexDesc.Type ) { case RESOURCE_DIM_TEX_1D: case RESOURCE_DIM_TEX_1D_ARRAY: pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture1D_D3D11 instance", Texture1D_D3D11) (m_TexViewObjAllocator, this, TexDesc, Data ); break; case RESOURCE_DIM_TEX_2D: case RESOURCE_DIM_TEX_2D_ARRAY: case RESOURCE_DIM_TEX_CUBE: case RESOURCE_DIM_TEX_CUBE_ARRAY: pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture2D_D3D11 instance", Texture2D_D3D11) (m_TexViewObjAllocator, this, TexDesc, Data ); break; case RESOURCE_DIM_TEX_3D: pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture3D_D3D11 instance", Texture3D_D3D11) (m_TexViewObjAllocator, this, TexDesc, Data ); break; default: LOG_ERROR_AND_THROW( "Unknown texture type. (Did you forget to initialize the Type member of TextureDesc structure?)" ); } pTextureD3D11->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D11->CreateDefaultViews(); OnCreateDeviceObject( pTextureD3D11 ); } ); }
void RenderDeviceD3D12Impl::CreateTexture(const TextureDesc& TexDesc, ID3D12Resource *pd3d12Texture, class TextureD3D12Impl **ppTexture) { CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { TextureD3D12Impl *pTextureD3D12 = NEW_RC_OBJ(m_TexObjAllocator, "TextureD3D12Impl instance", TextureD3D12Impl)(m_TexViewObjAllocator, this, TexDesc, pd3d12Texture ); pTextureD3D12->QueryInterface( IID_TextureD3D12, reinterpret_cast<IObject**>(ppTexture) ); } ); }
void RenderDeviceD3D12Impl::CreatePipelineState(const PipelineStateDesc &PipelineDesc, IPipelineState **ppPipelineState) { CreateDeviceObject("Pipeline State", PipelineDesc, ppPipelineState, [&]() { PipelineStateD3D12Impl *pPipelineStateD3D12( NEW_RC_OBJ(m_PSOAllocator, "PipelineStateD3D12Impl instance", PipelineStateD3D12Impl)(this, PipelineDesc ) ); pPipelineStateD3D12->QueryInterface( IID_PipelineState, reinterpret_cast<IObject**>(ppPipelineState) ); OnCreateDeviceObject( pPipelineStateD3D12 ); } ); }
void RenderDeviceD3D12Impl :: CreateShader(const ShaderCreationAttribs &ShaderCreationAttribs, IShader **ppShader) { CreateDeviceObject( "shader", ShaderCreationAttribs.Desc, ppShader, [&]() { ShaderD3D12Impl *pShaderD3D12( NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderD3D12Impl instance", ShaderD3D12Impl)(this, ShaderCreationAttribs ) ); pShaderD3D12->QueryInterface( IID_Shader, reinterpret_cast<IObject**>(ppShader) ); OnCreateDeviceObject( pShaderD3D12 ); } ); }
void RenderDeviceD3D12Impl :: CreateBuffer(const BufferDesc& BuffDesc, const BufferData &BuffData, IBuffer **ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, [&]() { BufferD3D12Impl *pBufferD3D12( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D12Impl instance", BufferD3D12Impl)(m_BuffViewObjAllocator, this, BuffDesc, BuffData ) ); pBufferD3D12->QueryInterface( IID_Buffer, reinterpret_cast<IObject**>(ppBuffer) ); pBufferD3D12->CreateDefaultViews(); OnCreateDeviceObject( pBufferD3D12 ); } ); }
void RenderDeviceD3D11Impl :: CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer **ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, [&]() { BufferD3D11Impl *pBufferD3D11( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl) (m_BuffViewObjAllocator, this, BuffDesc, pd3d11Buffer ) ); pBufferD3D11->QueryInterface( IID_Buffer, reinterpret_cast<IObject**>(ppBuffer) ); pBufferD3D11->CreateDefaultViews(); OnCreateDeviceObject( pBufferD3D11 ); } ); }
void RenderDeviceD3D12Impl :: CreateTexture(const TextureDesc& TexDesc, const TextureData &Data, ITexture **ppTexture) { CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { TextureD3D12Impl *pTextureD3D12 = NEW_RC_OBJ(m_TexObjAllocator, "TextureD3D12Impl instance", TextureD3D12Impl)(m_TexViewObjAllocator, this, TexDesc, Data ); pTextureD3D12->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D12->CreateDefaultViews(); OnCreateDeviceObject( pTextureD3D12 ); } ); }
void RenderDeviceD3D12Impl::CreateTextureFromD3DResource(ID3D12Resource *pd3d12Texture, ITexture **ppTexture) { TextureDesc TexDesc; TexDesc.Name = "Texture from d3d12 resource"; CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { TextureD3D12Impl *pTextureD3D12 = NEW_RC_OBJ(m_TexObjAllocator, "TextureD3D12Impl instance", TextureD3D12Impl)(m_TexViewObjAllocator, this, TexDesc, pd3d12Texture ); pTextureD3D12->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D12->CreateDefaultViews(); OnCreateDeviceObject( pTextureD3D12 ); } ); }
void RenderDeviceD3D12Impl :: CreateSampler(const SamplerDesc& SamplerDesc, ISampler **ppSampler) { CreateDeviceObject( "sampler", SamplerDesc, ppSampler, [&]() { m_SamplersRegistry.Find( SamplerDesc, reinterpret_cast<IDeviceObject**>(ppSampler) ); if( *ppSampler == nullptr ) { SamplerD3D12Impl *pSamplerD3D12( NEW_RC_OBJ(m_SamplerObjAllocator, "SamplerD3D12Impl instance", SamplerD3D12Impl)(this, SamplerDesc ) ); pSamplerD3D12->QueryInterface( IID_Sampler, reinterpret_cast<IObject**>(ppSampler) ); OnCreateDeviceObject( pSamplerD3D12 ); m_SamplersRegistry.Add( SamplerDesc, *ppSampler ); } } ); }
void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11Texture, ITexture **ppTexture) { if (pd3d11Texture == nullptr) return; TextureDesc TexDesc; TexDesc.Name = "Texture3D from native d3d11 texture"; CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { TextureBaseD3D11 *pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture3D_D3D11 instance", Texture3D_D3D11) (m_TexViewObjAllocator, this, pd3d11Texture); pTextureD3D11->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D11->CreateDefaultViews(); OnCreateDeviceObject( pTextureD3D11 ); } ); }