Skip to content

Commit

Permalink
Minor fixes:
Browse files Browse the repository at this point in the history
- Use _MSC_VER as guard for MSVC __try/__except block instead of _WIN32 to make Testbed compile again with MinGW/Clang.
- Added missing include directives to LLGL-C/LLGL.h header.
- Fixed warning of unused switch-case in PostKeyEvent() function (Win32WindowCallback.cpp).
  • Loading branch information
LukasBanana committed Jul 3, 2024
1 parent 5cdd3a0 commit bd5bab2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/C99/HelloTriangle/HelloTriangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ int main(int argc, char* argv[])
// Vertex format with 2D floating-point vector for position and 4D byte vector for color
LLGLVertexAttribute vertexAttributes[2] =
{
{ .name = "position", .format = LLGLFormatRG32Float, .location = 0, .offset = 0, .stride = sizeof(Vertex) },
{ .name = "color", .format = LLGLFormatRGBA8UNorm, .location = 1, .offset = offsetof(Vertex, color), .stride = sizeof(Vertex) },
{ .name = "position", .format = LLGLFormatRG32Float, .location = 0, .offset = offsetof(Vertex, position), .stride = sizeof(Vertex) },
{ .name = "color", .format = LLGLFormatRGBA8UNorm, .location = 1, .offset = offsetof(Vertex, color ), .stride = sizeof(Vertex) },
};

// Create vertex buffer
Expand Down
3 changes: 3 additions & 0 deletions include/LLGL-C/LLGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#include <LLGL-C/Report.h>
#include <LLGL-C/RenderingDebugger.h>
#include <LLGL-C/RenderSystem.h>
#include <LLGL-C/RenderSystemChild.h>
#include <LLGL-C/CommandBuffer.h>
#include <LLGL-C/SwapChain.h>
#include <LLGL-C/Resource.h>
#include <LLGL-C/ResourceHeap.h>
#include <LLGL-C/Buffer.h>
#include <LLGL-C/BufferArray.h>
#include <LLGL-C/Texture.h>
#include <LLGL-C/Shader.h>
#include <LLGL-C/PipelineLayout.h>
Expand Down
6 changes: 6 additions & 0 deletions include/LLGL/PipelineLayoutFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ struct BindingSlot
/**
\brief Specifies the zero-based binding index. By default 0.
\remarks For Vulkan, each binding must have a unique slot within the same pipeline layout unless they are in different descriptor sets.
\remarks It is recommended to \e not use the binding slot 0 for buffer bindings because it might overlap with implicitly assigned slots depending on the backend.
- For Metal, shader resources and vertex buffers share the same binding table and LLGL binds vertex buffers starting from slot 0.
If more than one vertex buffer is bound, all subsequent slots will also be occupied by those vertex buffers and pipeline resources must be bound after them.
- For D3D11 and D3D12, the special constant buffer "$Globals" is implicitly assigned a binding slot.
If no other resource is explicitly assigned binding slot 0, this constant buffer will be implicitly assinged slot 0.
While other resources can occupy binding slot 0, this should match across all shader stages or the behavior is undefined.
\see set
*/
std::uint32_t index = 0;
Expand Down
3 changes: 3 additions & 0 deletions sources/Platform/Win32/Win32WindowCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ static void PostKeyEvent(HWND wnd, WPARAM wParam, LPARAM lParam, bool isDown, bo
PostKeyEvent(*window, Key::LControl, isDown);
}
break;

default:
break;
}

/* Post base key event */
Expand Down
8 changes: 4 additions & 4 deletions tests/Testbed/TestbedMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int GuardedMain(int argc, char* argv[])
return static_cast<int>(modulesWithFailedTests);
}

#ifdef _WIN32
#ifdef _MSC_VER

// Declare function that is not directly exposed in LLGL
namespace LLGL
Expand Down Expand Up @@ -217,17 +217,17 @@ static LONG WINAPI TestbedVectoredExceptionHandler(EXCEPTION_POINTERS* e)
"Callstack:\n"
"----------\n"
"%s\n",
e->ExceptionRecord->ExceptionAddress, e->ExceptionRecord->ExceptionCode, stackTrace.c_str()
e->ExceptionRecord->ExceptionAddress, static_cast<unsigned>(e->ExceptionRecord->ExceptionCode), stackTrace.c_str()
);
}
return EXCEPTION_CONTINUE_SEARCH;
}

#endif // /_WIN32
#endif // /_MSC_VER

int main(int argc, char* argv[])
{
#ifdef _WIN32
#ifdef _MSC_VER

AddVectoredExceptionHandler(1, TestbedVectoredExceptionHandler);
__try
Expand Down

0 comments on commit bd5bab2

Please sign in to comment.