Source

love-openzdk / build_utils / bldshader.cmd

Full commit
@echo off

setlocal
set CGC="%NV_WINCE_T2_PLAT%\host_bin\cgc.exe"
set SHADERFIX="%NV_WINCE_T2_PLAT%\host_bin\shaderfix.exe"
set HEXIFY="%~dp0\hexify.pl"
set INFILE=%~f1
set INDIR=%~dp1
set INBASE=%~dpn1
if "%~x1"==".vp" call :vertex
if "%~x1"==".fp" call :fragment
del "%INDIR%\*.cgbin" 2>nul
del "%INDIR%\*.ar20bin" 2>nul
endlocal
goto :eof

:vertex

%CGC% -profile ar20vp -O3 -ogles -strict -glslWerror -o "%INBASE%.cgbin" "%INFILE%"
if errorlevel 1 goto :eof
%SHADERFIX% -o "%INBASE%.ar20bin" "%INBASE%.cgbin"
if errorlevel 1 goto :eof
%HEXIFY% "%INBASE%.ar20bin" > "%INBASE%.v.tegra.hex"
%HEXIFY% "%INBASE%.vp" > "%INBASE%.v.src.hex"
goto :eof

:fragment

REM Binary (alpha blending)

set BLENDMODE=gl_FragColor,GL_FUNC_ADD,GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA
%CGC% -profile ar20fp -O3 -ogles -strict -glslWerror -po -blendoperation,%BLENDMODE% -o "%INBASE%_alpha.cgbin" "%INFILE%"
if errorlevel 1 goto :eof
%SHADERFIX% -o "%INBASE%_alpha.ar20bin" "%INBASE%_alpha.cgbin"
if errorlevel 1 goto :eof
%HEXIFY% "%INBASE%_alpha.ar20bin" > "%INBASE%.f.alpha.tegra.hex"

REM Binary (additive blending)

set BLENDMODE=gl_FragColor,GL_FUNC_ADD,GL_SRC_ALPHA,GL_ONE
%CGC% -profile ar20fp -O3 -ogles -strict -glslWerror -po -blendoperation,%BLENDMODE% -o "%INBASE%_additive.cgbin" "%INFILE%" 2> nul
if errorlevel 1 goto :eof
%SHADERFIX% -o "%INBASE%_additive.ar20bin" "%INBASE%_additive.cgbin"
if errorlevel 1 goto :eof
%HEXIFY% "%INBASE%_additive.ar20bin" > "%INBASE%.f.additive.tegra.hex"

REM Binary (subtractive blending)

set BLENDMODE=gl_FragColor,GL_FUNC_REVERSE_SUBTRACT,GL_SRC_ALPHA,GL_ONE
%CGC% -profile ar20fp -O3 -ogles -strict -glslWerror -po -blendoperation,%BLENDMODE% -o "%INBASE%_subtractive.cgbin" "%INFILE%" 2> nul
if errorlevel 1 goto :eof
%SHADERFIX% -o "%INBASE%_subtractive.ar20bin" "%INBASE%_subtractive.cgbin"
if errorlevel 1 goto :eof
%HEXIFY% "%INBASE%_subtractive.ar20bin" > "%INBASE%.f.subtractive.tegra.hex"

REM Binary (multiplicative blending)

set BLENDMODE=gl_FragColor,GL_FUNC_ADD,GL_DST_COLOR,GL_ONE_MINUS_SRC_ALPHA
%CGC% -profile ar20fp -O3 -ogles -strict -glslWerror -po -blendoperation,%BLENDMODE% -o "%INBASE%_multiplicative.cgbin" "%INFILE%" 2> nul
if errorlevel 1 goto :eof
%SHADERFIX% -o "%INBASE%_multiplicative.ar20bin" "%INBASE%_multiplicative.cgbin"
if errorlevel 1 goto :eof
%HEXIFY% "%INBASE%_multiplicative.ar20bin" > "%INBASE%.f.multiplicative.tegra.hex"

REM Source

%HEXIFY% "%INBASE%.fp" > "%INBASE%.f.any.src.hex"

goto :eof