summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-25 02:56:05 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-25 02:56:05 +0000
commit1133211961e878a9b39176c5fb1b9f72feb9ec71 (patch)
treec3b185d2e189654b4993697850959fe392b7b514 /Graphics/GraphicsEngineOpenGL
parentMinor formatting updates (diff)
downloadDiligentCore-1133211961e878a9b39176c5fb1b9f72feb9ec71.tar.gz
DiligentCore-1133211961e878a9b39176c5fb1b9f72feb9ec71.zip
Added IRenderDeviceGL::CreateDummyTexture method (API version 240047)
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h5
-rw-r--r--Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h18
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp4
4 files changed, 24 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
index 1f2bf173..5045ae75 100644
--- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
+++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
@@ -92,6 +92,9 @@ public:
/// Implementation of IRenderDeviceGL::CreateBufferFromGLHandle().
virtual void CreateBufferFromGLHandle(Uint32 GLHandle, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer) override final;
+ /// Implementation of IRenderDeviceGL::CreateDummyTexture().
+ virtual void CreateDummyTexture(const TextureDesc& TexDesc, RESOURCE_STATE InitialState, ITexture** ppTexture) override final;
+
/// Implementation of IRenderDevice::ReleaseStaleResources() in OpenGL backend.
virtual void ReleaseStaleResources(bool ForceRelease = false) override final {}
@@ -107,8 +110,6 @@ public:
void OnDestroyPSO(IPipelineState* pPSO);
void OnDestroyBuffer(IBuffer* pBuffer);
- void CreateDummyTexture(const TextureDesc& TexDesc, RESOURCE_STATE InitialState, class TextureBaseGL** ppTexture);
-
size_t GetCommandQueueCount() const { return 1; }
Uint64 GetCommandQueueMask() const { return Uint64{1}; }
diff --git a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h
index 85a815d0..7b560f87 100644
--- a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h
+++ b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h
@@ -75,6 +75,24 @@ public:
const BufferDesc& BuffDesc,
RESOURCE_STATE InitialState,
IBuffer** ppBuffer) = 0;
+
+
+ /// Creates a dummy texture with null handle.
+
+ /// The main usage of dummy textures is to serve as render target and depth buffer
+ /// proxies in a swap chain. When dummy color buffer is set as render target, the
+ /// engine binds default FBO provided by the swap chain.
+ ///
+ /// \param [in] TexDesc - Texture description.
+ /// \param [in] InitialState - Initial texture state. See Diligent::RESOURCE_STATE.
+ /// \param [out] ppTexture - Address of the memory location where the pointer to the
+ /// texture interface will be stored.
+ /// The function calls AddRef(), so that the new object will contain
+ /// one reference.
+ /// \note Only RESOURCE_DIM_TEX_2D dummy textures are supported.
+ virtual void CreateDummyTexture(const TextureDesc& TexDesc,
+ RESOURCE_STATE InitialState,
+ ITexture** ppTexture) = 0;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index f813cb58..02dacc62 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -291,7 +291,7 @@ void RenderDeviceGLImpl::CreateTextureFromGLHandle(Uint32 GLHandle, const Textur
);
}
-void RenderDeviceGLImpl::CreateDummyTexture(const TextureDesc& TexDesc, RESOURCE_STATE InitialState, TextureBaseGL** ppTexture)
+void RenderDeviceGLImpl::CreateDummyTexture(const TextureDesc& TexDesc, RESOURCE_STATE InitialState, ITexture** ppTexture)
{
CreateDeviceObject(
"texture", TexDesc, ppTexture,
diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
index fc33ccf9..a5e0dd93 100644
--- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
@@ -82,7 +82,7 @@ void SwapChainGLImpl::CreateDummyBuffers(RenderDeviceGLImpl* pRenderDeviceGL)
ColorBuffDesc.Height = m_SwapChainDesc.Height;
ColorBuffDesc.Format = m_SwapChainDesc.ColorBufferFormat;
ColorBuffDesc.BindFlags = BIND_RENDER_TARGET;
- RefCntAutoPtr<TextureBaseGL> pDummyColorBuffer;
+ RefCntAutoPtr<ITexture> pDummyColorBuffer;
pRenderDeviceGL->CreateDummyTexture(ColorBuffDesc, RESOURCE_STATE_RENDER_TARGET, &pDummyColorBuffer);
m_pRenderTargetView = ValidatedCast<TextureViewGLImpl>(pDummyColorBuffer->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET));
@@ -90,7 +90,7 @@ void SwapChainGLImpl::CreateDummyBuffers(RenderDeviceGLImpl* pRenderDeviceGL)
DepthBuffDesc.Name = "Main depth buffer stub";
DepthBuffDesc.Format = m_SwapChainDesc.DepthBufferFormat;
DepthBuffDesc.BindFlags = BIND_DEPTH_STENCIL;
- RefCntAutoPtr<TextureBaseGL> pDummyDepthBuffer;
+ RefCntAutoPtr<ITexture> pDummyDepthBuffer;
pRenderDeviceGL->CreateDummyTexture(DepthBuffDesc, RESOURCE_STATE_DEPTH_WRITE, &pDummyDepthBuffer);
m_pDepthStencilView = ValidatedCast<TextureViewGLImpl>(pDummyDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL));
}