@echo off rem Input parameters set versionShader=%~1 set entry=%~2 set inputPath=%~3 set inputFileName=%~4 set outputPath=%~5 set outputFileName=%~6 set defineMacros=%~7 rem Full Path Files set inputFile=%inputPath%/%inputFileName% set outputFile=%outputPath%/%outputFileName%.gsh set tmpFxFile=%outputPath%/tmp/%outputFileName%.fx set tmpGlslFile=%outputPath%/glsl/%outputFileName%.glsl rem Define Macros Preprocessing : FROM inputFile TO tmpFxFile call "%VS90COMNTOOLS%vsvars32.bat" > nul cl.exe %defineMacros% /EP "%inputFile%" > "%tmpFxFile%" 2> nul rem Conversion HLSL TO GLSL : FROM tmpFxFile TO tmpGlslFile rem -u = use Varying rem -x = use Explicit Attributes rem -b = use Uniform Binding if "%versionShader%"=="pixel" ( %~dp0\hlsl2glsl.exe -x -b -f "%entry%" -if "%tmpFxFile%" -of "%tmpGlslFile%" 2> nul ) else ( %~dp0\hlsl2glsl.exe -x -b -v "%entry%" -iv "%tmpFxFile%" -ov "%tmpGlslFile%" 2> nul ) rem GLSL Compilation : FROM tmpGlslFile TO outputFile if "%CAFE_ROOT%"=="" set CAFE_ROOT=C:\cafe_sdk if "%versionShader%"=="pixel" ( "%CAFE_ROOT%\system\bin\win32\gshCompile.exe" -p "%tmpGlslFile%" -o "%outputFile%" 2> nul ) else ( "%CAFE_ROOT%\system\bin\win32\gshCompile.exe" -v "%tmpGlslFile%" -o "%outputFile%" 2> nul ) rem DONE exit