diff --git a/include/LLGL/SamplerFlags.h b/include/LLGL/SamplerFlags.h index 8591cbfed2..e663299666 100644 --- a/include/LLGL/SamplerFlags.h +++ b/include/LLGL/SamplerFlags.h @@ -136,7 +136,7 @@ struct LLGL_EXPORT SamplerDescriptor /** \brief MIP-mapping level-of-detail (LOD) bias (or rather offset). By default 0. \remarks For Metal and OpenGLES, the LOD bias can only be specified within the shader code. - \note Only supported with: OpenGL, Vulkan, Direct3D 11, Direct3D 12. + \note Only supported with: OpenGL (Desktop only), Vulkan, Direct3D 11, Direct3D 12. */ float mipMapLODBias = 0.0f; @@ -148,7 +148,7 @@ struct LLGL_EXPORT SamplerDescriptor /** \brief Maximal anisotropy in the range [1, 16]. - \note Only supported with: OpenGL, Vulkan, Direct3D 11, Direct3D 12, Metal. + \note Only supported with: OpenGL (Desktop only), Vulkan, Direct3D 11, Direct3D 12, Metal. */ std::uint32_t maxAnisotropy = 1; diff --git a/sources/Renderer/OpenGL/GLESProfile/GLESProfile.cpp b/sources/Renderer/OpenGL/GLESProfile/GLESProfile.cpp index 2120312092..2de450fe16 100644 --- a/sources/Renderer/OpenGL/GLESProfile/GLESProfile.cpp +++ b/sources/Renderer/OpenGL/GLESProfile/GLESProfile.cpp @@ -21,7 +21,7 @@ namespace GLProfile int GetRendererID() { - return RendererID::OpenGLES3; + return RendererID::OpenGLES; } const char* GetModuleName() @@ -99,22 +99,22 @@ void UnmapBuffer(GLenum target) glUnmapBuffer(target); } -// Global memory bank of CL_COLOR_ATTACHMENT0-31 values initialized with GL_NONE -static GLenum g_colorAttachmentsBank[32] = +// Global memory bank of CL_COLOR_ATTACHMENT0-7 values initialized with GL_NONE +static GLenum g_colorAttachmentsBank[8] = { GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, + #if LLGL_MAX_NUM_COLOR_ATTACHMENTS > 8 GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, + #endif }; +static_assert(LLGL_MAX_NUM_COLOR_ATTACHMENTS <= 16, "GLES profile can only handle up to 16 color attachments, but LLGL_MAX_NUM_COLOR_ATTACHMENTS exceed that limit"); + void DrawBuffer(GLenum buf) { - if (buf >= GL_COLOR_ATTACHMENT0 && buf <= GL_COLOR_ATTACHMENT31) + if (buf >= GL_COLOR_ATTACHMENT0 && buf <= GL_COLOR_ATTACHMENT0 + LLGL_MAX_NUM_COLOR_ATTACHMENTS) { /* GL_COLOR_ATTACHMENT(i) must only be used at the i-th binding point in GLES/WebGL, diff --git a/sources/Renderer/OpenGL/WebGLProfile/WebGLProfile.cpp b/sources/Renderer/OpenGL/WebGLProfile/WebGLProfile.cpp index 6270c3bbeb..b363c7e6b6 100644 --- a/sources/Renderer/OpenGL/WebGLProfile/WebGLProfile.cpp +++ b/sources/Renderer/OpenGL/WebGLProfile/WebGLProfile.cpp @@ -135,22 +135,22 @@ void UnmapBuffer(GLenum target) } } -// Global memory bank of CL_COLOR_ATTACHMENT0-31 values initialized with GL_NONE -static GLenum g_colorAttachmentsBank[32] = +// Global memory bank of CL_COLOR_ATTACHMENT0-7 values initialized with GL_NONE +static GLenum g_colorAttachmentsBank[8] = { GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, + #if LLGL_MAX_NUM_COLOR_ATTACHMENTS > 8 GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, - GL_NONE, GL_NONE, GL_NONE, GL_NONE, + #endif }; +static_assert(LLGL_MAX_NUM_COLOR_ATTACHMENTS <= 16, "WebGL profile can only handle up to 16 color attachments, but LLGL_MAX_NUM_COLOR_ATTACHMENTS exceed that limit"); + void DrawBuffer(GLenum buf) { - if (buf >= GL_COLOR_ATTACHMENT0 && buf <= GL_COLOR_ATTACHMENT31) + if (buf >= GL_COLOR_ATTACHMENT0 && buf <= GL_COLOR_ATTACHMENT0 + LLGL_MAX_NUM_COLOR_ATTACHMENTS) { /* GL_COLOR_ATTACHMENT(i) must only be used at the i-th binding point in GLES/WebGL, diff --git a/sources/Renderer/VirtualCommandBuffer.h b/sources/Renderer/VirtualCommandBuffer.h index cf136fd8ea..99c9515d3b 100644 --- a/sources/Renderer/VirtualCommandBuffer.h +++ b/sources/Renderer/VirtualCommandBuffer.h @@ -238,6 +238,8 @@ class VirtualCommandBuffer return reinterpret_cast(AllocAlignedDataWithOpcode(opcode, sizeof(TCommand) + payloadSize, alignof(TCommand))); } + // Runs the input function over every command in this virtual command buffer. + // The function callback must return the size (in bytes) of the command being processed. template void Run(Functor func, TArgs&&... args) const {