Skip to content

Commit

Permalink
[GL] Fixed missing GLBufferWithXFB allocation in GL backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBanana committed Oct 9, 2024
1 parent 5ebba4c commit abd9142
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
17 changes: 15 additions & 2 deletions sources/Renderer/OpenGL/GLRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "GLCore.h"
#include "Shader/GLLegacyShader.h"
#include "Buffer/GLBufferWithVAO.h"
#include "Buffer/GLBufferWithXFB.h"
#include "Buffer/GLBufferArrayWithVAO.h"
#include "../CheckedCast.h"
#include "../BufferUtils.h"
Expand Down Expand Up @@ -117,7 +118,7 @@ void GLRenderSystem::Release(CommandBuffer& commandBuffer)

static GLbitfield GetGLBufferStorageFlags(long cpuAccessFlags)
{
#ifdef GL_ARB_buffer_storage
#if GL_ARB_buffer_storage

GLbitfield flagsGL = 0;

Expand Down Expand Up @@ -170,7 +171,19 @@ Buffer* GLRenderSystem::CreateBuffer(const BufferDescriptor& bufferDesc, const v
// private
GLBuffer* GLRenderSystem::CreateGLBuffer(const BufferDescriptor& bufferDesc, const void* initialData)
{
/* Create either base of sub-class GLBuffer object */
#if LLGL_GLEXT_TRNASFORM_FEEDBACK2
if ((bufferDesc.bindFlags & BindFlags::StreamOutputBuffer) != 0)
{
/* Create buffer with VAO and transform feedback object */
auto* bufferGL = buffers_.emplace<GLBufferWithXFB>(bufferDesc.bindFlags, bufferDesc.debugName);
{
GLBufferStorage(*bufferGL, bufferDesc, initialData);
bufferGL->BuildVertexArray(bufferDesc.vertexAttribs);
}
return bufferGL;
}
else
#endif // /LLGL_GLEXT_TRNASFORM_FEEDBACK2
if ((bufferDesc.bindFlags & BindFlags::VertexBuffer) != 0)
{
/* Create buffer with VAO and build vertex array */
Expand Down
35 changes: 28 additions & 7 deletions tests/Testbed/TestbedMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,51 @@ static bool HasProgramArgument(int argc, char* argv[], const char* search)

static void PrintHelpDocs()
{
// Find available modules
auto availableModules = RenderSystem::FindModules();
std::string availableModulesStr;

auto ListModuleIfAvailable = [&availableModules, &availableModulesStr](const char* name, const char* docu) -> void
{
auto it = std::find_if(
availableModules.begin(), availableModules.end(),
[name](const std::string& entry) -> bool
{
return (entry.compare(name) == 0);
}
);
if (it != availableModules.end())
availableModulesStr += docu;
};

ListModuleIfAvailable("Direct3D11", " d3d11, dx11, direct3d11 ............ Direct3D 11 module\n");
ListModuleIfAvailable("Direct3D12", " d3d12, dx12, direct3d12 ............ Direct3D 12 module\n");
ListModuleIfAvailable("OpenGL", " gl, gl[VER], opengl, opengl[VER] ... OpenGL module with optional version, e.g. gl330\n");
ListModuleIfAvailable("Metal", " mt, mtl, metal ..................... Metal module\n");
ListModuleIfAvailable("Vulkan", " vk, vulkan ......................... Vulkan module\n");

// Print help listing
Log::Printf(
"Testbed MODULES* OPTIONS*\n"
" -> Runs LLGL's unit tests\n"
"\n"
"MODULE:\n"
" gl, gl[VER], opengl, opengl[VER] ... OpenGL module with optional version, e.g. gl330\n"
" vk, vulkan ......................... Vulkan module\n"
" mt, mtl, metal ..................... Metal module\n"
" d3d11, dx11, direct3d11 ............ Direct3D 11 module\n"
" d3d12, dx12, direct3d12 ............ Direct3D 12 module\n"
"%s"
"\n"
"OPTIONS:\n"
" -d, --debug [=OPT] ................. Enable debug layers (gpu, cpu, gpu+cpu)\n"
" -f, --fast ......................... Run fast test; skips certain configurations\n"
" -g, --greedy ....................... Keep running each test even after failure\n"
" -h, --help ......................... Print this help document\n"
" -p, --pedantic ..................... Disable diff-checking threshold\n"
" -run=LIST .......................... Only run tests in comma separated list"
" -run=LIST .......................... Only run tests in comma separated list\n"
" -s, --santiy-check ................. Print some test results even on success\n"
" -t, --timing ....................... Print timing results\n"
" -v, --verbose ...................... Print more information\n"
" --amd .............................. Prefer AMD device\n"
" --intel ............................ Prefer Intel device\n"
" --nvidia ........................... Prefer NVIDIA device\n"
" --nvidia ........................... Prefer NVIDIA device\n",
availableModulesStr.c_str()
);
}

Expand Down

0 comments on commit abd9142

Please sign in to comment.