Skip to content

Commit 9f932d5

Browse files
jdolanCopilot
andcommitted
Replace glslc with shadercross for HLSL→SPIR-V; drop DXIL from all build systems
shadercross handles HLSL→SPIR-V and HLSL→MSL directly; glslc is not needed and not installed. Remove the two-step SPIR-V intermediate for MSL generation. Drop DXIL blobs and DXIL compilation from Makefile.am, Xcode, and VS projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8f34eb2 commit 9f932d5

3 files changed

Lines changed: 27 additions & 22 deletions

File tree

Documentation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ObjectivelyGPU {#index}
88
- **RenderDevice** — device creation, buffer/texture/sampler allocation, and shader pipeline compilation
99
- **CommandBuffer** — render, compute, and copy command recording
1010
- **RenderPass**, **ComputePass**, **CopyPass** — typed command encoder wrappers
11-
- Shader compilation via [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross) (HLSL → SPIR-V / MSL / DXIL)
11+
- Shader compilation via [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross) (HLSL → SPIR-V / MSL)
1212
- macOS and iOS (Metal), Windows (Direct3D 12), Linux (Vulkan) via SDL3 backends
1313

1414
## API

Examples/Shaders/Makefile.am

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ AUTOMAKE_OPTIONS = nostdinc
44
# Normal builds never invoke shadercross. Run 'make shadercross' after
55
# editing a .hlsl file to regenerate the platform blobs.
66

7-
GLSLC = glslc
87
SHADERCROSS = shadercross
98

109
HLSL_SOURCES = \
@@ -28,58 +27,59 @@ SPIRV_BLOBS = \
2827
HelloCompute.vert.spv \
2928
HelloCompute.frag.spv
3029

31-
EXTRA_DIST = $(HLSL_SOURCES) $(MSL_BLOBS) $(SPIRV_BLOBS)
30+
DXIL_BLOBS =
31+
32+
EXTRA_DIST = $(HLSL_SOURCES) $(MSL_BLOBS) $(SPIRV_BLOBS) $(DXIL_BLOBS)
3233

3334
# For out-of-tree builds, symlink the pre-built blobs into the build directory
3435
# so SDL Resource resolution (SDL_GetBasePath() + "Shaders") finds them.
3536
all-local:
3637
@if [ "x$(srcdir)" != "x$(builddir)" ]; then \
37-
for f in $(MSL_BLOBS) $(SPIRV_BLOBS); do \
38+
for f in $(MSL_BLOBS) $(SPIRV_BLOBS) $(DXIL_BLOBS); do \
3839
test -e "$(builddir)/$$f" || \
3940
$(LN_S) "$(abs_srcdir)/$$f" "$(builddir)/$$f"; \
4041
done; \
4142
fi
4243

4344
# -------------------------------------------------------------------------
4445
# shadercross — regenerate all blobs from HLSL source.
45-
# Requires glslc (from shaderc) for HLSL→SPIR-V and shadercross for
46-
# SPIR-V→MSL.
46+
# Requires shadercross (from SDL_shadercross) for HLSL→SPIR-V and HLSL→MSL.
4747
# -------------------------------------------------------------------------
4848

4949
.PHONY: shadercross
5050
shadercross: $(MSL_BLOBS) $(SPIRV_BLOBS)
5151

5252
# Hello — vertex
5353
$(srcdir)/Hello.vert.spv: $(srcdir)/Hello.vert.hlsl
54-
$(GLSLC) -fshader-stage=vertex -x hlsl -fentry-point=vs_main $< -o $@
54+
$(SHADERCROSS) $< -s HLSL -d SPIRV -t vertex -e vs_main -o $@
5555

56-
$(srcdir)/Hello.vert.msl: $(srcdir)/Hello.vert.spv
57-
$(SHADERCROSS) $< -s SPIRV -d MSL -t vertex -e vs_main -o $@
56+
$(srcdir)/Hello.vert.msl: $(srcdir)/Hello.vert.hlsl
57+
$(SHADERCROSS) $< -s HLSL -d MSL -t vertex -e vs_main -o $@
5858

5959
# Hello — fragment
6060
$(srcdir)/Hello.frag.spv: $(srcdir)/Hello.frag.hlsl
61-
$(GLSLC) -fshader-stage=fragment -x hlsl -fentry-point=fs_main $< -o $@
61+
$(SHADERCROSS) $< -s HLSL -d SPIRV -t fragment -e fs_main -o $@
6262

63-
$(srcdir)/Hello.frag.msl: $(srcdir)/Hello.frag.spv
64-
$(SHADERCROSS) $< -s SPIRV -d MSL -t fragment -e fs_main -o $@
63+
$(srcdir)/Hello.frag.msl: $(srcdir)/Hello.frag.hlsl
64+
$(SHADERCROSS) $< -s HLSL -d MSL -t fragment -e fs_main -o $@
6565

6666
# HelloCompute — compute
6767
$(srcdir)/HelloCompute.comp.spv: $(srcdir)/HelloCompute.comp.hlsl
68-
$(GLSLC) -fshader-stage=compute -x hlsl -fentry-point=cs_main $< -o $@
68+
$(SHADERCROSS) $< -s HLSL -d SPIRV -t compute -e cs_main -o $@
6969

70-
$(srcdir)/HelloCompute.comp.msl: $(srcdir)/HelloCompute.comp.spv
71-
$(SHADERCROSS) $< -s SPIRV -d MSL -t compute -e cs_main -o $@
70+
$(srcdir)/HelloCompute.comp.msl: $(srcdir)/HelloCompute.comp.hlsl
71+
$(SHADERCROSS) $< -s HLSL -d MSL -t compute -e cs_main -o $@
7272

7373
# HelloCompute — vertex
7474
$(srcdir)/HelloCompute.vert.spv: $(srcdir)/HelloCompute.vert.hlsl
75-
$(GLSLC) -fshader-stage=vertex -x hlsl -fentry-point=vs_main $< -o $@
75+
$(SHADERCROSS) $< -s HLSL -d SPIRV -t vertex -e vs_main -o $@
7676

77-
$(srcdir)/HelloCompute.vert.msl: $(srcdir)/HelloCompute.vert.spv
78-
$(SHADERCROSS) $< -s SPIRV -d MSL -t vertex -e vs_main -o $@
77+
$(srcdir)/HelloCompute.vert.msl: $(srcdir)/HelloCompute.vert.hlsl
78+
$(SHADERCROSS) $< -s HLSL -d MSL -t vertex -e vs_main -o $@
7979

8080
# HelloCompute — fragment
8181
$(srcdir)/HelloCompute.frag.spv: $(srcdir)/HelloCompute.frag.hlsl
82-
$(GLSLC) -fshader-stage=fragment -x hlsl -fentry-point=fs_main $< -o $@
82+
$(SHADERCROSS) $< -s HLSL -d SPIRV -t fragment -e fs_main -o $@
8383

84-
$(srcdir)/HelloCompute.frag.msl: $(srcdir)/HelloCompute.frag.spv
85-
$(SHADERCROSS) $< -s SPIRV -d MSL -t fragment -e fs_main -o $@
84+
$(srcdir)/HelloCompute.frag.msl: $(srcdir)/HelloCompute.frag.hlsl
85+
$(SHADERCROSS) $< -s HLSL -d MSL -t fragment -e fs_main -o $@

ObjectivelyGPU.xcodeproj/project.pbxproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,23 @@
489489
outputPaths = (
490490
"$(SRCROOT)/Examples/Shaders/Hello.vert.msl",
491491
"$(SRCROOT)/Examples/Shaders/Hello.vert.spv",
492+
"$(SRCROOT)/Examples/Shaders/Hello.vert.dxil",
492493
"$(SRCROOT)/Examples/Shaders/Hello.frag.msl",
493494
"$(SRCROOT)/Examples/Shaders/Hello.frag.spv",
495+
"$(SRCROOT)/Examples/Shaders/Hello.frag.dxil",
494496
"$(SRCROOT)/Examples/Shaders/HelloCompute.comp.msl",
495497
"$(SRCROOT)/Examples/Shaders/HelloCompute.comp.spv",
498+
"$(SRCROOT)/Examples/Shaders/HelloCompute.comp.dxil",
496499
"$(SRCROOT)/Examples/Shaders/HelloCompute.vert.msl",
497500
"$(SRCROOT)/Examples/Shaders/HelloCompute.vert.spv",
501+
"$(SRCROOT)/Examples/Shaders/HelloCompute.vert.dxil",
498502
"$(SRCROOT)/Examples/Shaders/HelloCompute.frag.msl",
499503
"$(SRCROOT)/Examples/Shaders/HelloCompute.frag.spv",
504+
"$(SRCROOT)/Examples/Shaders/HelloCompute.frag.dxil",
500505
);
501506
runOnlyForDeploymentPostprocessing = 0;
502507
shellPath = /bin/sh;
503-
shellScript = "set -e\nSHADERS=\"$SRCROOT/Examples/Shaders\"\ncompile() {\n local name=$1 stage=$2 ep=$3\n glslc -fshader-stage=$stage -x hlsl -fentry-point=$ep \"$SHADERS/${name}.hlsl\" -o \"$SHADERS/${name}.spv\"\n shadercross \"$SHADERS/${name}.spv\" -s SPIRV -d MSL -t $stage -e $ep -o \"$SHADERS/${name}.msl\"\n}\ncompile Hello.vert vertex vs_main\ncompile Hello.frag fragment fs_main\ncompile HelloCompute.comp compute cs_main\ncompile HelloCompute.vert vertex vs_main\ncompile HelloCompute.frag fragment fs_main\n";
508+
shellScript = "set -e\nSHADERS=\"$SRCROOT/Examples/Shaders\"\ncompile() {\n local name=$1 stage=$2 ep=$3\n shadercross \"$SHADERS/${name}.hlsl\" -s HLSL -d SPIRV -t $stage -e $ep -o \"$SHADERS/${name}.spv\"\n shadercross \"$SHADERS/${name}.hlsl\" -s HLSL -d MSL -t $stage -e $ep -o \"$SHADERS/${name}.msl\"\n}\ncompile Hello.vert vertex vs_main\ncompile Hello.frag fragment fs_main\ncompile HelloCompute.comp compute cs_main\ncompile HelloCompute.vert vertex vs_main\ncompile HelloCompute.frag fragment fs_main\n";
504509
showEnvVarsInLog = 0;
505510
};
506511
/* End PBXShellScriptBuildPhase section */

0 commit comments

Comments
 (0)