File npv/video/local/code.frag.c changed (mode: 100644) (index f4b9a9f..03818ed) |
... |
... |
STATIC void init_once_local(void) |
75 |
75 |
++i; |
++i; |
76 |
76 |
} |
} |
77 |
77 |
receive_fr_l = avutil_video_fr_ref_alloc(); |
receive_fr_l = avutil_video_fr_ref_alloc(); |
78 |
|
is_swpchn_sem_fence_submitted_l = false; |
|
79 |
78 |
} |
} |
80 |
79 |
#undef NONE |
#undef NONE |
81 |
80 |
STATIC void scaler_img_create(avutil_video_fr_ref_t *fr) |
STATIC void scaler_img_create(avutil_video_fr_ref_t *fr) |
|
... |
... |
STATIC void img_mem_barrier_run_once(struct vk_img_mem_barrier_t *b) |
108 |
107 |
memset(&begin_info, 0, sizeof(begin_info)); |
memset(&begin_info, 0, sizeof(begin_info)); |
109 |
108 |
begin_info.type = vk_struct_type_cb_begin_info; |
begin_info.type = vk_struct_type_cb_begin_info; |
110 |
109 |
begin_info.flags = vk_cb_usage_one_time_submit_bit; |
begin_info.flags = vk_cb_usage_one_time_submit_bit; |
111 |
|
/* we use the first cb which will be used for the swpchn */ |
|
112 |
|
vk_begin_cb(npv_vk_surf_p.dev.cbs[0], &begin_info); |
|
113 |
|
IF_FATALVVK("%d:unable to begin recording the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]); |
|
|
110 |
|
vk_begin_cb(npv_vk_surf_p.dev.misc_cbs[ |
|
111 |
|
npv_vk_color_space_layout_transition], |
|
112 |
|
&begin_info); |
|
113 |
|
IF_FATALVVK("%d:unable to begin recording the layout transition command buffer for the vulkan image which will be used by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]); |
114 |
114 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
115 |
|
vk_cmd_pl_barrier(npv_vk_surf_p.dev.cbs[0], b); |
|
|
115 |
|
vk_cmd_pl_barrier(npv_vk_surf_p.dev.misc_cbs[ |
|
116 |
|
npv_vk_color_space_layout_transition], b); |
116 |
117 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
117 |
|
vk_end_cb(npv_vk_surf_p.dev.cbs[0]); |
|
118 |
|
IF_FATALVVK("%d:unable to end recording of the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]); |
|
|
118 |
|
vk_end_cb(npv_vk_surf_p.dev.misc_cbs[ |
|
119 |
|
npv_vk_color_space_layout_transition]); |
|
120 |
|
IF_FATALVVK("%d:unable to end recording of the layout transition command buffer for the vulkan image which will be written to by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]); |
119 |
121 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
120 |
122 |
memset(&submit_info, 0, sizeof(submit_info)); |
memset(&submit_info, 0, sizeof(submit_info)); |
121 |
123 |
submit_info.type = vk_struct_type_submit_info; |
submit_info.type = vk_struct_type_submit_info; |
122 |
124 |
submit_info.cbs_n = 1; |
submit_info.cbs_n = 1; |
123 |
|
submit_info.cbs = &npv_vk_surf_p.dev.cbs[0]; |
|
124 |
|
vk_q_submit(&submit_info, 0); |
|
125 |
|
IF_FATALVVK("%d:queue:%p:unable to submit the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q); |
|
|
125 |
|
submit_info.cbs = &npv_vk_surf_p.dev.misc_cbs[ |
|
126 |
|
npv_vk_color_space_layout_transition]; |
|
127 |
|
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence_color_space_layout); |
|
128 |
|
IF_FATALVVK("%d:queue:%p:unable to submit the layout transition command buffer for the vulkan image which will be written to by ffmpeg color space converter\n", r, npv_vk_surf_p.dev.q); |
126 |
129 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
127 |
|
vk_q_wait_idle(); |
|
128 |
|
IF_FATALVVK("%d:queue:%p:unable to wait for idle or completion of initial layout transition command buffer\n", r, npv_vk_surf_p.dev.q); |
|
|
130 |
|
/* |
|
131 |
|
* we cannot leave without the transition being done since we will |
|
132 |
|
* fire up the ffmpeg color space converter right away , then wait for |
|
133 |
|
* this fence to signal |
|
134 |
|
*/ |
|
135 |
|
vk_wait_for_fences(&npv_vk_surf_p.dev.fence_color_space_layout); |
|
136 |
|
if (r == vk_not_ready) |
|
137 |
|
npv_vk_fatal("%d:device:%p:wait for fence %p timeout\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout); |
|
138 |
|
else if (r != vk_success) |
|
139 |
|
npv_vk_fatal("%d:device:%p:unable to wait for fence %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout); |
|
140 |
|
vk_reset_fences(&npv_vk_surf_p.dev.fence_color_space_layout); |
|
141 |
|
IF_FATALVVK("%d:device:%p:unable to reset the color space layout fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence_color_space_layout); |
129 |
142 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
130 |
143 |
/* |
/* |
131 |
144 |
* since it is tagged to run once its state_p is invalid, we need to |
* since it is tagged to run once its state_p is invalid, we need to |
132 |
145 |
* reset it to the initial state_p |
* reset it to the initial state_p |
133 |
146 |
*/ |
*/ |
134 |
|
vk_reset_cb(npv_vk_surf_p.dev.cbs[0]); |
|
135 |
|
IF_FATALVVK("%d:command buffer:%p:unable to reset the initial layout transition command buffer\n", r, npv_vk_surf_p.dev.cbs[0]); |
|
|
147 |
|
vk_reset_cb(npv_vk_surf_p.dev.misc_cbs[ |
|
148 |
|
npv_vk_color_space_layout_transition]); |
|
149 |
|
IF_FATALVVK("%d:command buffer:%p:unable to reset the layout transition command buffer for the vulkan image which will be written to by the ffmpeg color space converter\n", r, npv_vk_surf_p.dev.misc_cbs[npv_vk_color_space_layout_transition]); |
136 |
150 |
} |
} |
137 |
151 |
/* once in general layout, the dev sees the img */ |
/* once in general layout, the dev sees the img */ |
138 |
152 |
STATIC void scaler_img_layout_to_general(void) |
STATIC void scaler_img_layout_to_general(void) |
|
... |
... |
STATIC void blit_setup(u8 swpchn_img) |
481 |
495 |
|
|
482 |
496 |
blit_compute_offsets(swpchn_img, current); |
blit_compute_offsets(swpchn_img, current); |
483 |
497 |
|
|
484 |
|
/* sync: may be in pending state? */ |
|
|
498 |
|
/* XXX: the fence is synchronizing the usage of this cb */ |
485 |
499 |
vk_reset_cb(npv_vk_surf_p.dev.cbs[swpchn_img]); |
vk_reset_cb(npv_vk_surf_p.dev.cbs[swpchn_img]); |
486 |
|
IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable reset\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]); |
|
|
500 |
|
IF_FATALVVK("%d:swapchain img:%u:command buffer:%p:unable to reset\n", r, swpchn_img, npv_vk_surf_p.dev.cbs[swpchn_img]); |
487 |
501 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
488 |
502 |
memset(&begin_info, 0, sizeof(begin_info)); |
memset(&begin_info, 0, sizeof(begin_info)); |
489 |
503 |
begin_info.type = vk_struct_type_cb_begin_info; |
begin_info.type = vk_struct_type_cb_begin_info; |
|
... |
... |
STATIC void blits_request_update(void) |
556 |
570 |
++i; |
++i; |
557 |
571 |
} |
} |
558 |
572 |
} |
} |
559 |
|
STATIC bool is_swpchn_sem_consistent(void) |
|
560 |
|
{ |
|
561 |
|
s32 r; |
|
562 |
|
|
|
563 |
|
/* nothing submitted then nothing to check */ |
|
564 |
|
if (!is_swpchn_sem_fence_submitted_l) |
|
565 |
|
return true; |
|
566 |
|
/* coarse synchronization (we could use a pool of semaphores/fences) */ |
|
567 |
|
vk_get_fence_status(); |
|
568 |
|
if (r == vk_not_ready) |
|
569 |
|
return false; |
|
570 |
|
else if (r != vk_success) |
|
571 |
|
npv_vk_fatal("%d:device:%p:unable to get fence %p status\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
572 |
|
/* vk_success */ |
|
573 |
|
vk_reset_fences(); |
|
574 |
|
IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
575 |
|
is_swpchn_sem_fence_submitted_l = false; |
|
576 |
|
return true; |
|
577 |
|
} |
|
578 |
573 |
#define READY 0 |
#define READY 0 |
579 |
574 |
#define NOT_READY 1 |
#define NOT_READY 1 |
580 |
|
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
|
|
575 |
|
STATIC u8 start_swpchn_next_img(u32 *swpchn_img) { loop |
581 |
576 |
{ |
{ |
582 |
577 |
struct vk_acquire_next_img_info_t info; |
struct vk_acquire_next_img_info_t info; |
583 |
578 |
s32 r; |
s32 r; |
|
... |
... |
STATIC u8 swpchn_next_img(u32 *swpchn_img) { loop |
610 |
605 |
blits_request_update(); |
blits_request_update(); |
611 |
606 |
continue; |
continue; |
612 |
607 |
} else if (r >= 0) |
} else if (r >= 0) |
613 |
|
return READY; |
|
|
608 |
|
return READY; /* Careful, the pe may not have finished reading from the acquired image, you need to use the semaphore or the fence to know where the image is actually available. */ |
614 |
609 |
npv_vk_fatal("%d:device:%p:unable to acquire next image from swapchain %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.swpchn.vk); |
npv_vk_fatal("%d:device:%p:unable to acquire next image from swapchain %p\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.swpchn.vk); |
615 |
610 |
}} |
}} |
616 |
611 |
#undef READY |
#undef READY |
|
... |
... |
STATIC u8 send_to_pe(u32 swpchn_img) |
641 |
636 |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img]; |
submit_info.cbs = &npv_vk_surf_p.dev.cbs[swpchn_img]; |
642 |
637 |
submit_info.signal_sems_n = 1; |
submit_info.signal_sems_n = 1; |
643 |
638 |
submit_info.signal_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
submit_info.signal_sems = &npv_vk_surf_p.dev.sems[npv_vk_sem_blit_done]; |
644 |
|
/* XXX: coarse synchronization happens here */ |
|
|
639 |
|
|
|
640 |
|
vk_reset_fences(&npv_vk_surf_p.dev.fence);/* XXX: coarse synchronization happens here */ |
|
641 |
|
IF_FATALVVK("%d:device:%p:unable to reset the fence\n", r, npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence); |
|
642 |
|
|
645 |
643 |
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); |
vk_q_submit(&submit_info, npv_vk_surf_p.dev.fence); |
646 |
644 |
IF_FATALVVK("%d:queue:%p:unable to submit the image pre-recorded command buffer\n", r, npv_vk_surf_p.dev.q); |
IF_FATALVVK("%d:queue:%p:unable to submit the image pre-recorded command buffer\n", r, npv_vk_surf_p.dev.q); |
647 |
|
is_swpchn_sem_fence_submitted_l = true; |
|
648 |
645 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
649 |
646 |
idxs[0] = swpchn_img; |
idxs[0] = swpchn_img; |
650 |
647 |
memset(&present_info, 0, sizeof(present_info)); |
memset(&present_info, 0, sizeof(present_info)); |
|
... |
... |
STATIC void start_scaling(avutil_video_fr_ref_t *fr, |
678 |
675 |
|
|
679 |
676 |
if (scaler_p.ctx->cfg.width != fr->width |
if (scaler_p.ctx->cfg.width != fr->width |
680 |
677 |
|| scaler_p.ctx->cfg.height != fr->height) { |
|| scaler_p.ctx->cfg.height != fr->height) { |
681 |
|
u8 i; |
|
682 |
|
|
|
683 |
678 |
if (scaler_p.img.vk != 0) |
if (scaler_p.img.vk != 0) |
684 |
679 |
scaler_img_destroy(); |
scaler_img_destroy(); |
685 |
680 |
scaler_img_create(fr); |
scaler_img_create(fr); |
File npv/video/namespace/main.c changed (mode: 100644) (index 91c569b..98d4deb) |
25 |
25 |
#define init_once_local npv_video_init_once_local |
#define init_once_local npv_video_init_once_local |
26 |
26 |
#define init_once_public npv_video_init_once_public |
#define init_once_public npv_video_init_once_public |
27 |
27 |
#define interrupted_rendering npv_video_iinterrupted_rendering |
#define interrupted_rendering npv_video_iinterrupted_rendering |
28 |
|
#define is_swpchn_sem_consistent npv_video_is_swpchn_sem_consistent |
|
29 |
|
#define is_swpchn_sem_fence_submitted_l npv_video_is_swpchn_sem_fence_submitted_l |
|
30 |
28 |
#define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l |
#define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l |
31 |
29 |
#define match_mem_type npv_video_match_mem_type |
#define match_mem_type npv_video_match_mem_type |
32 |
30 |
#define normal_rendering npv_video_normal_rendering |
#define normal_rendering npv_video_normal_rendering |
|
42 |
40 |
#define select_fr npv_video_select_fr |
#define select_fr npv_video_select_fr |
43 |
41 |
#define send_to_pe npv_video_send_to_pe |
#define send_to_pe npv_video_send_to_pe |
44 |
42 |
#define start_scaling npv_video_start_scaling |
#define start_scaling npv_video_start_scaling |
45 |
|
#define swpchn_next_img npv_video_swpchn_next_img |
|
|
43 |
|
#define start_swpchn_next_img npv_video_start_swpchn_next_img |
46 |
44 |
#define timer_ack npv_video_timer_ack |
#define timer_ack npv_video_timer_ack |
47 |
45 |
#define tmp_mem_rqmts_l npv_video_tmp_mem_rqmts_l |
#define tmp_mem_rqmts_l npv_video_tmp_mem_rqmts_l |
48 |
46 |
#define tmp_scaler_img_mem_rqmts_get npv_video_tmp_scaler_img_mem_rqmts_get |
#define tmp_scaler_img_mem_rqmts_get npv_video_tmp_scaler_img_mem_rqmts_get |
|
77 |
75 |
#undef init_once_local |
#undef init_once_local |
78 |
76 |
#undef init_once_public |
#undef init_once_public |
79 |
77 |
#undef interrupted_rendering |
#undef interrupted_rendering |
80 |
|
#undef is_swpchn_sem_consistent |
|
81 |
|
#undef is_swpchn_sem_fence_submitted_l |
|
82 |
78 |
#undef last_fr_sent_to_pe_l |
#undef last_fr_sent_to_pe_l |
83 |
79 |
#undef match_mem_type |
#undef match_mem_type |
84 |
80 |
#undef normal_rendering |
#undef normal_rendering |
|
94 |
90 |
#undef select_fr |
#undef select_fr |
95 |
91 |
#undef send_to_pe |
#undef send_to_pe |
96 |
92 |
#undef start_scaling |
#undef start_scaling |
97 |
|
#undef swpchn_next_img |
|
|
93 |
|
#undef start_swpchn_next_img |
98 |
94 |
#undef timer_ack |
#undef timer_ack |
99 |
95 |
#undef tmp_mem_rqmts_l |
#undef tmp_mem_rqmts_l |
100 |
96 |
#undef tmp_scaler_img_mem_rqmts_get |
#undef tmp_scaler_img_mem_rqmts_get |
File npv/vk/api_usage.h changed (mode: 100644) (index f2f1b61..140d558) |
... |
... |
r = npv_vk_surf_p.dev.dl_vk_map_mem(npv_vk_surf_p.dev.vk, dev_mem, 0, vk_whole_s |
51 |
51 |
#define vk_unmap_mem(dev_mem) \ |
#define vk_unmap_mem(dev_mem) \ |
52 |
52 |
npv_vk_surf_p.dev.dl_vk_unmap_mem(npv_vk_surf_p.dev.vk, dev_mem) |
npv_vk_surf_p.dev.dl_vk_unmap_mem(npv_vk_surf_p.dev.vk, dev_mem) |
53 |
53 |
|
|
54 |
|
#define vk_alloc_cbs(info) \ |
|
55 |
|
r = npv_vk_surf_p.dev.dl_vk_alloc_cbs(npv_vk_surf_p.dev.vk, info, npv_vk_surf_p.dev.cbs) |
|
|
54 |
|
#define vk_alloc_cbs(info, cbs) \ |
|
55 |
|
r = npv_vk_surf_p.dev.dl_vk_alloc_cbs(npv_vk_surf_p.dev.vk, info, cbs) |
56 |
56 |
|
|
57 |
57 |
#define vk_begin_cb(...) \ |
#define vk_begin_cb(...) \ |
58 |
58 |
r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__) |
r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__) |
|
... |
... |
r = npv_vk_surf_p.dev.dl_vk_begin_cb(__VA_ARGS__) |
60 |
60 |
#define vk_end_cb(...) \ |
#define vk_end_cb(...) \ |
61 |
61 |
r = npv_vk_surf_p.dev.dl_vk_end_cb(__VA_ARGS__) |
r = npv_vk_surf_p.dev.dl_vk_end_cb(__VA_ARGS__) |
62 |
62 |
|
|
|
63 |
|
/* we only use this for image barriers, logical layout transition, then bottom of pipe everywhere */ |
63 |
64 |
#define vk_cmd_pl_barrier(cb, b) \ |
#define vk_cmd_pl_barrier(cb, b) \ |
64 |
|
npv_vk_surf_p.dev.dl_vk_cmd_pl_barrier(cb, vk_pl_stage_top_of_pipe_bit, vk_pl_stage_top_of_pipe_bit, 0, 0, 0, 0, 0, 1, b) |
|
|
65 |
|
npv_vk_surf_p.dev.dl_vk_cmd_pl_barrier(cb, vk_pl_stage_bottom_of_pipe_bit, vk_pl_stage_bottom_of_pipe_bit, 0, 0, 0, 0, 0, 1, b) |
65 |
66 |
|
|
66 |
67 |
#define vk_q_submit(info, fence) \ |
#define vk_q_submit(info, fence) \ |
67 |
68 |
r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, fence) |
r = npv_vk_surf_p.dev.dl_vk_q_submit(npv_vk_surf_p.dev.q, 1, info, fence) |
|
... |
... |
r = npv_vk_surf_p.dev.dl_vk_create_sem(npv_vk_surf_p.dev.vk, info, 0, sem) |
89 |
90 |
|
|
90 |
91 |
#define vk_cmd_clr_color_img npv_vk_surf_p.dev.dl_vk_cmd_clr_color_img |
#define vk_cmd_clr_color_img npv_vk_surf_p.dev.dl_vk_cmd_clr_color_img |
91 |
92 |
|
|
92 |
|
#define vk_create_fence(info) \ |
|
93 |
|
r = npv_vk_surf_p.dev.dl_vk_create_fence(npv_vk_surf_p.dev.vk, info, 0, &npv_vk_surf_p.dev.fence) |
|
|
93 |
|
#define vk_create_fence(info,fencep) \ |
|
94 |
|
r = npv_vk_surf_p.dev.dl_vk_create_fence(npv_vk_surf_p.dev.vk, info, 0, fencep) |
94 |
95 |
|
|
95 |
|
#define vk_get_fence_status() \ |
|
96 |
|
r = npv_vk_surf_p.dev.dl_vk_get_fence_status(npv_vk_surf_p.dev.vk, npv_vk_surf_p.dev.fence) |
|
|
96 |
|
#define vk_get_fence_status(fence) \ |
|
97 |
|
r = npv_vk_surf_p.dev.dl_vk_get_fence_status(npv_vk_surf_p.dev.vk, fence) |
97 |
98 |
|
|
98 |
|
#define vk_reset_fences() \ |
|
99 |
|
r = npv_vk_surf_p.dev.dl_vk_reset_fences(npv_vk_surf_p.dev.vk, 1, &npv_vk_surf_p.dev.fence) |
|
|
99 |
|
#define vk_reset_fences(fences) \ |
|
100 |
|
r = npv_vk_surf_p.dev.dl_vk_reset_fences(npv_vk_surf_p.dev.vk, 1, fences) |
|
101 |
|
|
|
102 |
|
/* 100 ms timeout, any fence signaled */ |
|
103 |
|
#define vk_wait_for_fences(fences) \ |
|
104 |
|
r = npv_vk_surf_p.dev.dl_vk_wait_for_fences(npv_vk_surf_p.dev.vk, 1, fences, 0, 100000000) |
100 |
105 |
/******************************************************************************/ |
/******************************************************************************/ |
101 |
106 |
/* cherry picked and namespaced from nyanvk/syms_global.h */ |
/* cherry picked and namespaced from nyanvk/syms_global.h */ |
102 |
107 |
#define VK_GLOBAL_SYMS \ |
#define VK_GLOBAL_SYMS \ |
File npv/vk/local/code.frag.c changed (mode: 100644) (index ff2810d..e037deb) |
... |
... |
STATIC void dev_syms(void) |
89 |
89 |
DEV_SYM(vkCreateFence, vk_create_fence); |
DEV_SYM(vkCreateFence, vk_create_fence); |
90 |
90 |
DEV_SYM(vkGetFenceStatus, vk_get_fence_status); |
DEV_SYM(vkGetFenceStatus, vk_get_fence_status); |
91 |
91 |
DEV_SYM(vkResetFences, vk_reset_fences); |
DEV_SYM(vkResetFences, vk_reset_fences); |
|
92 |
|
DEV_SYM(vkWaitForFences, vk_wait_for_fences); |
92 |
93 |
} |
} |
93 |
94 |
#undef DEVICE_SYM |
#undef DEVICE_SYM |
94 |
95 |
/*----------------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------------*/ |
|
... |
... |
STATIC void sems_create(void) |
910 |
911 |
++sem; |
++sem; |
911 |
912 |
} |
} |
912 |
913 |
} |
} |
913 |
|
STATIC void fence_create(void) |
|
|
914 |
|
STATIC void fences_create(void) |
914 |
915 |
{ |
{ |
915 |
916 |
s32 r; |
s32 r; |
916 |
917 |
struct vk_fence_create_info_t info; |
struct vk_fence_create_info_t info; |
|
... |
... |
STATIC void fence_create(void) |
918 |
919 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
919 |
920 |
info.type = vk_struct_type_fence_create_info; |
info.type = vk_struct_type_fence_create_info; |
920 |
921 |
info.flags = vk_fence_create_signaled_bit; |
info.flags = vk_fence_create_signaled_bit; |
921 |
|
vk_create_fence(&info); |
|
|
922 |
|
vk_create_fence(&info, &surf_p.dev.fence); |
922 |
923 |
IF_FATALVK("%d:device:%p:unable to create the synchronization fence\n", r, surf_p.dev.vk); |
IF_FATALVK("%d:device:%p:unable to create the synchronization fence\n", r, surf_p.dev.vk); |
923 |
924 |
pout("device:%p:synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence); |
pout("device:%p:synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence); |
|
925 |
|
|
|
926 |
|
memset(&info, 0, sizeof(info)); |
|
927 |
|
info.type = vk_struct_type_fence_create_info; |
|
928 |
|
vk_create_fence(&info, &surf_p.dev.fence_color_space_layout); |
|
929 |
|
IF_FATALVK("%d:device:%p:unable to create the synchronization fence for the color space layout transition\n", r, surf_p.dev.vk); |
|
930 |
|
pout("device:%p:color space layout transition synchronization fence created %p\n", surf_p.dev.vk, surf_p.dev.fence_color_space_layout); |
|
931 |
|
} |
|
932 |
|
STATIC void misc_cbs_init_once(void) |
|
933 |
|
{ |
|
934 |
|
s32 r; |
|
935 |
|
struct vk_cb_alloc_info_t alloc_info; |
|
936 |
|
|
|
937 |
|
memset(&alloc_info, 0, sizeof(alloc_info)); |
|
938 |
|
alloc_info.type = vk_struct_type_cb_alloc_info; |
|
939 |
|
alloc_info.cp = surf_p.dev.cp; |
|
940 |
|
alloc_info.lvl = vk_cb_lvl_primary; |
|
941 |
|
alloc_info.cbs_n = 1; |
|
942 |
|
vk_alloc_cbs(&alloc_info,npv_vk_surf_p.dev.misc_cbs); |
|
943 |
|
IF_FATALVK("%d:device:%p:unable to allocate a miscellaneous command buffer from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp); |
|
944 |
|
pout("device:%p:allocated a miscellaneous command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.cp); |
924 |
945 |
} |
} |
925 |
946 |
STATIC void swpchn_imgs_cbs_init_once(void) |
STATIC void swpchn_imgs_cbs_init_once(void) |
926 |
947 |
{ |
{ |
|
... |
... |
STATIC void swpchn_imgs_cbs_init_once(void) |
932 |
953 |
alloc_info.cp = surf_p.dev.cp; |
alloc_info.cp = surf_p.dev.cp; |
933 |
954 |
alloc_info.lvl = vk_cb_lvl_primary; |
alloc_info.lvl = vk_cb_lvl_primary; |
934 |
955 |
alloc_info.cbs_n = swpchn_imgs_n_max; |
alloc_info.cbs_n = swpchn_imgs_n_max; |
935 |
|
vk_alloc_cbs(&alloc_info); |
|
|
956 |
|
vk_alloc_cbs(&alloc_info,npv_vk_surf_p.dev.cbs); |
936 |
957 |
IF_FATALVK("%d:device:%p:unable to allocate command buffers for our swapchain images from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp); |
IF_FATALVK("%d:device:%p:unable to allocate command buffers for our swapchain images from %p command pool\n", r, surf_p.dev.vk, surf_p.dev.cp); |
937 |
958 |
pout("device:%p:allocated %u command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.swpchn.imgs_n, surf_p.dev.cp); |
pout("device:%p:allocated %u command buffers for our swapchain images from %p command pool\n", surf_p.dev.vk, surf_p.dev.swpchn.imgs_n, surf_p.dev.cp); |
938 |
959 |
} |
} |
File npv/vk/namespace/public.h changed (mode: 100644) (index 37b14b6..f79b262) |
1 |
1 |
#ifndef CLEANUP |
#ifndef CLEANUP |
2 |
|
#define dev_t npv_vk_dev_t |
|
3 |
|
#define fatal npv_vk_fatal |
|
4 |
|
#define init_once npv_vk_init_once |
|
5 |
|
#define phydev_t npv_vk_phydev_t |
|
6 |
|
#define sem_acquire_img_done npv_vk_sem_acquire_img_done |
|
7 |
|
#define sem_blit_done npv_vk_sem_blit_done |
|
8 |
|
#define sems_n npv_vk_sems_n |
|
9 |
|
#define surf_p npv_vk_surf_p |
|
10 |
|
#define surf_init_once npv_vk_surf_init_once |
|
11 |
|
#define swpchn_update npv_vk_swpchn_update |
|
12 |
|
#define swpchn_imgs_n_max npv_vk_swpchn_imgs_n_max |
|
13 |
|
#define swpchn_t npv_vk_swpchn_t |
|
14 |
|
#define texel_mem_blk_fmt_t npv_vk_texel_mem_blk_fmt_t |
|
15 |
|
#define vfatal npv_vk_vfatal |
|
16 |
|
#define vwarning npv_vk_vwarning |
|
17 |
|
#define warning npv_vk_warning |
|
|
2 |
|
#define color_space_layout_transition npv_vk_color_space_layout_transition |
|
3 |
|
#define dev_t npv_vk_dev_t |
|
4 |
|
#define fatal npv_vk_fatal |
|
5 |
|
#define init_once npv_vk_init_once |
|
6 |
|
#define phydev_t npv_vk_phydev_t |
|
7 |
|
#define sem_acquire_img_done npv_vk_sem_acquire_img_done |
|
8 |
|
#define sem_blit_done npv_vk_sem_blit_done |
|
9 |
|
#define sems_n npv_vk_sems_n |
|
10 |
|
#define surf_p npv_vk_surf_p |
|
11 |
|
#define surf_init_once npv_vk_surf_init_once |
|
12 |
|
#define swpchn_update npv_vk_swpchn_update |
|
13 |
|
#define swpchn_imgs_n_max npv_vk_swpchn_imgs_n_max |
|
14 |
|
#define swpchn_t npv_vk_swpchn_t |
|
15 |
|
#define texel_mem_blk_fmt_t npv_vk_texel_mem_blk_fmt_t |
|
16 |
|
#define vfatal npv_vk_vfatal |
|
17 |
|
#define vwarning npv_vk_vwarning |
|
18 |
|
#define warning npv_vk_warning |
18 |
19 |
/*============================================================================*/ |
/*============================================================================*/ |
19 |
20 |
#else |
#else |
|
21 |
|
#undef color_space_layout_transition |
20 |
22 |
#undef dev_t |
#undef dev_t |
21 |
23 |
#undef fatal |
#undef fatal |
22 |
24 |
#undef init_once |
#undef init_once |