Shader CRT-Pi alternatiu en pipeline separat; selecció via config + presets (v0.6.0)
This commit is contained in:
1 parent
26b4d9e610
commit
ce5bec1b34
16 files changed
+11205
-8
No files matched your search
@@ -17,12 +17,21 @@ cmake_policy(SET CMP0007 NEW)
|
||||
set(SHADER_SOURCES
|
||||
"postfx.vert"
|
||||
"postfx.frag"
|
||||
"crtpi_frag.glsl"
|
||||
)
|
||||
|
||||
# Nom de la variable C++ per a cada shader (mateix ordre)
|
||||
set(SHADER_VARS
|
||||
"kpostfx_vert_spv"
|
||||
"kpostfx_frag_spv"
|
||||
"kcrtpi_frag_spv"
|
||||
)
|
||||
|
||||
# Flags extra per a cada shader (vacío si cap)
|
||||
set(SHADER_FLAGS
|
||||
""
|
||||
""
|
||||
"-fshader-stage=frag"
|
||||
)
|
||||
|
||||
list(LENGTH SHADER_SOURCES NUM_SHADERS)
|
||||
@@ -31,6 +40,7 @@ math(EXPR LAST_IDX "${NUM_SHADERS} - 1")
|
||||
foreach(IDX RANGE ${LAST_IDX})
|
||||
list(GET SHADER_SOURCES ${IDX} SRC_NAME)
|
||||
list(GET SHADER_VARS ${IDX} VAR)
|
||||
list(GET SHADER_FLAGS ${IDX} EXTRA_FLAG)
|
||||
|
||||
# Derivem el nom del header a partir de la variable: kpostfx_vert_spv → postfx_vert_spv.h
|
||||
string(REGEX REPLACE "^k" "" HDR_BASE "${VAR}")
|
||||
@@ -40,11 +50,19 @@ foreach(IDX RANGE ${LAST_IDX})
|
||||
|
||||
message(STATUS "Compilant ${SRC} ...")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GLSLC}" "${SRC}" -o "${SPV}"
|
||||
RESULT_VARIABLE GLSLC_RESULT
|
||||
ERROR_VARIABLE GLSLC_ERROR
|
||||
)
|
||||
if(EXTRA_FLAG)
|
||||
execute_process(
|
||||
COMMAND "${GLSLC}" "${EXTRA_FLAG}" "${SRC}" -o "${SPV}"
|
||||
RESULT_VARIABLE GLSLC_RESULT
|
||||
ERROR_VARIABLE GLSLC_ERROR
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND "${GLSLC}" "${SRC}" -o "${SPV}"
|
||||
RESULT_VARIABLE GLSLC_RESULT
|
||||
ERROR_VARIABLE GLSLC_ERROR
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT GLSLC_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "glslc ha fallat per a ${SRC}:\n${GLSLC_ERROR}")
|
||||
|
||||
Reference in new issue
Block a user