EEVEE Next: Add imageStore/LoadFast ops to Raytrace passes #121117

Merged
Clément Foucault merged 5 commits from Jason-Fielder/blender:im_store_fast_rt into main 2024-05-24 12:51:31 +02:00
3 changed files with 12 additions and 12 deletions
Showing only changes of commit 765d7fda39 - Show all commits

View File

@ -7,7 +7,7 @@ void output_renderpass_color(int id, vec4 color)
#if defined(MAT_RENDER_PASS_SUPPORT) && defined(GPU_FRAGMENT_SHADER)
if (id >= 0) {
ivec2 texel = ivec2(gl_FragCoord.xy);
imageStore(rp_color_img, ivec3(texel, id), color);
imageStoreFast(rp_color_img, ivec3(texel, id), color);
}
#endif
}
@ -17,7 +17,7 @@ void output_renderpass_value(int id, float value)
#if defined(MAT_RENDER_PASS_SUPPORT) && defined(GPU_FRAGMENT_SHADER)
if (id >= 0) {
ivec2 texel = ivec2(gl_FragCoord.xy);
imageStore(rp_value_img, ivec3(texel, id), vec4(value));
imageStoreFast(rp_value_img, ivec3(texel, id), vec4(value));
}
#endif
}
@ -39,17 +39,17 @@ void output_aov(vec4 color, float value, uint hash)
#if defined(MAT_RENDER_PASS_SUPPORT) && defined(GPU_FRAGMENT_SHADER)
for (int i = 0; i < AOV_MAX && i < uniform_buf.render_pass.aovs.color_len; i++) {
if (uniform_buf.render_pass.aovs.hash_color[i].x == hash) {
imageStore(rp_color_img,
ivec3(ivec2(gl_FragCoord.xy), uniform_buf.render_pass.color_len + i),
color);
imageStoreFast(rp_color_img,
ivec3(ivec2(gl_FragCoord.xy), uniform_buf.render_pass.color_len + i),
color);
return;
}
}
for (int i = 0; i < AOV_MAX && i < uniform_buf.render_pass.aovs.value_len; i++) {
if (uniform_buf.render_pass.aovs.hash_value[i].x == hash) {
imageStore(rp_value_img,
ivec3(ivec2(gl_FragCoord.xy), uniform_buf.render_pass.value_len + i),
vec4(value));
imageStoreFast(rp_value_img,
ivec3(ivec2(gl_FragCoord.xy), uniform_buf.render_pass.value_len + i),
vec4(value));
return;
}
}

View File

@ -63,7 +63,7 @@ void main()
if (imageSize(rp_cryptomatte_img).x > 1) {
vec4 cryptomatte_output = vec4(
cryptomatte_object_buf[resource_id], node_tree.crypto_hash, 0.0);
imageStore(rp_cryptomatte_img, out_texel, cryptomatte_output);
imageStoreFast(rp_cryptomatte_img, out_texel, cryptomatte_output);
}
output_renderpass_color(uniform_buf.render_pass.position_id, vec4(g_data.P, 1.0));
output_renderpass_color(uniform_buf.render_pass.emission_id, vec4(g_emission, 1.0));
@ -94,11 +94,11 @@ void main()
/* Output remaining closures using image store. */
/* NOTE: The image view start at layer 2 so all destination layer is `layer - 2`. */
for (int layer = 2; layer < GBUFFER_DATA_MAX && layer < gbuf.data_len; layer++) {
imageStore(out_gbuf_closure_img, ivec3(out_texel, layer - 2), gbuf.data[layer]);
imageStoreFast(out_gbuf_closure_img, ivec3(out_texel, layer - 2), gbuf.data[layer]);
}
/* NOTE: The image view start at layer 1 so all destination layer is `layer - 1`. */
for (int layer = 1; layer < GBUFFER_NORMAL_MAX && layer < gbuf.normal_len; layer++) {
imageStore(out_gbuf_normal_img, ivec3(out_texel, layer - 1), gbuf.N[layer].xyyy);
imageStoreFast(out_gbuf_normal_img, ivec3(out_texel, layer - 1), gbuf.N[layer].xyyy);
}
/* ----- Radiance output ----- */

View File

@ -80,6 +80,6 @@ void main()
output_renderpass_color(uniform_buf.render_pass.emission_id, clear_color);
output_renderpass_value(uniform_buf.render_pass.shadow_id, 1.0);
/** NOTE: AO is done on its own pass. */
imageStore(rp_cryptomatte_img, texel, vec4(0.0));
imageStoreFast(rp_cryptomatte_img, texel, vec4(0.0));
#endif
}