Skip to content

Commit 3a62b4f

Browse files
committed
Whee
1 parent 04e93df commit 3a62b4f

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

Examples/Hello.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <Objectively.h>
2929
#include <ObjectivelyGPU.h>
3030

31+
#ifndef SHADERS
32+
# define SHADERS "."
33+
#endif
34+
3135
typedef struct {
3236
float x, y, z;
3337
float r, g, b;
@@ -103,8 +107,6 @@ static void upload_vertex_buffer(const RenderDevice *renderDevice, SDL_GPUBuffer
103107

104108

105109
int main(int argc, char **argv) {
106-
(void) argc;
107-
(void) argv;
108110

109111
int status = EXIT_FAILURE;
110112
SDL_Window *window = NULL;
@@ -121,12 +123,7 @@ int main(int argc, char **argv) {
121123
return status;
122124
}
123125

124-
const char *basePath = SDL_GetBasePath();
125-
if (basePath) {
126-
char shaderDir[512];
127-
SDL_snprintf(shaderDir, sizeof(shaderDir), "%sShaders", basePath);
128-
$$(Resource, addResourcePath, shaderDir);
129-
}
126+
$$(Resource, addResourcePath, SHADERS);
130127

131128
window = SDL_CreateWindow("ObjectivelyGPU Hello", 800, 600, SDL_WINDOW_HIGH_PIXEL_DENSITY);
132129
if (!window) {

Examples/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ noinst_PROGRAMS = \
66

77
CFLAGS += \
88
-I$(top_srcdir)/Sources \
9+
-DSHADERS=\"$(abs_srcdir)/Shaders\" \
910
@HOST_CFLAGS@ \
1011
@OBJECTIVELY_CFLAGS@ \
1112
@SDL3_CFLAGS@

ObjectivelyGPU.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
CECF83A02FEF6B2400CB0CCA /* HelloCompute.frag.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelloCompute.frag.spv; sourceTree = "<group>"; };
136136
CECF83A12FEF6B2400CB0CCA /* HelloCompute.vert.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.vert.msl; sourceTree = "<group>"; };
137137
CECF83A22FEF6B2400CB0CCA /* HelloCompute.vert.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelloCompute.vert.spv; sourceTree = "<group>"; };
138+
CECF83A32FEF6F5B00CB0CCA /* Makefile.am */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
138139
CEEAAFF72FED833A00FFEBE6 /* COPYING */ = {isa = PBXFileReference; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
139140
CEEAAFF82FED833A00FFEBE6 /* Makefile.am */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
140141
CEEAAFFA2FED833A00FFEBE6 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -288,6 +289,7 @@
288289
SC00500000000000000000A0 /* Shaders */,
289290
EE00010000000000000000B1 /* Hello.c */,
290291
EE00020000000000000000B2 /* HelloCompute.c */,
292+
CECF83A32FEF6F5B00CB0CCA /* Makefile.am */,
291293
);
292294
path = Examples;
293295
sourceTree = "<group>";

Sources/ObjectivelyGPU/RenderDevice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static SDL_GPUShader *loadShader(const RenderDevice *self, const char *name, con
288288
return shader;
289289
}
290290

291-
GPU_Assert(false, "loadShader: no supported format found for '%s'", name);
291+
GPU_Assert(false, "loadShader: no supported format found for '%s'\n", name);
292292
return NULL;
293293
}
294294

Sources/ObjectivelyGPU/Types.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ struct SDL_Size {
6565
* SDL_gpu operations where failure is unrecoverable (bad device, OOM, wrong
6666
* thread, unsupported format, etc.).
6767
*/
68-
#define GPU_Assert(cond, fmt, ...) do { \
68+
#define GPU_Assert(cond, fmt, ...) \
6969
if (!(cond)) { \
70-
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "%s::%s: " fmt ": %s", _Class()->def.name, __func__, ## __VA_ARGS__, SDL_GetError()); \
70+
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "%s::%d::%s: " fmt ": %s", __FILE__, __LINE__, __func__, ## __VA_ARGS__, SDL_GetError()); \
7171
SDL_TriggerBreakpoint(); \
7272
exit(EXIT_FAILURE); \
73-
} \
74-
} while (0)
73+
}

0 commit comments

Comments
 (0)