mirror of
https://github.com/libretro/RetroArch
synced 2025-01-17 01:16:25 +00:00
Fix NTSC shaders by preprocessing first.
If vertex shader is in an #include, it wouldn't get column_major fix applied.
This commit is contained in:
parent
fa39a1ec39
commit
4627c106e4
@ -546,11 +546,19 @@ def preprocess_vertex(source_data):
|
||||
return '\n'.join(ret)
|
||||
|
||||
def convert(source, dest):
|
||||
vert_cmd = ['cgc', '-profile', 'glesv', '-entry', 'main_vertex', '-quiet', '-I', os.path.split(source)[0]]
|
||||
with open(source, 'r') as f:
|
||||
source_data = f.read()
|
||||
# Have to preprocess first to resolve #includes so we can hack potential vertex shaders.
|
||||
vert_cmd_preprocess = ['cgc', '-E', '-I', os.path.split(source)[0], source]
|
||||
p = subprocess.Popen(vert_cmd_preprocess, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
|
||||
source_data, stderr_ret = p.communicate()
|
||||
log(stderr_ret.decode())
|
||||
|
||||
if p.returncode != 0:
|
||||
log('Vertex preprocessing failed ...')
|
||||
|
||||
source_data = preprocess_vertex(source_data.decode())
|
||||
|
||||
vert_cmd = ['cgc', '-profile', 'glesv', '-entry', 'main_vertex', '-quiet']
|
||||
p = subprocess.Popen(vert_cmd, stdin = subprocess.PIPE, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
|
||||
source_data = preprocess_vertex(source_data)
|
||||
vertex_source, stderr_ret = p.communicate(input = source_data.encode())
|
||||
log(stderr_ret.decode())
|
||||
vertex_source = vertex_source.decode()
|
||||
@ -559,9 +567,9 @@ def convert(source, dest):
|
||||
log('Vertex compilation failed ...')
|
||||
return 1
|
||||
|
||||
frag_cmd = ['cgc', '-profile', 'glesf', '-entry', 'main_fragment', '-quiet', source]
|
||||
p = subprocess.Popen(frag_cmd, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
|
||||
fragment_source, stderr_ret = p.communicate()
|
||||
frag_cmd = ['cgc', '-profile', 'glesf', '-entry', 'main_fragment', '-quiet']
|
||||
p = subprocess.Popen(frag_cmd, stdin = subprocess.PIPE, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
|
||||
fragment_source, stderr_ret = p.communicate(input = source_data.encode())
|
||||
log(stderr_ret.decode())
|
||||
fragment_source = fragment_source.decode()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user