summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-25 19:19:23 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-25 19:19:23 +0000
commitd31dc00f82d2121dc0378db77264d9263540a192 (patch)
treed384eb65560a6bef42e339d4393e03b6c9baaa16 /Graphics/GraphicsEngineOpenGL
parentUpdated handling of fatal errors (diff)
downloadDiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.tar.gz
DiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.zip
Reworked main headers to be compatible with c
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/FBOCache.h4
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/GLContextState.h2
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h8
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/VAOCache.h2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp6
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp8
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp10
11 files changed, 26 insertions, 26 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/FBOCache.h b/Graphics/GraphicsEngineOpenGL/include/FBOCache.h
index 569cb4d5..250d4f71 100644
--- a/Graphics/GraphicsEngineOpenGL/include/FBOCache.h
+++ b/Graphics/GraphicsEngineOpenGL/include/FBOCache.h
@@ -67,8 +67,8 @@ private:
Uint32 NumRenderTargets = 0;
// Unique IDs of textures bound as render targets
- UniqueIdentifier RTIds[MaxRenderTargets] = {};
- TextureViewDesc RTVDescs[MaxRenderTargets];
+ UniqueIdentifier RTIds[MAX_RENDER_TARGETS] = {};
+ TextureViewDesc RTVDescs[MAX_RENDER_TARGETS];
// Unique IDs of texture bound as depth stencil
UniqueIdentifier DSId = 0;
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextState.h b/Graphics/GraphicsEngineOpenGL/include/GLContextState.h
index 25bd38ee..66879e65 100644
--- a/Graphics/GraphicsEngineOpenGL/include/GLContextState.h
+++ b/Graphics/GraphicsEngineOpenGL/include/GLContextState.h
@@ -265,7 +265,7 @@ private:
ContextCaps m_Caps;
- Uint32 m_ColorWriteMasks[MaxRenderTargets] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ Uint32 m_ColorWriteMasks[MAX_RENDER_TARGETS] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
EnableStateHelper m_bIndependentWriteMasks;
Int32 m_iActiveTexture = -1;
Int32 m_NumPatchVertices = -1;
diff --git a/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h b/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h
index d41a73d6..a24b1243 100644
--- a/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h
+++ b/Graphics/GraphicsEngineOpenGL/include/TexRegionRender.h
@@ -57,10 +57,10 @@ private:
IShaderResourceVariable* m_pSrcTexVar = nullptr;
RefCntAutoPtr<IPipelineState> m_pOrigPSO;
- Uint32 m_OrigStencilRef = 0;
- float m_OrigBlendFactors[4] = {};
- Uint32 m_NumRenderTargets = 0;
- ITextureView* m_pOrigRTVs[MaxRenderTargets] = {};
+ Uint32 m_OrigStencilRef = 0;
+ float m_OrigBlendFactors[4] = {};
+ Uint32 m_NumRenderTargets = 0;
+ ITextureView* m_pOrigRTVs[MAX_RENDER_TARGETS] = {};
RefCntAutoPtr<ITextureView> m_pOrigDSV;
std::vector<Viewport> m_OrigViewports;
};
diff --git a/Graphics/GraphicsEngineOpenGL/include/VAOCache.h b/Graphics/GraphicsEngineOpenGL/include/VAOCache.h
index 53ecfb6d..b1434b1f 100644
--- a/Graphics/GraphicsEngineOpenGL/include/VAOCache.h
+++ b/Graphics/GraphicsEngineOpenGL/include/VAOCache.h
@@ -90,7 +90,7 @@ private:
UniqueIdentifier BufferUId;
Uint32 Stride;
Uint32 Offset;
- } Streams[MaxBufferSlots];
+ } Streams[MAX_BUFFER_SLOTS];
mutable size_t Hash = 0;
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
index f8a7cc76..0f3d3b9c 100644
--- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
@@ -336,14 +336,14 @@ void DeviceContextGLImpl::CommitRenderTargets()
VERIFY(m_NumBoundRenderTargets != 0 || m_pBoundDepthStencil, "At least one render target or a depth stencil is expected");
Uint32 NumRenderTargets = m_NumBoundRenderTargets;
- VERIFY(NumRenderTargets < MaxRenderTargets, "Too many render targets (", NumRenderTargets, ") are being set");
- NumRenderTargets = std::min(NumRenderTargets, MaxRenderTargets);
+ VERIFY(NumRenderTargets < MAX_RENDER_TARGETS, "Too many render targets (", NumRenderTargets, ") are being set");
+ NumRenderTargets = std::min(NumRenderTargets, MAX_RENDER_TARGETS);
const auto& CtxCaps = m_ContextState.GetContextCaps();
VERIFY(NumRenderTargets < static_cast<Uint32>(CtxCaps.m_iMaxDrawBuffers), "This device only supports ", CtxCaps.m_iMaxDrawBuffers, " draw buffers, but ", NumRenderTargets, " are being set");
NumRenderTargets = std::min(NumRenderTargets, static_cast<Uint32>(CtxCaps.m_iMaxDrawBuffers));
- TextureViewGLImpl* pBoundRTVs[MaxRenderTargets] = {};
+ TextureViewGLImpl* pBoundRTVs[MAX_RENDER_TARGETS] = {};
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
{
pBoundRTVs[rt] = m_pBoundRenderTargets[rt];
diff --git a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
index a2427b45..5ed081cd 100644
--- a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
@@ -125,8 +125,8 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu
// Construct the key
FBOCacheKey Key;
- VERIFY(NumRenderTargets < MaxRenderTargets, "Too many render targets are being set");
- NumRenderTargets = std::min(NumRenderTargets, MaxRenderTargets);
+ VERIFY(NumRenderTargets < MAX_RENDER_TARGETS, "Too many render targets are being set");
+ NumRenderTargets = std::min(NumRenderTargets, MAX_RENDER_TARGETS);
Key.NumRenderTargets = NumRenderTargets;
for (Uint32 rt = 0; rt < NumRenderTargets; ++rt)
{
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
index 76a1a623..ba06b018 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
@@ -665,7 +665,7 @@ void GLContextState::SetBlendState(const BlendStateDesc& BSDsc, Uint32 SampleMas
bool bEnableBlend = false;
if (BSDsc.IndependentBlendEnable)
{
- for (int i = 0; i < BSDsc.MaxRenderTargets; ++i)
+ for (int i = 0; i < MAX_RENDER_TARGETS; ++i)
{
const auto& RT = BSDsc.RenderTargets[i];
if (RT.BlendEnable)
@@ -707,7 +707,7 @@ void GLContextState::SetBlendState(const BlendStateDesc& BSDsc, Uint32 SampleMas
if (BSDsc.IndependentBlendEnable)
{
- for (int i = 0; i < BSDsc.MaxRenderTargets; ++i)
+ for (int i = 0; i < MAX_RENDER_TARGETS; ++i)
{
const auto& RT = BSDsc.RenderTargets[i];
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
index 4dfdfc4e..c3e3609f 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
@@ -292,7 +292,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
if (glGetError() != GL_NO_ERROR)
LOG_ERROR_MESSAGE("Failed to enable SRGB framebuffers");
- deviceCaps.DevType = DeviceType::OpenGL;
+ deviceCaps.DevType = RENDER_DEVICE_TYPE_GL;
deviceCaps.MajorVersion = MajorVersion;
deviceCaps.MinorVersion = MinorVersion;
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
index 7e50c158..033d17e7 100644
--- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
@@ -67,7 +67,7 @@ PipelineStateGLImpl::PipelineStateGLImpl(IReferenceCounters* pRefCounters,
}
auto& DeviceCaps = pDeviceGL->GetDeviceCaps();
- VERIFY(DeviceCaps.DevType != DeviceType::Undefined, "Device caps are not initialized");
+ VERIFY(DeviceCaps.DevType != RENDER_DEVICE_TYPE_UNDEFINED, "Device caps are not initialized");
auto pImmediateCtx = m_pDevice->GetImmediateContext();
VERIFY_EXPR(pImmediateCtx);
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index fc50c709..54746823 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -137,7 +137,7 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
Features.VertexPipelineUAVWritesAndAtomics = False;
- if (m_DeviceCaps.DevType == DeviceType::OpenGL)
+ if (m_DeviceCaps.DevType == RENDER_DEVICE_TYPE_GL)
{
const bool IsGL46OrAbove = (MajorVersion >= 5) || (MajorVersion == 4 && MinorVersion >= 6);
const bool IsGL43OrAbove = (MajorVersion >= 5) || (MajorVersion == 4 && MinorVersion >= 3);
@@ -185,7 +185,7 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
const auto* Extensions = (char*)glGetString(GL_EXTENSIONS);
LOG_INFO_MESSAGE("Supported extensions: \n", Extensions);
- VERIFY(m_DeviceCaps.DevType == DeviceType::OpenGLES, "Unexpected device type: OpenGLES expected");
+ VERIFY(m_DeviceCaps.DevType == RENDER_DEVICE_TYPE_GLES, "Unexpected device type: OpenGLES expected");
bool IsGLES31OrAbove = (MajorVersion >= 4) || (MajorVersion == 3 && MinorVersion >= 1);
bool IsGLES32OrAbove = (MajorVersion >= 4) || (MajorVersion == 3 && MinorVersion >= 2);
@@ -519,7 +519,7 @@ bool RenderDeviceGLImpl::CheckExtension(const Char* ExtensionString)
void RenderDeviceGLImpl::FlagSupportedTexFormats()
{
const auto& DeviceCaps = GetDeviceCaps();
- bool bGL33OrAbove = DeviceCaps.DevType == DeviceType::OpenGL &&
+ bool bGL33OrAbove = DeviceCaps.DevType == RENDER_DEVICE_TYPE_GL &&
(DeviceCaps.MajorVersion >= 4 || (DeviceCaps.MajorVersion == 3 && DeviceCaps.MinorVersion >= 3));
bool bRGTC = CheckExtension("GL_ARB_texture_compression_rgtc");
@@ -640,7 +640,7 @@ void RenderDeviceGLImpl::FlagSupportedTexFormats()
// clang-format on
#ifdef _DEBUG
- bool bGL43OrAbove = DeviceCaps.DevType == DeviceType::OpenGL &&
+ bool bGL43OrAbove = DeviceCaps.DevType == RENDER_DEVICE_TYPE_GL &&
(DeviceCaps.MajorVersion >= 5 || (DeviceCaps.MajorVersion == 4 && DeviceCaps.MinorVersion >= 3));
constexpr int TestTextureDim = 8;
diff --git a/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp b/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp
index 30c46b1d..55080ad0 100644
--- a/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp
@@ -86,7 +86,7 @@ const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO(IPipelineState*
// Lock the cache
ThreadingTools::LockHelper CacheLock{m_CacheLockFlag};
- BufferGLImpl* VertexBuffers[MaxBufferSlots];
+ BufferGLImpl* VertexBuffers[MAX_BUFFER_SLOTS];
for (Uint32 s = 0; s < NumVertexStreams; ++s)
VertexBuffers[s] = nullptr;
@@ -109,9 +109,9 @@ const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO(IPipelineState*
UNEXPECTED("Input layout requires more buffers than bound to the pipeline");
continue;
}
- if (BuffSlot >= MaxBufferSlots)
+ if (BuffSlot >= MAX_BUFFER_SLOTS)
{
- VERIFY(BuffSlot >= MaxBufferSlots, "Incorrect input slot");
+ VERIFY(BuffSlot >= MAX_BUFFER_SLOTS, "Incorrect input slot");
continue;
}
auto MaxUsedSlot = std::max(Key.NumUsedSlots, BuffSlot + 1);
@@ -175,7 +175,7 @@ const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO(IPipelineState*
for (size_t Elem = 0; Elem < NumElems; ++Elem, ++LayoutIt)
{
auto BuffSlot = LayoutIt->BufferSlot;
- if (BuffSlot >= NumVertexStreams || BuffSlot >= MaxBufferSlots)
+ if (BuffSlot >= NumVertexStreams || BuffSlot >= MAX_BUFFER_SLOTS)
{
UNEXPECTED("Incorrect input buffer slot");
continue;
@@ -203,7 +203,7 @@ const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO(IPipelineState*
else
glVertexAttribPointer(LayoutIt->InputIndex, LayoutIt->NumComponents, GlType, LayoutIt->IsNormalized, Stride, DataStartOffset);
- if (LayoutIt->Frequency == LayoutElement::FREQUENCY_PER_INSTANCE)
+ if (LayoutIt->Frequency == INPUT_ELEMENT_FREQUENCY_PER_INSTANCE)
{
// If divisor is zero, then the attribute acts like normal, being indexed by the array or index
// buffer. If divisor is non-zero, then the current instance is divided by this divisor, and