Skip to content

Commit 1ab3e5a

Browse files
committed
Use .metal file extension for MSL as that's what Apple wants.
1 parent 0a4687d commit 1ab3e5a

13 files changed

Lines changed: 63 additions & 63 deletions

File tree

Examples/Makefile.am

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,49 @@ HelloCompute_SOURCES = HelloCompute.c
2323
# Normal builds never invoke glslc or shadercross. Run 'make shaders' after
2424
# editing a .glsl file to regenerate the platform blobs.
2525

26-
GLSLC = glslc
26+
GLSLC = glslc
2727
SHADERCROSS = shadercross
2828

2929
GLSL_SHADERS = \
30-
Hello.vert.glsl \
31-
Hello.frag.glsl \
32-
HelloCompute.comp.glsl \
33-
HelloCompute.vert.glsl \
34-
HelloCompute.frag.glsl
35-
36-
MSL_BLOBS = \
37-
Hello.vert.msl \
38-
Hello.frag.msl \
39-
HelloCompute.comp.msl \
40-
HelloCompute.vert.msl \
41-
HelloCompute.frag.msl
42-
43-
SPIRV_BLOBS = \
44-
Hello.vert.spv \
45-
Hello.frag.spv \
46-
HelloCompute.comp.spv \
47-
HelloCompute.vert.spv \
48-
HelloCompute.frag.spv
49-
50-
EXTRA_DIST = $(GLSL_SHADERS) $(MSL_BLOBS) $(SPIRV_BLOBS)
30+
Hello.vert.glsl \
31+
Hello.frag.glsl \
32+
HelloCompute.comp.glsl \
33+
HelloCompute.vert.glsl \
34+
HelloCompute.frag.glsl
35+
36+
METAL_SHADERS = \
37+
Hello.vert.metal \
38+
Hello.frag.metal \
39+
HelloCompute.comp.metal \
40+
HelloCompute.vert.metal \
41+
HelloCompute.frag.metal
42+
43+
SPIRV_SHADERS = \
44+
Hello.vert.spv \
45+
Hello.frag.spv \
46+
HelloCompute.comp.spv \
47+
HelloCompute.vert.spv \
48+
HelloCompute.frag.spv
49+
50+
EXTRA_DIST = $(GLSL_SHADERS) $(METAL_SHADERS) $(SPIRV_SHADERS)
5151

5252
.PHONY: shaders
53-
shaders: $(SPV_BLOBS) $(MSL_BLOBS)
53+
shaders: $(METAL_SHADERS) $(SPIRV_SHADERS)
54+
55+
$(srcdir)/%.vert.metal: $(srcdir)/%.vert.spv
56+
$(SHADERCROSS) $< -s SPIRV -d MSL -t vertex -o $@
57+
58+
$(srcdir)/%.frag.metal: $(srcdir)/%.frag.spv
59+
$(SHADERCROSS) $< -s SPIRV -d MSL -t fragment -o $@
60+
61+
$(srcdir)/%.comp.metal: $(srcdir)/%.comp.spv
62+
$(SHADERCROSS) $< -s SPIRV -d MSL -t compute -o $@
5463

5564
$(srcdir)/%.vert.spv: $(srcdir)/%.vert.glsl
5665
$(GLSLC) -fshader-stage=vert $< -o $@
5766

58-
$(srcdir)/%.vert.msl: $(srcdir)/%.vert.spv
59-
$(SHADERCROSS) $< -s SPIRV -d MSL -t vertex -o $@
60-
6167
$(srcdir)/%.frag.spv: $(srcdir)/%.frag.glsl
6268
$(GLSLC) -fshader-stage=frag $< -o $@
6369

64-
$(srcdir)/%.frag.msl: $(srcdir)/%.frag.spv
65-
$(SHADERCROSS) $< -s SPIRV -d MSL -t fragment -o $@
66-
6770
$(srcdir)/%.comp.spv: $(srcdir)/%.comp.glsl
6871
$(GLSLC) -fshader-stage=comp $< -o $@
69-
70-
$(srcdir)/%.comp.msl: $(srcdir)/%.comp.spv
71-
$(SHADERCROSS) $< -s SPIRV -d MSL -t compute -o $@

