mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/main: Tidy and make dispatch code more uniform
This commit is contained in:
parent
83297c9ce5
commit
df69c9da50
|
@ -790,11 +790,17 @@ dispatch_graphics(struct comp_renderer *r, struct render_gfx *rr, enum comp_targ
|
||||||
|
|
||||||
struct comp_compositor *c = r->c;
|
struct comp_compositor *c = r->c;
|
||||||
struct comp_target *ct = c->target;
|
struct comp_target *ct = c->target;
|
||||||
|
VkResult ret;
|
||||||
|
|
||||||
struct render_gfx_target_resources *rtr = &r->rtr_array[r->acquired_buffer];
|
// Basics
|
||||||
|
const struct comp_layer *layers = c->base.slot.layers;
|
||||||
|
uint32_t layer_count = c->base.slot.layer_count;
|
||||||
bool fast_path = c->base.slot.one_projection_layer_fast_path;
|
bool fast_path = c->base.slot.one_projection_layer_fast_path;
|
||||||
bool do_timewarp = !c->debug.atw_off;
|
bool do_timewarp = !c->debug.atw_off;
|
||||||
|
|
||||||
|
// Resources for the distortion render target.
|
||||||
|
struct render_gfx_target_resources *rtr = &r->rtr_array[r->acquired_buffer];
|
||||||
|
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
assert(!fast_path || c->base.slot.layer_count >= 1);
|
assert(!fast_path || c->base.slot.layer_count >= 1);
|
||||||
|
|
||||||
|
@ -817,27 +823,24 @@ dispatch_graphics(struct comp_renderer *r, struct render_gfx *rr, enum comp_targ
|
||||||
world_poses, // world_poses[2]
|
world_poses, // world_poses[2]
|
||||||
eye_poses); // eye_poses[2]
|
eye_poses); // eye_poses[2]
|
||||||
|
|
||||||
// Need to be begin for all paths.
|
// Start the graphics pipeline.
|
||||||
render_gfx_begin(rr);
|
render_gfx_begin(rr);
|
||||||
|
|
||||||
|
// Build the command buffer.
|
||||||
VkResult ret = VK_SUCCESS;
|
comp_render_gfx_dispatch( //
|
||||||
|
rr, // rr
|
||||||
comp_render_gfx_dispatch( //
|
&r->scratch, // rsi
|
||||||
rr, // rr
|
r->scratch_targets, // rsi_rtrs
|
||||||
&r->scratch, // rsi
|
layers, // layers
|
||||||
r->scratch_targets, // rsi_rtrs
|
layer_count, // layer_count
|
||||||
c->base.slot.layers, // layers
|
world_poses, // world_poses
|
||||||
c->base.slot.layer_count, // layer_count
|
eye_poses, // eye_poses
|
||||||
world_poses, // world_poses
|
fovs, // fovs
|
||||||
eye_poses, // eye_poses
|
vertex_rots, // vertex_rots
|
||||||
fovs, // fovs
|
rtr, // rtr
|
||||||
vertex_rots, // vertex_rots
|
viewport_datas, // viewport_datas
|
||||||
rtr, // rtr
|
fast_path, // fast_path
|
||||||
viewport_datas, // viewport_datas
|
do_timewarp); // do_timewarp
|
||||||
fast_path, // fast_path
|
|
||||||
do_timewarp); // do_timewarp
|
|
||||||
|
|
||||||
|
|
||||||
// Make the command buffer submittable.
|
// Make the command buffer submittable.
|
||||||
render_gfx_end(rr);
|
render_gfx_end(rr);
|
||||||
|
@ -868,6 +871,7 @@ dispatch_compute(struct comp_renderer *r, struct render_compute *crc, enum comp_
|
||||||
|
|
||||||
struct comp_compositor *c = r->c;
|
struct comp_compositor *c = r->c;
|
||||||
struct comp_target *ct = c->target;
|
struct comp_target *ct = c->target;
|
||||||
|
VkResult ret;
|
||||||
|
|
||||||
// Basics
|
// Basics
|
||||||
const struct comp_layer *layers = c->base.slot.layers;
|
const struct comp_layer *layers = c->base.slot.layers;
|
||||||
|
@ -897,6 +901,7 @@ dispatch_compute(struct comp_renderer *r, struct render_compute *crc, enum comp_
|
||||||
// Start the compute pipeline.
|
// Start the compute pipeline.
|
||||||
render_compute_begin(crc);
|
render_compute_begin(crc);
|
||||||
|
|
||||||
|
// Build the command buffer.
|
||||||
comp_render_cs_dispatch( //
|
comp_render_cs_dispatch( //
|
||||||
crc, // crc
|
crc, // crc
|
||||||
&r->scratch, // rsi
|
&r->scratch, // rsi
|
||||||
|
@ -910,11 +915,16 @@ dispatch_compute(struct comp_renderer *r, struct render_compute *crc, enum comp_
|
||||||
fast_path, // fast_path
|
fast_path, // fast_path
|
||||||
do_timewarp); // do_timewarp
|
do_timewarp); // do_timewarp
|
||||||
|
|
||||||
|
// Make the command buffer submittable.
|
||||||
render_compute_end(crc);
|
render_compute_end(crc);
|
||||||
|
|
||||||
|
// Everything is ready, submit to the queue.
|
||||||
|
ret = renderer_submit_queue(r, crc->r->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||||
|
|
||||||
|
// We mark afterwards to not include CPU time spent.
|
||||||
comp_target_mark_submit(ct, c->frame.rendering.id, os_monotonic_get_ns());
|
comp_target_mark_submit(ct, c->frame.rendering.id, os_monotonic_get_ns());
|
||||||
|
|
||||||
return renderer_submit_queue(r, crc->r->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue