Unravel Engine C++ Reference
Loading...
Searching...
No Matches
ssr_pass.cpp
Go to the documentation of this file.
1#include "ssr_pass.h"
4#include <graphics/graphics.h>
6#include <graphics/texture.h>
7
8namespace unravel
9{
10
11auto ssr_pass::init(rtti::context& ctx) -> bool
12{
13 auto& am = ctx.get_cached<asset_manager>();
14
15 // Load shaders
16 auto vs_clip_quad = am.get_asset<gfx::shader>("engine:/data/shaders/vs_clip_quad.sc");
17
18 // Load FidelityFX SSR shader (trace pass)
19 auto fs_ssr_fidelityfx = am.get_asset<gfx::shader>("engine:/data/shaders/ssr/fs_ssr_fidelityfx.sc");
20
21 // Load temporal resolve shader
22 auto fs_ssr_temporal_resolve = am.get_asset<gfx::shader>("engine:/data/shaders/ssr/fs_ssr_temporal_resolve.sc");
23
24 // Load composite shader
25 auto fs_ssr_composite = am.get_asset<gfx::shader>("engine:/data/shaders/ssr/fs_ssr_composite.sc");
26
27 // Load unified blur compute shader for cone tracing
28 auto cs_ssr_blur = am.get_asset<gfx::shader>("engine:/data/shaders/ssr/cs_ssr_blur.sc");
29
30 // Create FidelityFX SSR programs
31 fidelityfx_pixel_program_.program = std::make_unique<gpu_program>(vs_clip_quad, fs_ssr_fidelityfx);
32 fidelityfx_pixel_program_.cache_uniforms();
33
34 // Create temporal resolve program
35 temporal_resolve_program_.program = std::make_unique<gpu_program>(vs_clip_quad, fs_ssr_temporal_resolve);
36 temporal_resolve_program_.cache_uniforms();
37
38 // Create composite program
39 composite_program_.program = std::make_unique<gpu_program>(vs_clip_quad, fs_ssr_composite);
40 composite_program_.cache_uniforms();
41
42 // Create unified blur compute program for cone tracing
43 blur_compute_program_.program = std::make_unique<gpu_program>(cs_ssr_blur);
44 blur_compute_program_.cache_uniforms();
45
46 // Validate all programs
47 bool all_valid = fidelityfx_pixel_program_.is_valid() && temporal_resolve_program_.is_valid() &&
48 composite_program_.is_valid() && blur_compute_program_.program &&
49 blur_compute_program_.program->is_valid();
50
51 return all_valid;
52}
53
54auto ssr_pass::create_or_update_output_fb(gfx::render_view& rview,
55 const gfx::frame_buffer::ptr& reference,
57{
58 // If the caller provided an output framebuffer, just return it.
59 if(output)
60 {
61 return output;
62 }
63
64 // Otherwise, use the render_view to get or create the SSR output framebuffer
65 auto ref_sz = reference->get_size();
66 auto ref_tex = reference->get_texture();
67 auto ref_format = ref_tex->info.format;
68
69 auto& ssr_output_tex = rview.tex_get_or_emplace("SSR_OUTPUT");
70 if(!ssr_output_tex || (ssr_output_tex && ssr_output_tex->get_size() != ref_sz) ||
71 (ssr_output_tex && ssr_output_tex->info.format != ref_format))
72 {
73 ssr_output_tex = std::make_shared<gfx::texture>(ref_sz.width,
74 ref_sz.height,
75 false, // no generate mips
76 1, // one layer
77 ref_format, // same format as reference
78 BGFX_TEXTURE_RT // render target flag
79 );
80 }
81
82 auto& ssr_output_fbo = rview.fbo_get_or_emplace("SSR_OUTPUT");
83 if(!ssr_output_fbo || (ssr_output_fbo && ssr_output_fbo->get_size() != ref_sz))
84 {
85 ssr_output_fbo = std::make_shared<gfx::frame_buffer>();
86 ssr_output_fbo->populate({ssr_output_tex});
87 }
88
89 return ssr_output_fbo;
90}
91
92auto ssr_pass::create_or_update_ssr_curr_fb(gfx::render_view& rview,
93 const gfx::frame_buffer::ptr& reference,
94 bool enable_half_res) -> gfx::frame_buffer::ptr
95{
96 auto ref_sz = reference->get_size();
97 auto ref_tex = reference->get_texture();
98 auto ref_format = ref_tex->info.format;
99
100 // Calculate target size with multiplier
101 uint32_t target_width = static_cast<uint32_t>(ref_sz.width * (enable_half_res ? 0.5f : 1.0f));
102 uint32_t target_height = static_cast<uint32_t>(ref_sz.height * (enable_half_res ? 0.5f : 1.0f));
103
104 // Ensure minimum size of 1x1
105 target_width = target_width > 0 ? target_width : 1;
106 target_height = target_height > 0 ? target_height : 1;
107
108 auto& ssr_curr_tex = rview.tex_get_or_emplace("SSR_CURR");
109 if(!ssr_curr_tex ||
110 (ssr_curr_tex && (ssr_curr_tex->info.width != target_width || ssr_curr_tex->info.height != target_height)) ||
111 (ssr_curr_tex && ssr_curr_tex->info.format != ref_format))
112 {
113 ssr_curr_tex = std::make_shared<gfx::texture>(target_width,
114 target_height,
115 false, // no generate mips
116 1, // one layer
117 ref_format, // same format as reference
118 BGFX_TEXTURE_RT // render target flag
119 );
120 }
121
122 auto& ssr_curr_fbo = rview.fbo_get_or_emplace("SSR_CURR");
123 usize32_t target_size{target_width, target_height};
124 if(!ssr_curr_fbo || (ssr_curr_fbo && ssr_curr_fbo->get_size() != target_size))
125 {
126 ssr_curr_fbo = std::make_shared<gfx::frame_buffer>();
127 ssr_curr_fbo->populate({ssr_curr_tex});
128 }
129
130 return ssr_curr_fbo;
131}
132
133auto ssr_pass::create_or_update_ssr_history_tex(gfx::render_view& rview,
134 const gfx::frame_buffer::ptr& reference,
135 bool enable_half_res) -> gfx::texture::ptr
136{
137 auto ref_sz = reference->get_size();
138 auto ref_tex = reference->get_texture();
139 auto ref_format = ref_tex->info.format;
140
141 // Calculate target size with multiplier
142 uint32_t target_width = static_cast<uint32_t>(ref_sz.width * (enable_half_res ? 0.5f : 1.0f));
143 uint32_t target_height = static_cast<uint32_t>(ref_sz.height * (enable_half_res ? 0.5f : 1.0f));
144
145 // Ensure minimum size of 1x1
146 target_width = target_width > 0 ? target_width : 1;
147 target_height = target_height > 0 ? target_height : 1;
148
149 auto& history_tex = rview.tex_get_or_emplace("SSR_HISTORY");
150 if(!history_tex ||
151 (history_tex && (history_tex->info.width != target_width || history_tex->info.height != target_height)) ||
152 (history_tex && history_tex->info.format != ref_format))
153 {
154 history_tex = std::make_shared<gfx::texture>(target_width,
155 target_height,
156 false, // no generate mips
157 1, // one layer
158 ref_format, // same format as reference
159 BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_RT | BGFX_SAMPLER_U_CLAMP |
160 BGFX_SAMPLER_V_CLAMP);
161 }
162
163 return history_tex;
164}
165
166auto ssr_pass::create_or_update_ssr_history_temp_fb(gfx::render_view& rview,
167 const gfx::frame_buffer::ptr& reference,
168 bool enable_half_res) -> gfx::frame_buffer::ptr
169{
170 auto ref_sz = reference->get_size();
171 auto ref_tex = reference->get_texture();
172 auto ref_format = ref_tex->info.format;
173
174 // Calculate target size with multiplier
175 uint32_t target_width = static_cast<uint32_t>(ref_sz.width * (enable_half_res ? 0.5f : 1.0f));
176 uint32_t target_height = static_cast<uint32_t>(ref_sz.height * (enable_half_res ? 0.5f : 1.0f));
177
178 // Ensure minimum size of 1x1
179 target_width = target_width > 0 ? target_width : 1;
180 target_height = target_height > 0 ? target_height : 1;
181
182 auto& temp_tex = rview.tex_get_or_emplace("SSR_HISTORY_TEMP");
183 if(!temp_tex ||
184 (temp_tex && (temp_tex->info.width != target_width || temp_tex->info.height != target_height)) ||
185 (temp_tex && temp_tex->info.format != ref_format))
186 {
187 temp_tex = std::make_shared<gfx::texture>(target_width,
188 target_height,
189 false, // no generate mips
190 1, // one layer
191 ref_format, // same format as reference
192 BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_RT | BGFX_SAMPLER_U_CLAMP |
193 BGFX_SAMPLER_V_CLAMP);
194 }
195
196 auto& temp_fbo = rview.fbo_get_or_emplace("SSR_HISTORY_TEMP");
197 usize32_t target_size{target_width, target_height};
198 if(!temp_fbo || (temp_fbo && temp_fbo->get_size() != target_size))
199 {
200 temp_fbo = std::make_shared<gfx::frame_buffer>();
201 temp_fbo->populate({temp_tex});
202 }
203
204 return temp_fbo;
205}
206
208{
209 // Ensure we have valid input
210 if(!params.g_buffer)
211 {
212 return nullptr;
213 }
214
215 // Dispatch to appropriate implementation based on settings
216 return run_fidelityfx(rview, params);
217}
218
220{
221 // Use the new three-pass pipeline by default
222 return run_fidelityfx_three_pass(rview, params);
223}
224
225
227 const gfx::texture::ptr& input_color,
228 const gfx::frame_buffer::ptr& g_buffer,
230{
231 APP_SCOPE_PERF("Rendering/SSR/Blur Color Pass");
232 // Early validation
233 if(!input_color)
234 {
235 return nullptr;
236 }
237
238 if(!blur_compute_program_.program || !blur_compute_program_.program->is_valid())
239 {
240 return input_color; // Fallback to input texture
241 }
242
243 auto input_size = input_color->get_size();
244
245 // Get or create blurred color texture with mip chain
246 auto& blurred_tex = rview.tex_get_or_emplace("SSR_BLURRED_COLOR");
247 if(!blurred_tex || blurred_tex->get_size() != input_size)
248 {
249 blurred_tex = std::make_shared<gfx::texture>(input_size.width,
250 input_size.height,
251 true, // has mips
252 1, // num layers
253 gfx::texture_format::RGBA8, // format for HDR content
254 BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP |
255 BGFX_TEXTURE_COMPUTE_WRITE | BGFX_TEXTURE_RT);
256 }
257
258 const uint32_t num_mips = settings.cone_tracing.max_mip_level + 1;
259 gfx::render_pass pass("blur_compute_ssr_pass");
260
261 // Process each mip level using unified blur shader
262 for(int mip = 0; mip < num_mips; ++mip)
263 {
264 // Calculate mip size
265 int mip_width = (input_size.width >> mip) > 1 ? (input_size.width >> mip) : 1;
266 int mip_height = (input_size.height >> mip) > 1 ? (input_size.height >> mip) : 1;
267
268 // Calculate sigma based on mip level and base sigma
269 float sigma = settings.cone_tracing.blur_base_sigma; // * (1.0f + float(mip));
270
271 // Use unified blur compute shader
272 blur_compute_program_.program->begin();
273
274 // Set blur parameters: mip_level, sigma, base_width, base_height
275 if(mip == 0)
276 {
277 // Bind input color texture as read-only image
278 gfx::set_image(1, input_color->native_handle(), 0, bgfx::Access::Read);
279 }
280 else
281 {
282 // Bind previous mip level as input read-only image
283 gfx::set_image(1, blurred_tex->native_handle(), mip - 1, bgfx::Access::Read);
284 }
285
286 float blur_params[4] = {float(mip), sigma, 0.0f, 0.0f};
287 gfx::set_uniform(blur_compute_program_.u_blur_params, blur_params);
288
289 // Bind output image (current mip level of blurred texture)
290 gfx::set_image(0, blurred_tex->native_handle(), mip, bgfx::Access::Write);
291
292 gfx::set_texture(blur_compute_program_.s_normal, 2, g_buffer->get_texture(1));
293
294 // Dispatch compute shader
295 uint32_t num_groups_x = (mip_width + 7) / 8;
296 uint32_t num_groups_y = (mip_height + 7) / 8;
297 gfx::dispatch(pass.id, blur_compute_program_.program->native_handle(), num_groups_x, num_groups_y, 1);
298
299 blur_compute_program_.program->end();
300 }
301
302 return blurred_tex;
303}
304
306{
307 // Pass 1: SSR Trace - generates SSR_CURR
308 auto ssr_curr_fb = run_ssr_trace(rview, params);
309 if(!ssr_curr_fb)
310 {
311 return nullptr;
312 }
313
314 // Pass 2: Temporal Resolve - reads SSR_CURR + SSR_HIST, writes new SSR_HIST
315 auto ssr_history_fb =
316 run_temporal_resolve(rview, ssr_curr_fb, params.g_buffer, params.cam, params.settings.fidelityfx);
317 if(!ssr_history_fb)
318 {
319 return ssr_curr_fb; // Fallback to current frame
320 }
321
322 // Pass 3: Composite - blends SSR_HIST + SSR_CURR + probe, writes to output
323 auto composite_fb =
324 run_composite(rview, ssr_history_fb, ssr_curr_fb, params.output, params.g_buffer, params.output);
325
326 return composite_fb;
327}
328
330{
331 // Get or create SSR current frame buffer using helper function (1.0f = full resolution)
332 auto ssr_curr_fbo = create_or_update_ssr_curr_fb(rview, params.g_buffer, params.settings.fidelityfx.enable_half_res);
333
334 // Generate blurred color buffer for cone tracing if enabled
335 gfx::texture::ptr blurred_color_buffer = nullptr;
336 if(params.settings.fidelityfx.enable_cone_tracing && params.previous_frame)
337 {
338 blurred_color_buffer =
339 generate_blurred_color_buffer(rview, params.previous_frame, params.g_buffer, params.settings.fidelityfx);
340 }
341
342 // ============================================================================
343 // SSR Trace Pass
344 // ============================================================================
345 APP_SCOPE_PERF("Rendering/SSR/Trace Pass");
346
347 gfx::render_pass pass("ssr_trace_pass");
348 pass.bind(ssr_curr_fbo.get());
349 pass.set_view_proj(params.cam->get_view(), params.cam->get_projection());
350
351 // Bind SSR trace program
352 fidelityfx_pixel_program_.program->begin();
353
354 // Set input textures
355 gfx::set_texture(fidelityfx_pixel_program_.s_color, 0, params.previous_frame);
356 gfx::set_texture(fidelityfx_pixel_program_.s_normal, 1, params.g_buffer->get_texture(1));
357 gfx::set_texture(fidelityfx_pixel_program_.s_depth, 2, params.g_buffer->get_texture(4));
358 gfx::set_texture(fidelityfx_pixel_program_.s_hiz, 3, params.hiz_buffer);
359
360 // Set blurred color buffer for cone tracing (fallback to previous frame if not available)
361 auto cone_tracing_texture = blurred_color_buffer ? blurred_color_buffer : params.previous_frame;
362 gfx::set_texture(fidelityfx_pixel_program_.s_color_blurred, 4, cone_tracing_texture);
363
364 // Set SSR parameters (max_steps, depth_tolerance, max_rays, brightness)
365 float ssr_params[4] = {float(params.settings.fidelityfx.max_steps),
366 params.settings.fidelityfx.depth_tolerance,
367 float(params.settings.fidelityfx.max_rays),
368 params.settings.fidelityfx.brightness};
369 gfx::set_uniform(fidelityfx_pixel_program_.u_ssr_params, ssr_params);
370
371
372 // Calculate resolution scale: SSR buffer size / full resolution size
373 auto ssr_size = ssr_curr_fbo->get_size();
374 auto g_buffer_size = params.g_buffer->get_size();
375 float ssr_resolution_scale = float(g_buffer_size.width) / float(ssr_size.width); // resolution scale factor
376 // Set Hi-Z parameters (buffer_width, buffer_height, num_depth_mips, ssr_resolution_scale)
377 float hiz_params[4] = {
378 0.0f,
379 0.0f,
380 0.0f,
381 ssr_resolution_scale // SSR resolution scale (1.0 = full res, 0.5 = half res, etc.)
382 };
383 if(params.hiz_buffer)
384 {
385 hiz_params[0] = float(params.hiz_buffer->info.width);
386 hiz_params[1] = float(params.hiz_buffer->info.height);
387 hiz_params[2] = float(params.hiz_buffer->info.numMips); // Number of mips
388
389 }
390 gfx::set_uniform(fidelityfx_pixel_program_.u_hiz_params, hiz_params);
391
392 // Set fade parameters (fade_in_start, fade_in_end, roughness_depth_tolerance, facing_reflections_fading)
393 float fade_params[4] = {params.settings.fidelityfx.fade_in_start,
394 params.settings.fidelityfx.fade_in_end,
395 params.settings.fidelityfx.roughness_depth_tolerance,
396 params.settings.fidelityfx.facing_reflections_fading};
397 gfx::set_uniform(fidelityfx_pixel_program_.u_fade_params, fade_params);
398
399 // Set cone tracing parameters (cone_angle_bias, max_mip_level, frame_number, enable_cone_tracing)
400 float cone_params[4] = {
401 params.settings.fidelityfx.cone_tracing.cone_angle_bias,
402 float(params.settings.fidelityfx.cone_tracing.max_mip_level),
403 float(gfx::get_render_frame() % 4), // frame number for temporal jitter
404 float(params.settings.fidelityfx.enable_cone_tracing ? 1.0f : 0.0f) // enable flag
405 };
406 gfx::set_uniform(fidelityfx_pixel_program_.u_cone_params, cone_params);
407
408 // Set previous frame view-projection matrix for temporal reprojection
409 auto prev_view_proj = params.cam->get_prev_view_projection();
410 gfx::set_uniform(fidelityfx_pixel_program_.u_prev_view_proj, prev_view_proj.get_matrix());
411
412 // Draw fullscreen quad
413 auto topology = gfx::clip_quad(1.0f);
414 gfx::set_state(topology | BGFX_STATE_DEPTH_TEST_NEVER | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A);
415 gfx::submit(pass.id, fidelityfx_pixel_program_.program->native_handle());
416
417 // Reset state
418 gfx::set_state(BGFX_STATE_DEFAULT);
419 fidelityfx_pixel_program_.program->end();
420 gfx::discard();
421
422 return ssr_curr_fbo;
423}
424
426 const gfx::frame_buffer::ptr& ssr_curr,
427 const gfx::frame_buffer::ptr& g_buffer,
428 const camera* cam,
430{
431 if(!temporal_resolve_program_.is_valid())
432 {
433 return nullptr;
434 }
435
436 // Create or update SSR history texture and temp framebuffer using helper functions (1.0f = full resolution)
437 auto history_tex = create_or_update_ssr_history_tex(rview, ssr_curr, settings.enable_half_res);
438 auto temp_fbo = create_or_update_ssr_history_temp_fb(rview, ssr_curr, settings.enable_half_res);
439
440 // ============================================================================
441 // Temporal Resolve Pass
442 // ============================================================================
443 APP_SCOPE_PERF("Rendering/SSR/Temporal Resolve Pass");
444
445 gfx::render_pass pass("ssr_temporal_resolve_pass");
446 pass.bind(temp_fbo.get());
447 pass.set_view_proj(cam->get_view(), cam->get_projection());
448
449 // Bind temporal resolve program
450 temporal_resolve_program_.program->begin();
451
452 // Set input textures
453 gfx::set_texture(temporal_resolve_program_.s_ssr_curr, 0, ssr_curr->get_texture());
454 gfx::set_texture(temporal_resolve_program_.s_ssr_history, 1, history_tex);
455 gfx::set_texture(temporal_resolve_program_.s_normal, 2, g_buffer->get_texture(1));
456 gfx::set_texture(temporal_resolve_program_.s_depth, 3, g_buffer->get_texture(4));
457
458 // Set temporal parameters (enable_temporal, history_strength, depth_threshold, roughness_sensitivity)
459 float temporal_params[4] = {settings.enable_temporal_accumulation ? 1.0f : 0.0f,
460 settings.temporal.history_strength,
461 settings.temporal.depth_threshold,
462 settings.temporal.roughness_sensitivity};
463 gfx::set_uniform(temporal_resolve_program_.u_temporal_params, temporal_params);
464
465 // Set motion parameters (motion_scale_pixels, normal_dot_threshold, max_accum_frames, unused)
466 float motion_params[4] = {
467 settings.temporal.motion_scale_pixels,
468 settings.temporal.normal_dot_threshold,
469 float(settings.temporal.max_accum_frames),
470 0.0f // unused
471 };
472 gfx::set_uniform(temporal_resolve_program_.u_motion_params, motion_params);
473
474 // Set fade parameters (fade_in_start, fade_in_end, ssr_resolution_scale, unused)
475 auto history_size = history_tex->get_size();
476 auto g_buffer_size = g_buffer->get_size();
477 float ssr_resolution_scale = float(g_buffer_size.width) / float(history_size.width);
478
479 float fade_params[4] = {settings.fade_in_start, settings.fade_in_end, ssr_resolution_scale, 0.0f};
480 gfx::set_uniform(temporal_resolve_program_.u_fade_params, fade_params);
481
482 // Set previous frame view-projection matrix
483 auto prev_view_proj = cam->get_prev_view_projection();
484 gfx::set_uniform(temporal_resolve_program_.u_prev_view_proj, prev_view_proj.get_matrix());
485
486 // Draw fullscreen quad
487 auto topology = gfx::clip_quad(1.0f);
488 gfx::set_state(topology | BGFX_STATE_DEPTH_TEST_NEVER | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A);
489 gfx::submit(pass.id, temporal_resolve_program_.program->native_handle());
490
491 // Reset state
492 gfx::set_state(BGFX_STATE_DEFAULT);
493 temporal_resolve_program_.program->end();
494 gfx::discard();
495
496 // ============================================================================
497 // Blit temp_fbo texture into persistent history_tex for next frame
498 // ============================================================================
499 gfx::render_pass blit_pass("ssr_history_blit_pass");
500 gfx::blit(blit_pass.id, history_tex->native_handle(), 0, 0, temp_fbo->get_texture()->native_handle(), 0, 0);
501
502 return temp_fbo;
503}
504
506 const gfx::frame_buffer::ptr& ssr_history,
507 const gfx::frame_buffer::ptr& ssr_curr,
508 const gfx::frame_buffer::ptr& probe_buffer,
509 const gfx::frame_buffer::ptr& g_buffer,
511{
512 if(!composite_program_.is_valid())
513 {
514 return nullptr;
515 }
516
517 // Get or create output framebuffer using render_view
518 auto actual_output = create_or_update_output_fb(rview, g_buffer, output);
519
520 // ============================================================================
521 // Composite Pass
522 // ============================================================================
523 APP_SCOPE_PERF("Rendering/SSR/Composite Pass");
524
525 gfx::render_pass pass("ssr_composite_pass");
526 pass.bind(actual_output.get());
527
528 // Bind composite program
529 composite_program_.program->begin();
530
531 // Set input textures
532 gfx::set_texture(composite_program_.s_ssr_history, 0, ssr_history->get_texture());
533 gfx::set_texture(composite_program_.s_ssr_curr, 1, ssr_curr->get_texture());
534 gfx::set_texture(composite_program_.s_normal, 2, g_buffer->get_texture(1));
535 gfx::set_texture(composite_program_.s_depth, 3, g_buffer->get_texture(4));
536
537 // Draw fullscreen quad with alpha blending
538 auto topology = gfx::clip_quad(1.0f);
539 gfx::set_state(topology | BGFX_STATE_DEPTH_TEST_NEVER | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A |
540 BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA));
541 gfx::submit(pass.id, composite_program_.program->native_handle());
542
543 // Reset state
544 gfx::set_state(BGFX_STATE_DEFAULT);
545 composite_program_.program->end();
546 gfx::discard();
547
548 return actual_output;
549}
550
551} // namespace unravel
Manages assets, including loading, unloading, and storage.
auto get_asset(const std::string &key, load_flags flags=load_flags::standard) -> asset_handle< T >
Gets an asset by its key.
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:35
auto run_ssr_trace(gfx::render_view &rview, const run_params &params) -> gfx::frame_buffer::ptr
Executes the SSR trace pass only. Returns SSR current frame buffer.
Definition ssr_pass.cpp:329
auto generate_blurred_color_buffer(gfx::render_view &rview, const gfx::texture::ptr &input_color, const gfx::frame_buffer::ptr &g_buffer, const fidelityfx_ssr_settings &settings) -> gfx::texture::ptr
Generates blurred color buffer with mip chain for cone tracing.
Definition ssr_pass.cpp:226
auto run_fidelityfx(gfx::render_view &rview, const run_params &params) -> gfx::frame_buffer::ptr
Executes the FidelityFX SSR pass. Returns the actual output framebuffer.
Definition ssr_pass.cpp:219
auto run_fidelityfx_three_pass(gfx::render_view &rview, const run_params &params) -> gfx::frame_buffer::ptr
Executes the three-pass SSR pipeline (trace, temporal resolve, composite)
Definition ssr_pass.cpp:305
auto run_composite(gfx::render_view &rview, const gfx::frame_buffer::ptr &ssr_history, const gfx::frame_buffer::ptr &ssr_curr, const gfx::frame_buffer::ptr &probe_buffer, const gfx::frame_buffer::ptr &g_buffer, const gfx::frame_buffer::ptr &output) -> gfx::frame_buffer::ptr
Executes the composite pass. Returns final blended output.
Definition ssr_pass.cpp:505
auto init(rtti::context &ctx) -> bool
Must be called once (after bgfx::init() and after asset_manager is registered in context).
Definition ssr_pass.cpp:11
auto run(gfx::render_view &rview, const run_params &params) -> gfx::frame_buffer::ptr
Executes the SSR pass. Returns the actual output framebuffer.
Definition ssr_pass.cpp:207
auto run_temporal_resolve(gfx::render_view &rview, const gfx::frame_buffer::ptr &ssr_curr, const gfx::frame_buffer::ptr &g_buffer, const camera *cam, const fidelityfx_ssr_settings &settings) -> gfx::frame_buffer::ptr
Executes the temporal resolve pass. Returns updated SSR history buffer.
Definition ssr_pass.cpp:425
void dispatch(view_id _id, program_handle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
Definition graphics.cpp:954
void submit(view_id _id, program_handle _handle, int32_t _depth, bool _preserveState)
Definition graphics.cpp:899
void set_state(uint64_t _state, uint32_t _rgba)
Definition graphics.cpp:763
void blit(view_id _id, texture_handle _dst, uint16_t _dstX, uint16_t _dstY, texture_handle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height)
Definition graphics.cpp:973
void discard(uint8_t _flags)
Definition graphics.cpp:968
void set_image(uint8_t _stage, texture_handle _handle, uint8_t _mip, access _access, texture_format _format)
Definition graphics.cpp:924
void set_uniform(uniform_handle _handle, const void *_value, uint16_t _num)
Definition graphics.cpp:803
uint32_t get_render_frame()
auto clip_quad(float depth, float width, float height) -> uint64_t
void set_texture(uint8_t _stage, uniform_handle _sampler, texture_handle _handle, uint32_t _flags)
Definition graphics.cpp:889
#define APP_SCOPE_PERF(name)
Create a scoped performance timer that only accepts string literals.
Definition profiler.h:160
void set_view_proj(const float *v, const float *p)
gfx::view_id id
Definition render_pass.h:98
void bind(const frame_buffer *fb=nullptr) const