ObjectivelyGPU.xcodeproj/project.pbxproj

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@
5050
CEBA3F782FF3419100758CA6 /* ObjectivelyGPU.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6251F22589273797656C269E /* ObjectivelyGPU.framework */; };
5151
CECF83982FEF6A7200CB0CCA /* Mathlib.h in Headers */ = {isa = PBXBuildFile; fileRef = CECF83972FEF6A7200CB0CCA /* Mathlib.h */; settings = {ATTRIBUTES = (Public, ); }; };
5252
CECF83B52FEF765400CB0CCA /* Hello.frag.glsl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A42FEF712F00CB0CCA /* Hello.frag.glsl */; };
53-
CECF83B62FEF765400CB0CCA /* Hello.frag.msl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A52FEF712F00CB0CCA /* Hello.frag.msl */; };
53+
CECF83B62FEF765400CB0CCA /* Hello.frag.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A52FEF712F00CB0CCA /* Hello.frag.metal */; };
5454
CECF83B72FEF765400CB0CCA /* Hello.frag.spv in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A62FEF712F00CB0CCA /* Hello.frag.spv */; };
5555
CECF83B82FEF765400CB0CCA /* Hello.vert.glsl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A72FEF712F00CB0CCA /* Hello.vert.glsl */; };
56-
CECF83B92FEF765400CB0CCA /* Hello.vert.msl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A82FEF712F00CB0CCA /* Hello.vert.msl */; };
56+
CECF83B92FEF765400CB0CCA /* Hello.vert.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A82FEF712F00CB0CCA /* Hello.vert.metal */; };
5757
CECF83BA2FEF765400CB0CCA /* Hello.vert.spv in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83A92FEF712F00CB0CCA /* Hello.vert.spv */; };
5858
CECF83BB2FEF765400CB0CCA /* HelloCompute.c in CopyFiles */ = {isa = PBXBuildFile; fileRef = EE00020000000000000000B2 /* HelloCompute.c */; };
5959
CECF83BC2FEF765400CB0CCA /* HelloCompute.comp.glsl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AA2FEF712F00CB0CCA /* HelloCompute.comp.glsl */; };
60-
CECF83BD2FEF765400CB0CCA /* HelloCompute.comp.msl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.msl */; };
60+
CECF83BD2FEF765400CB0CCA /* HelloCompute.comp.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.metal */; };
6161
CECF83BE2FEF765400CB0CCA /* HelloCompute.comp.spv in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AC2FEF712F00CB0CCA /* HelloCompute.comp.spv */; };
6262
CECF83BF2FEF765400CB0CCA /* HelloCompute.frag.glsl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AD2FEF712F00CB0CCA /* HelloCompute.frag.glsl */; };
63-
CECF83C02FEF765400CB0CCA /* HelloCompute.frag.msl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.msl */; };
63+
CECF83C02FEF765400CB0CCA /* HelloCompute.frag.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.metal */; };
6464
CECF83C12FEF765400CB0CCA /* HelloCompute.frag.spv in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83AF2FEF712F00CB0CCA /* HelloCompute.frag.spv */; };
6565
CECF83C22FEF765400CB0CCA /* HelloCompute.vert.glsl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83B02FEF712F00CB0CCA /* HelloCompute.vert.glsl */; };
66-
CECF83C32FEF765400CB0CCA /* HelloCompute.vert.msl in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.msl */; };
66+
CECF83C32FEF765400CB0CCA /* HelloCompute.vert.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.metal */; };
6767
CECF83C42FEF765400CB0CCA /* HelloCompute.vert.spv in CopyFiles */ = {isa = PBXBuildFile; fileRef = CECF83B22FEF712F00CB0CCA /* HelloCompute.vert.spv */; };
6868
CECF83C72FF03A3500CB0CCA /* Framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CECF83C52FF03A3500CB0CCA /* Framebuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
6969
CECF83C82FF03A3500CB0CCA /* Framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = CECF83C62FF03A3500CB0CCA /* Framebuffer.c */; };
@@ -77,8 +77,8 @@
7777
EE00160000000000000000B7 /* SDL3.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA000000000000000000EE01 /* SDL3.xcframework */; };
7878
EE00170000000000000000B8 /* Objectively.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEA0030000000000000000F0 /* Objectively.framework */; };
7979
EI00100000000000000000B1 /* Hello.c in Sources */ = {isa = PBXBuildFile; fileRef = EE00010000000000000000B1 /* Hello.c */; };
80-
EI00200000000000000000B1 /* Hello.frag.msl in Resources */ = {isa = PBXBuildFile; fileRef = CECF83A52FEF712F00CB0CCA /* Hello.frag.msl */; };
81-
EI00300000000000000000B1 /* Hello.vert.msl in Resources */ = {isa = PBXBuildFile; fileRef = CECF83A82FEF712F00CB0CCA /* Hello.vert.msl */; };
80+
EI00200000000000000000B1 /* Hello.frag.metal in Resources */ = {isa = PBXBuildFile; fileRef = CECF83A52FEF712F00CB0CCA /* Hello.frag.metal */; };
81+
EI00300000000000000000B1 /* Hello.vert.metal in Resources */ = {isa = PBXBuildFile; fileRef = CECF83A82FEF712F00CB0CCA /* Hello.vert.metal */; };
8282
EI00400000000000000000B4 /* SDL3.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA000000000000000000EE01 /* SDL3.xcframework */; };
8383
EI00700000000000000000B7 /* SDL3.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = AA000000000000000000EE01 /* SDL3.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
8484
F73340493879CD8034F99D51 /* ComputePass.c in Sources */ = {isa = PBXBuildFile; fileRef = ED8024CA4186E352C1EC4CA1 /* ComputePass.c */; };
@@ -119,20 +119,20 @@
119119
dstSubfolderSpec = 7;
120120
files = (
121121
CECF83B52FEF765400CB0CCA /* Hello.frag.glsl in CopyFiles */,
122-
CECF83B62FEF765400CB0CCA /* Hello.frag.msl in CopyFiles */,
122+
CECF83B62FEF765400CB0CCA /* Hello.frag.metal in CopyFiles */,
123123
CECF83B72FEF765400CB0CCA /* Hello.frag.spv in CopyFiles */,
124124
CECF83B82FEF765400CB0CCA /* Hello.vert.glsl in CopyFiles */,
125-
CECF83B92FEF765400CB0CCA /* Hello.vert.msl in CopyFiles */,
125+
CECF83B92FEF765400CB0CCA /* Hello.vert.metal in CopyFiles */,
126126
CECF83BA2FEF765400CB0CCA /* Hello.vert.spv in CopyFiles */,
127127
CECF83BB2FEF765400CB0CCA /* HelloCompute.c in CopyFiles */,
128128
CECF83BC2FEF765400CB0CCA /* HelloCompute.comp.glsl in CopyFiles */,
129-
CECF83BD2FEF765400CB0CCA /* HelloCompute.comp.msl in CopyFiles */,
129+
CECF83BD2FEF765400CB0CCA /* HelloCompute.comp.metal in CopyFiles */,
130130
CECF83BE2FEF765400CB0CCA /* HelloCompute.comp.spv in CopyFiles */,
131131
CECF83BF2FEF765400CB0CCA /* HelloCompute.frag.glsl in CopyFiles */,
132-
CECF83C02FEF765400CB0CCA /* HelloCompute.frag.msl in CopyFiles */,
132+
CECF83C02FEF765400CB0CCA /* HelloCompute.frag.metal in CopyFiles */,
133133
CECF83C12FEF765400CB0CCA /* HelloCompute.frag.spv in CopyFiles */,
134134
CECF83C22FEF765400CB0CCA /* HelloCompute.vert.glsl in CopyFiles */,
135-
CECF83C32FEF765400CB0CCA /* HelloCompute.vert.msl in CopyFiles */,
135+
CECF83C32FEF765400CB0CCA /* HelloCompute.vert.metal in CopyFiles */,
136136
CECF83C42FEF765400CB0CCA /* HelloCompute.vert.spv in CopyFiles */,
137137
);
138138
runOnlyForDeploymentPostprocessing = 0;
@@ -184,19 +184,19 @@
184184
CECF83972FEF6A7200CB0CCA /* Mathlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Mathlib.h; sourceTree = "<group>"; };
185185
CECF83A32FEF6F5B00CB0CCA /* Makefile.am */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.am; sourceTree = "<group>"; };
186186
CECF83A42FEF712F00CB0CCA /* Hello.frag.glsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = Hello.frag.glsl; sourceTree = "<group>"; };
187-
CECF83A52FEF712F00CB0CCA /* Hello.frag.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = Hello.frag.msl; sourceTree = "<group>"; };
187+
CECF83A52FEF712F00CB0CCA /* Hello.frag.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Hello.frag.metal; sourceTree = "<group>"; };
188188
CECF83A62FEF712F00CB0CCA /* Hello.frag.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = Hello.frag.spv; sourceTree = "<group>"; };
189189
CECF83A72FEF712F00CB0CCA /* Hello.vert.glsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = Hello.vert.glsl; sourceTree = "<group>"; };
190-
CECF83A82FEF712F00CB0CCA /* Hello.vert.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = Hello.vert.msl; sourceTree = "<group>"; };
190+
CECF83A82FEF712F00CB0CCA /* Hello.vert.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Hello.vert.metal; sourceTree = "<group>"; };
191191
CECF83A92FEF712F00CB0CCA /* Hello.vert.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = Hello.vert.spv; sourceTree = "<group>"; };
192192
CECF83AA2FEF712F00CB0CCA /* HelloCompute.comp.glsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.comp.glsl; sourceTree = "<group>"; };
193-
CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.comp.msl; sourceTree = "<group>"; };
193+
CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = HelloCompute.comp.metal; sourceTree = "<group>"; };
194194
CECF83AC2FEF712F00CB0CCA /* HelloCompute.comp.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelloCompute.comp.spv; sourceTree = "<group>"; };
195195
CECF83AD2FEF712F00CB0CCA /* HelloCompute.frag.glsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.frag.glsl; sourceTree = "<group>"; };
196-
CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.frag.msl; sourceTree = "<group>"; };
196+
CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = HelloCompute.frag.metal; sourceTree = "<group>"; };
197197
CECF83AF2FEF712F00CB0CCA /* HelloCompute.frag.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelloCompute.frag.spv; sourceTree = "<group>"; };
198198
CECF83B02FEF712F00CB0CCA /* HelloCompute.vert.glsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.vert.glsl; sourceTree = "<group>"; };
199-
CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.msl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HelloCompute.vert.msl; sourceTree = "<group>"; };
199+
CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = HelloCompute.vert.metal; sourceTree = "<group>"; };
200200
CECF83B22FEF712F00CB0CCA /* HelloCompute.vert.spv */ = {isa = PBXFileReference; lastKnownFileType = file; path = HelloCompute.vert.spv; sourceTree = "<group>"; };
201201
CECF83C52FF03A3500CB0CCA /* Framebuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Framebuffer.h; sourceTree = "<group>"; };
202202
CECF83C62FF03A3500CB0CCA /* Framebuffer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Framebuffer.c; sourceTree = "<group>"; };
@@ -356,20 +356,20 @@
356356
children = (
357357
EE00010000000000000000B1 /* Hello.c */,
358358
CECF83A42FEF712F00CB0CCA /* Hello.frag.glsl */,
359-
CECF83A52FEF712F00CB0CCA /* Hello.frag.msl */,
359+
CECF83A52FEF712F00CB0CCA /* Hello.frag.metal */,
360360
CECF83A62FEF712F00CB0CCA /* Hello.frag.spv */,
361361
CECF83A72FEF712F00CB0CCA /* Hello.vert.glsl */,
362-
CECF83A82FEF712F00CB0CCA /* Hello.vert.msl */,
362+
CECF83A82FEF712F00CB0CCA /* Hello.vert.metal */,
363363
CECF83A92FEF712F00CB0CCA /* Hello.vert.spv */,
364364
EE00020000000000000000B2 /* HelloCompute.c */,
365365
CECF83AA2FEF712F00CB0CCA /* HelloCompute.comp.glsl */,
366-
CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.msl */,
366+
CECF83AB2FEF712F00CB0CCA /* HelloCompute.comp.metal */,
367367
CECF83AC2FEF712F00CB0CCA /* HelloCompute.comp.spv */,
368368
CECF83AD2FEF712F00CB0CCA /* HelloCompute.frag.glsl */,
369-
CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.msl */,
369+
CECF83AE2FEF712F00CB0CCA /* HelloCompute.frag.metal */,
370370
CECF83AF2FEF712F00CB0CCA /* HelloCompute.frag.spv */,
371371
CECF83B02FEF712F00CB0CCA /* HelloCompute.vert.glsl */,
372-
CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.msl */,
372+
CECF83B12FEF712F00CB0CCA /* HelloCompute.vert.metal */,
373373
CECF83B22FEF712F00CB0CCA /* HelloCompute.vert.spv */,
374374
EI00020000000000000000B2 /* Info.plist */,
375375
EI00030000000000000000B3 /* LaunchScreen.storyboard */,
@@ -519,8 +519,8 @@
519519
isa = PBXResourcesBuildPhase;
520520
buildActionMask = 2147483647;
521521
files = (
522-
EI00200000000000000000B1 /* Hello.frag.msl in Resources */,
523-
EI00300000000000000000B1 /* Hello.vert.msl in Resources */,
522+
EI00200000000000000000B1 /* Hello.frag.metal in Resources */,
523+
EI00300000000000000000B1 /* Hello.vert.metal in Resources */,
524524
);
525525
runOnlyForDeploymentPostprocessing = 0;
526526
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ make shaders
5555
This runs:
5656
```
5757
glslc -fshader-stage=<stage> Shader.glsl -o Shader.spv
58-
shadercross Shader.spv -s SPIRV -d MSL -t <stage> -o Shader.msl
58+
shadercross Shader.spv -s SPIRV -d MSL -t <stage> -o Shader.metal
5959
```
6060

