Skip to content

Instantly share code, notes, and snippets.

@djg
Created May 8, 2013 04:47
Show Gist options
  • Select an option

  • Save djg/5538261 to your computer and use it in GitHub Desktop.

Select an option

Save djg/5538261 to your computer and use it in GitHub Desktop.
@ECHO OFF
rem Recompile PS3 shaders from ps3.cg into shader.ps3 for all techniques.
SET CGC=c:\dev\cyclone\Main\Target\win32\runtime\sce-cgc.exe
SET CGNVTOCGB=c:\dev\cyclone\Main\Target\win32\runtime\cgnv2cgbLevelC.exe
SET CONCAT=c:\dev\cyclone\Main\Target\win32\runtime\CompilePS3Shaders_release
attrib -r shader.ps3
DEL /Q *.fp *.fpo *.vp *.vpo shader.ps3
IF EXIST ps3.techniques (
call:CompileTechniquesShader
) ELSE (
call:CompileBasicShader
)
DEL /Q *.vpo *.fpo
goto:eof
:CompileBasicShader
rem ECHO Compile Basic Shader
call:CompileVertexShader VSmain 0
call:CompileFragmentShader PSmain 0
call:CompileVertexShader VSprepass 1
call:CompileFragmentShader PSprepass 1
%CONCAT% ps3.cgb.0.vpo ps3.cgb.0.fpo ps3.cgb.1.vpo ps3.cgb.1.fpo shader.ps3
goto:eof
:CompileTechniquesShader
rem ECHO Compile Techniques Shader
setlocal
setlocal ENABLEDELAYEDEXPANSION
SET /A C=0
FOR /F "tokens=1-2" %%A IN (ps3.techniques) DO (
call:CompileVertexShader %%A !C!
SET FILELIST=!FILELIST! ps3.cgb.!C!.vpo
call:CompileFragmentShader %%B !C!
SET FILELIST=!FILELIST! ps3.cgb.!C!.fpo
SET /A C=C+1
)
%CONCAT% %FILELIST% shader.ps3
endlocal
goto:eof
:CompileVertexShader
SETLOCAL
SET NVFILE=ps3.nv.%2.vpo
SET CGBFILE=ps3.cgb.%2.vpo
%CGC% -q -p sce_vp_rsx -e %1 -o %NVFILE% ps3.cg
%CGNVTOCGB% %NVFILE% %CGBFILE%
DEL %NVFILE%
ENDLOCAL
goto:eof
:CompileFragmentShader
SETLOCAL
SET NVFILE=ps3.nv.%2.fpo
SET CGBFILE=ps3.cgb.%2.fpo
%CGC% -q -p sce_fp_rsx -e %1 -o %NVFILE% ps3.cg
%CGNVTOCGB% %NVFILE% %CGBFILE%
DEL %NVFILE%
ENDLOCAL
goto:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment