summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-15 19:32:55 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-15 19:32:55 +0000
commit2cbe12c8541f63719ae3662cda827ed53004c0b2 (patch)
tree6ff68d7ee7d386d1c0e30c00fcd551fcbf819c6c /Graphics/GraphicsEngineOpenGL
parentMath Lib: added Matrix4x4 constructor from float4 rows (diff)
parentBasicMath: minor code formatting (diff)
downloadDiligentCore-2cbe12c8541f63719ae3662cda827ed53004c0b2.tar.gz
DiligentCore-2cbe12c8541f63719ae3662cda827ed53004c0b2.zip
Merge branch 'azhirnov-ray_tracing_2'
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp25
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.hpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp16
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp35
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp6
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp37
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp6
8 files changed, 120 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp
index 205c62b7..a128c7c7 100644
--- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp
@@ -40,6 +40,8 @@
#include "FramebufferGLImpl.hpp"
#include "RenderPassGLImpl.hpp"
#include "PipelineStateGLImpl.hpp"
+#include "BottomLevelASBase.hpp"
+#include "TopLevelASBase.hpp"
namespace Diligent
{
@@ -53,6 +55,8 @@ struct DeviceContextGLImplTraits
using QueryType = QueryGLImpl;
using FramebufferType = FramebufferGLImpl;
using RenderPassType = RenderPassGLImpl;
+ using BottomLevelASType = BottomLevelASBase<IBottomLevelAS, RenderDeviceGLImpl>;
+ using TopLevelASType = TopLevelASBase<ITopLevelAS, BottomLevelASType, RenderDeviceGLImpl>;
};
/// Device context implementation in OpenGL backend.
@@ -243,6 +247,27 @@ public:
/// Implementation of IDeviceContext::Flush() in OpenGL backend.
virtual void DILIGENT_CALL_TYPE Flush() override final;
+ /// Implementation of IDeviceContext::BuildBLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE BuildBLAS(const BuildBLASAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::BuildTLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE BuildTLAS(const BuildTLASAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::CopyBLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CopyBLAS(const CopyBLASAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::CopyTLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CopyTLAS(const CopyTLASAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::WriteBLASCompactedSize() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE WriteBLASCompactedSize(const WriteBLASCompactedSizeAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::WriteTLASCompactedSize() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE WriteTLASCompactedSize(const WriteTLASCompactedSizeAttribs& Attribs) override final;
+
+ /// Implementation of IDeviceContext::TraceRays() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE TraceRays(const TraceRaysAttribs& Attribs) override final;
+
/// Implementation of IDeviceContextGL::UpdateCurrentGLContext().
virtual bool DILIGENT_CALL_TYPE UpdateCurrentGLContext() override final;
diff --git a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.hpp
index 93180774..0635313d 100644
--- a/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/PipelineStateGLImpl.hpp
@@ -112,7 +112,7 @@ private:
void Initialize(const PSOCreateInfoType& CreateInfo, const std::vector<GLPipelineShaderStageInfo>& ShaderStages);
void InitResourceLayouts(const std::vector<GLPipelineShaderStageInfo>& ShaderStages,
- LinearAllocator& MemPool);
+ FixedLinearAllocator& MemPool);
void Destruct();
diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
index 6b76feb9..23c0fc9c 100644
--- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.hpp
@@ -94,6 +94,10 @@ public:
virtual void DILIGENT_CALL_TYPE CreateComputePipelineState(const ComputePipelineStateCreateInfo& PSOCreateInfo,
IPipelineState** ppPipelineState) override final;
+ /// Implementation of IRenderDevice::CreateRayTracingPipelineState() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CreateRayTracingPipelineState(const RayTracingPipelineStateCreateInfo& PSOCreateInfo,
+ IPipelineState** ppPipelineState) override final;
+
void CreateGraphicsPipelineState(const GraphicsPipelineStateCreateInfo& PSOCreateInfo,
IPipelineState** ppPipelineState,
bool bIsDeviceInternal);
@@ -115,6 +119,18 @@ public:
virtual void DILIGENT_CALL_TYPE CreateFramebuffer(const FramebufferDesc& Desc,
IFramebuffer** ppFramebuffer) override final;
+ /// Implementation of IRenderDevice::CreateBLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CreateBLAS(const BottomLevelASDesc& Desc,
+ IBottomLevelAS** ppBLAS) override final;
+
+ /// Implementation of IRenderDevice::CreateTLAS() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CreateTLAS(const TopLevelASDesc& Desc,
+ ITopLevelAS** ppTLAS) override final;
+
+ /// Implementation of IRenderDevice::CreateSBT() in OpenGL backend.
+ virtual void DILIGENT_CALL_TYPE CreateSBT(const ShaderBindingTableDesc& Desc,
+ IShaderBindingTable** ppSBT) override final;
+
/// Implementation of IRenderDeviceGL::CreateTextureFromGLHandle().
virtual void DILIGENT_CALL_TYPE CreateTextureFromGLHandle(Uint32 GLHandle,
Uint32 GLBindTarget,
diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
index ac99cfa0..97d7ddb7 100644
--- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
@@ -383,7 +383,7 @@ void BufferGLImpl::CreateViewInternal(const BufferViewDesc& OrigViewDesc, IBuffe
try
{
auto ViewDesc = OrigViewDesc;
- CorrectBufferViewDesc(ViewDesc);
+ ValidateAndCorrectBufferViewDesc(m_Desc, ViewDesc);
auto* pDeviceGLImpl = GetDevice();
auto& BuffViewAllocator = pDeviceGLImpl->GetBuffViewObjAllocator();
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
index 9e1760ac..589f469e 100644
--- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
@@ -1721,4 +1721,39 @@ void DeviceContextGLImpl::ResolveTextureSubresource(ITexture*
CommitRenderTargets();
}
+void DeviceContextGLImpl::BuildBLAS(const BuildBLASAttribs& Attribs)
+{
+ UNSUPPORTED("BuildBLAS is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::BuildTLAS(const BuildTLASAttribs& Attribs)
+{
+ UNSUPPORTED("BuildTLAS is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::CopyBLAS(const CopyBLASAttribs& Attribs)
+{
+ UNSUPPORTED("CopyBLAS is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::CopyTLAS(const CopyTLASAttribs& Attribs)
+{
+ UNSUPPORTED("CopyTLAS is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::WriteBLASCompactedSize(const WriteBLASCompactedSizeAttribs& Attribs)
+{
+ UNSUPPORTED("WriteBLASCompactedSize is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::WriteTLASCompactedSize(const WriteTLASCompactedSizeAttribs& Attribs)
+{
+ UNSUPPORTED("WriteTLASCompactedSize is not supported in OpenGL");
+}
+
+void DeviceContextGLImpl::TraceRays(const TraceRaysAttribs& Attribs)
+{
+ UNSUPPORTED("TraceRays is not supported in OpenGL");
+}
+
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
index 7edeaa96..b8c0a7c0 100644
--- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
@@ -40,7 +40,7 @@ namespace Diligent
template <typename PSOCreateInfoType>
void PipelineStateGLImpl::Initialize(const PSOCreateInfoType& CreateInfo, const std::vector<GLPipelineShaderStageInfo>& ShaderStages)
{
- LinearAllocator MemPool{GetRawAllocator()};
+ FixedLinearAllocator MemPool{GetRawAllocator()};
VERIFY_EXPR(m_NumShaderStages > 0 && m_NumShaderStages == ShaderStages.size());
if (!GetDevice()->GetDeviceCaps().Features.SeparablePrograms)
m_NumShaderStages = 1;
@@ -154,6 +154,8 @@ PipelineStateGLImpl::~PipelineStateGLImpl()
void PipelineStateGLImpl::Destruct()
{
+ TPipelineStateBase::Destruct();
+
auto& RawAllocator = GetRawAllocator();
m_StaticResourceCache.Destroy(RawAllocator);
GetDevice()->OnDestroyPSO(this);
@@ -188,7 +190,7 @@ IMPLEMENT_QUERY_INTERFACE(PipelineStateGLImpl, IID_PipelineStateGL, TPipelineSta
void PipelineStateGLImpl::InitResourceLayouts(const std::vector<GLPipelineShaderStageInfo>& ShaderStages,
- LinearAllocator& MemPool)
+ FixedLinearAllocator& MemPool)
{
auto* const pDeviceGL = GetDevice();
const auto& deviceCaps = pDeviceGL->GetDeviceCaps();
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index ad227ef0..6c272f88 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -149,13 +149,18 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
sizeof(FenceGLImpl),
sizeof(QueryGLImpl),
sizeof(RenderPassGLImpl),
- sizeof(FramebufferGLImpl)
+ sizeof(FramebufferGLImpl),
+ 0,
+ 0,
+ 0
}
},
// Device caps must be filled in before the constructor of Pipeline Cache is called!
m_GLContext{InitAttribs, m_DeviceCaps, pSCDesc}
// clang-format on
{
+ static_assert(sizeof(DeviceObjectSizes) == sizeof(size_t) * 15, "Please add new objects to DeviceObjectSizes constructor");
+
GLint NumExtensions = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtensions);
CHECK_GL_ERROR("Failed to get the number of extensions");
@@ -310,6 +315,7 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
SET_FEATURE_STATE(VertexPipelineUAVWritesAndAtomics, false, "Vertex pipeline UAV writes and atomics are");
SET_FEATURE_STATE(MeshShaders, false, "Mesh shaders are");
+ SET_FEATURE_STATE(RayTracing, false, "Ray tracing is");
{
bool WireframeFillSupported = (glPolygonMode != nullptr);
@@ -461,7 +467,7 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
#undef SET_FEATURE_STATE
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
+ static_assert(sizeof(DeviceFeatures) == 32, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
#endif
}
@@ -735,6 +741,12 @@ void RenderDeviceGLImpl::CreateComputePipelineState(const ComputePipelineStateCr
return CreateComputePipelineState(PSOCreateInfo, ppPipelineState, false);
}
+void RenderDeviceGLImpl::CreateRayTracingPipelineState(const RayTracingPipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState)
+{
+ UNSUPPORTED("Ray tracing is not supported in OpenGL");
+ *ppPipelineState = nullptr;
+}
+
void RenderDeviceGLImpl::CreateFence(const FenceDesc& Desc, IFence** ppFence)
{
CreateDeviceObject(
@@ -789,6 +801,27 @@ void RenderDeviceGLImpl::CreateFramebuffer(const FramebufferDesc& Desc, IFramebu
});
}
+void RenderDeviceGLImpl::CreateBLAS(const BottomLevelASDesc& Desc,
+ IBottomLevelAS** ppBLAS)
+{
+ UNSUPPORTED("CreateBLAS is not supported in OpenGL");
+ *ppBLAS = nullptr;
+}
+
+void RenderDeviceGLImpl::CreateTLAS(const TopLevelASDesc& Desc,
+ ITopLevelAS** ppTLAS)
+{
+ UNSUPPORTED("CreateTLAS is not supported in OpenGL");
+ *ppTLAS = nullptr;
+}
+
+void RenderDeviceGLImpl::CreateSBT(const ShaderBindingTableDesc& Desc,
+ IShaderBindingTable** ppSBT)
+{
+ UNSUPPORTED("CreateSBT is not supported in OpenGL");
+ *ppSBT = nullptr;
+}
+
bool RenderDeviceGLImpl::CheckExtension(const Char* ExtensionString)
{
return m_ExtensionStrings.find(ExtensionString) != m_ExtensionStrings.end();
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
index 243ab1c9..77e681f7 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
@@ -359,7 +359,7 @@ void TextureBaseGL::CreateViewInternal(const struct TextureViewDesc& OrigViewDes
try
{
auto ViewDesc = OrigViewDesc;
- CorrectTextureViewDesc(ViewDesc);
+ ValidatedAndCorrectTextureViewDesc(m_Desc, ViewDesc);
auto* pDeviceGLImpl = GetDevice();
auto& TexViewAllocator = pDeviceGLImpl->GetTexViewObjAllocator();
@@ -598,7 +598,7 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL,
TextureViewDesc SRVDesc;
SRVDesc.TextureDim = SrcTexDesc.Type;
SRVDesc.ViewType = TEXTURE_VIEW_SHADER_RESOURCE;
- CorrectTextureViewDesc(SRVDesc);
+ ValidatedAndCorrectTextureViewDesc(m_Desc, SRVDesc);
// Note: texture view allocates memory for the copy of the name
// If the name is empty, memory should not be allocated
// We have to provide allocator even though it will never be used
@@ -617,7 +617,7 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL,
RTVDesc.FirstArraySlice = DepthSlice + DstSlice;
RTVDesc.MostDetailedMip = DstMipLevel;
RTVDesc.NumArraySlices = 1;
- CorrectTextureViewDesc(RTVDesc);
+ ValidatedAndCorrectTextureViewDesc(m_Desc, RTVDesc);
// Note: texture view allocates memory for the copy of the name
// If the name is empty, memory should not be allocated
// We have to provide allocator even though it will never be used