Skip to content

Commit

Permalink
Fix entrypoint encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Oct 28, 2024
1 parent e6035a6 commit d02570a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/SDL_gpu_shadercross.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,17 @@ static void *SDL_ShaderCross_INTERNAL_CompileUsingDXC(
bool spirv,
size_t *size) // filled in with number of bytes of returned buffer
{
if (SDL_strstr(shaderProfile, "5_0")) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", "Cannot use Shader Model 5 with DXC!");
return NULL;
}

DxcBuffer source;
IDxcResult *dxcResult;
IDxcBlob *blob;
IDxcBlobUtf8 *errors;
size_t entryPointLength = SDL_utf8strlen(entrypoint) + 1;
const char *entryPointUtf16 = SDL_iconv_string("UTF-16", "UTF-8", entrypoint, entryPointLength);
wchar_t *entryPointUtf16 = (wchar_t *)SDL_iconv_string("WCHAR_T", "UTF-8", entrypoint, entryPointLength);
LPCWSTR args[] = {
(LPCWSTR)L"-E",
(LPCWSTR)entryPointUtf16,
Expand Down
4 changes: 4 additions & 0 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ int main(int argc, char *argv[])
entrypointName,
profileName,
&bytecodeSize);
if (spirv == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", "Failed to compile SPIR-V!");
return 1;
}
char *buffer = SDL_ShaderCross_TranspileMSLFromSPIRV(
spirv,
bytecodeSize,
Expand Down

0 comments on commit d02570a

Please sign in to comment.