ARB Patcher: fix up some info about inlining vars in comments, improve UNUSED_PARAM_REGEX
This commit is contained in:
@@ -10,6 +10,7 @@ def patch_shader(fname, f_lines, game_settings_module=None, enable_print_warning
|
||||
params = {}
|
||||
|
||||
for i in range(0, len(f_lines)):
|
||||
# this inlining stuff is only really needed for vp, but :shrug:
|
||||
no_repl = False
|
||||
|
||||
m = ATTRIB_REGEX.match(f_lines[i])
|
||||
@@ -26,6 +27,7 @@ def patch_shader(fname, f_lines, game_settings_module=None, enable_print_warning
|
||||
no_repl = True
|
||||
m = OUTPUT_REGEX.match(f_lines[i])
|
||||
|
||||
# and not needed at all for PARAMs in the end, but :shrug: again
|
||||
m = PARAM_REGEX.match(f_lines[i])
|
||||
while m:
|
||||
params[m.group(3)] = m.group(4)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# regexes and config info is stored here to reduce clutter in main script
|
||||
from re import compile as recompile
|
||||
|
||||
# inline these because... idk exactly
|
||||
# inline these because... idk
|
||||
# ATTRIB and OUTPUT must be inlined for vp tho
|
||||
ATTRIB_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?ATTRIB\s*?([^\[\]\s]*?)\s*?=\s*?([^\s].*?);)\s*")
|
||||
OUTPUT_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?OUTPUT\s*?([^\[\]\s]*?)\s*?=\s*?([^\s].*?);)\s*")
|
||||
PARAM_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?PARAM\s*?([^\[\]\s]*?)\s*?=\s*?([^\s].*?);)\s*") # (params because of limit)
|
||||
PARAM_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?PARAM\s*?([^\[\]\s]*?)\s*?=\s*?([^\s].*?);)\s*")
|
||||
|
||||
# help reduce param count more by commenting out unused ones that weren't inlined (array params can't be inlined)
|
||||
UNUSED_PARAM_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?PARAM\s*?([^\[\]\s]*?)(\s*?\[.*?\])?\s*?=\s*?([^\s].*?);)\s*(?![\s\S]*[\s\-{]\3[\s,;\[])")
|
||||
UNUSED_PARAM_REGEX = recompile(r"(?<!#)(?<!#\s)((SHORT\s*?|LONG\s*?)?PARAM\s*?([^\[\]\s]*?)(\s*?\[.*?\])?\s*?=\s*?([^\s].*?);)\s*(?![\s\S]*[\s\-\+{]\3[\s,;\.\-\+\[])")
|
||||
|
||||
# I think some of these instructions might still be left after other patches.. they will be commented out
|
||||
BAD_INSTR_REGEX = recompile(r"((?<!#)(?<!#\s)(CVT|BUFFER4|POW|NRM|REP)\s+?.*?;|ENDREP;|[^;\n]*\s*?(p_coef2d\[idx.x\]).*?;)\s*")
|
||||
|
||||
Reference in New Issue
Block a user