Pārlūkot izejas kodu

SDL_GPU backend: Tweak compile shader script and SDL_shadercross license

Michael Ragazzon 4 mēneši atpakaļ
vecāks
revīzija
9772d48f00

+ 7 - 7
Backends/RmlUi_SDL_GPU/SDL_shadercross/LICENSE.txt

@@ -1,15 +1,16 @@
-The SDL GPU backend for RmlUi includes the third-party dependency:
+The SDL GPU backend for RmlUi uses the following third-party tool to generate
+the included shader binaries:
 
 SDL_shadercross
 https://github.com/libsdl-org/SDL_shadercross
 
-This dependency is located in the directory 'SDL_shadercross' and is licensed
-separately from Rmlui. The license of this dependency is recited below.
+This tool is licensed separately from Rmlui. The license of this dependency
+is recited below.
 
 ----
 
 Copyright (C) 2024 Sam Lantinga <[email protected]>
-  
+
 This software is provided 'as-is', without any express or implied
 warranty.  In no event will the authors be held liable for any damages
 arising from the use of this software.
@@ -17,12 +18,11 @@ arising from the use of this software.
 Permission is granted to anyone to use this software for any purpose,
 including commercial applications, and to alter it and redistribute it
 freely, subject to the following restrictions:
-  
+
 1. The origin of this software must not be misrepresented; you must not
    claim that you wrote the original software. If you use this software
    in a product, an acknowledgment in the product documentation would be
-   appreciated but is not required. 
+   appreciated but is not required.
 2. Altered source versions must be plainly marked as such, and must not be
    misrepresented as being the original software.
 3. This notice may not be removed or altered from any source distribution.
-

+ 12 - 5
Backends/RmlUi_SDL_GPU/compile_shaders.py

@@ -27,16 +27,23 @@ import sys
 import os
 import subprocess
 
-# Compiles all .frag and .vert files in this directory to SPIR-V, MSL, and DXIL binary C character arrays
+# Compiles all .frag and .vert files in this directory to SPIR-V, MSL, and DXIL binary C character arrays.
+#
+# Requires the SDL_shadercross tool. Binaries can be found here: https://github.com/libsdl-org/SDL_shadercross/actions
+# Click on the latest workflow and download them for the platform of your choice.
+
+if len(sys.argv) < 2:
+    print("Usage: python compile_shaders.py <shadercross_path>")
+    sys.exit(1)
 
 out_file = "ShadersCompiledSPV.h"
 
 current_dir = os.path.dirname(os.path.realpath(__file__));
+shadercross_path = os.path.realpath(sys.argv[1])
 
-# The SDL_shadercross binaries can be found here: https://github.com/libsdl-org/SDL_shadercross/actions
-# Click on the latest workflow and download them for the platform of your choice.
-# Set the path to the shadercross executable (shadercross.exe) below.
-shadercross_path = ""
+if not os.path.isfile(shadercross_path):
+    print(f"Error: The specified shadercross path '{shadercross_path}' does not exist.")
+    sys.exit(1)
 
 out_path = os.path.join(current_dir, out_file)