6161
### GLSL binding layout (SDL3 GPU descriptor set convention)

Sources/ObjectivelyGPU/ComputePipeline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static ComputePipeline *initWithResource(ComputePipeline *self, RenderDevice *de
8484
SDL_GPUShaderFormat format;
8585
const char *ext;
8686
} formats[] = {
87-
{ SDL_GPU_SHADERFORMAT_MSL, ".msl" },
87+
{ SDL_GPU_SHADERFORMAT_MSL, ".metal" },
8888
{ SDL_GPU_SHADERFORMAT_DXIL, ".dxil" },
8989
{ SDL_GPU_SHADERFORMAT_SPIRV,".spv" },
9090
};

Sources/ObjectivelyGPU/ComputePipeline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct ComputePipelineInterface {
102102
* @brief Initializes this ComputePipeline from a compiled blob loaded via the Resource system.
103103
* @details Appends the platform-appropriate extension to @p name and resolves it via
104104
* Objectively's ResourceProvider chain:
105-
* - Metal (macOS/iOS): `.msl`
105+
* - Metal (macOS/iOS): `.metal`
106106
* - Vulkan (Linux/Android): `.spv`
107107
* - D3D12 (Windows): `.dxil`
108108
* The caller fills in @c entrypoint, thread counts, and binding counts in @p info;

0 commit comments

Comments
 (0)