Allow multiple color attachment formats
This commit is contained in:
parent
df6346c1d1
commit
b0cd02d68e
|
@ -9,7 +9,7 @@
|
||||||
"texture_params": [],
|
"texture_params": [],
|
||||||
"vertex_shader": "../include/pass.vert.glsl",
|
"vertex_shader": "../include/pass.vert.glsl",
|
||||||
"fragment_shader": "clear_pass.frag.glsl",
|
"fragment_shader": "clear_pass.frag.glsl",
|
||||||
"color_attachment": "_HDR"
|
"color_attachments": ["_HDR"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@
|
||||||
],
|
],
|
||||||
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
||||||
"fragment_shader": "deferred_light.frag.glsl",
|
"fragment_shader": "deferred_light.frag.glsl",
|
||||||
"color_attachment": "RGBA64"
|
"color_attachments": ["RGBA64"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
],
|
],
|
||||||
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
"vertex_shader": "../include/pass_viewray.vert.glsl",
|
||||||
"fragment_shader": "deferred_light.frag.glsl",
|
"fragment_shader": "deferred_light.frag.glsl",
|
||||||
"color_attachment": "RGBA64"
|
"color_attachments": ["RGBA64"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"links": [],
|
"links": [],
|
||||||
"vertex_shader": "../include/pass.vert.glsl",
|
"vertex_shader": "../include/pass.vert.glsl",
|
||||||
"fragment_shader": "deferred_light.frag.glsl",
|
"fragment_shader": "deferred_light.frag.glsl",
|
||||||
"color_attachment": "RGBA64"
|
"color_attachments": ["RGBA64"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
"texture_params": [],
|
"texture_params": [],
|
||||||
"vertex_shader": "world_pass.vert.glsl",
|
"vertex_shader": "world_pass.vert.glsl",
|
||||||
"fragment_shader": "world_pass.frag.glsl",
|
"fragment_shader": "world_pass.frag.glsl",
|
||||||
"color_attachment": "_HDR"
|
"color_attachments": ["_HDR"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,17 @@ def parse_context(c, sres, asset, defs, vert=None, frag=None):
|
||||||
if con['tesseval_shader'] not in asset:
|
if con['tesseval_shader'] not in asset:
|
||||||
asset.append(con['tesseval_shader'])
|
asset.append(con['tesseval_shader'])
|
||||||
|
|
||||||
if 'color_attachment' in c:
|
if 'color_attachments' in c:
|
||||||
con['color_attachment'] = c['color_attachment']
|
con['color_attachments'] = c['color_attachments']
|
||||||
if con['color_attachment'] == '_HDR':
|
for i in range(len(con['color_attachments'])):
|
||||||
con['color_attachment'] = 'RGBA32' if '_LDR' in defs else 'RGBA64'
|
if con['color_attachments'][i] == '_HDR':
|
||||||
|
con['color_attachments'][i] = 'RGBA32' if '_LDR' in defs else 'RGBA64'
|
||||||
|
|
||||||
# Params
|
# Params
|
||||||
params = ['depth_write', 'compare_mode', 'cull_mode', \
|
params = ['depth_write', 'compare_mode', 'cull_mode', \
|
||||||
'blend_source', 'blend_destination', 'blend_operation', \
|
'blend_source', 'blend_destination', 'blend_operation', \
|
||||||
'alpha_blend_source', 'alpha_blend_destination', 'alpha_blend_operation' \
|
'alpha_blend_source', 'alpha_blend_destination', 'alpha_blend_operation' \
|
||||||
'color_writes_red', 'color_writes_green', 'color_writes_blue', 'color_writes_alpha', \
|
'color_writes_red', 'color_writes_green', 'color_writes_blue', 'color_writes_alpha', \
|
||||||
'color_attachment_count', \
|
|
||||||
'conservative_raster']
|
'conservative_raster']
|
||||||
|
|
||||||
for p in params:
|
for p in params:
|
||||||
|
|
|
@ -43,11 +43,10 @@ def make(context_id, rpasses):
|
||||||
con['depth_write'] = False
|
con['depth_write'] = False
|
||||||
con['compare_mode'] = 'equal'
|
con['compare_mode'] = 'equal'
|
||||||
|
|
||||||
if '_LDR' not in wrd.world_defs:
|
attachment_format = 'RGBA32' if '_LDR' in wrd.world_defs else 'RGBA64'
|
||||||
con['color_attachment'] = 'RGBA64'
|
con['color_attachments'] = [attachment_format, attachment_format]
|
||||||
|
if '_gbuffer2' in wrd.world_defs:
|
||||||
if rid == 'Deferred':
|
con['color_attachments'].append(attachment_format)
|
||||||
con['color_attachment_count'] = 3 if '_gbuffer2' in wrd.world_defs else 2
|
|
||||||
|
|
||||||
con_mesh = mat_state.data.add_context(con)
|
con_mesh = mat_state.data.add_context(con)
|
||||||
mat_state.con_mesh = con_mesh
|
mat_state.con_mesh = con_mesh
|
||||||
|
|
|
@ -65,10 +65,8 @@ class ShaderContext:
|
||||||
self.data['color_writes_blue'] = props['color_writes_blue']
|
self.data['color_writes_blue'] = props['color_writes_blue']
|
||||||
if 'color_writes_alpha' in props:
|
if 'color_writes_alpha' in props:
|
||||||
self.data['color_writes_alpha'] = props['color_writes_alpha']
|
self.data['color_writes_alpha'] = props['color_writes_alpha']
|
||||||
if 'color_attachment_count' in props:
|
if 'color_attachments' in props:
|
||||||
self.data['color_attachment_count'] = props['color_attachment_count']
|
self.data['color_attachments'] = props['color_attachments']
|
||||||
if 'color_attachment' in props:
|
|
||||||
self.data['color_attachment'] = props['color_attachment']
|
|
||||||
|
|
||||||
self.data['texture_units'] = []
|
self.data['texture_units'] = []
|
||||||
self.tunits = self.data['texture_units']
|
self.tunits = self.data['texture_units']
|
||||||
|
|
Loading…
Reference in a new issue