Skip to content

Commit 6613abc

Browse files
Merge pull request #138 from GPUOpen-LibrariesAndSDKs/update_wk3
Update (wk3 of 2019)
2 parents deed560 + 5937fd4 commit 6613abc

57 files changed

Lines changed: 2405 additions & 727 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ SET (SRC_LIST "${Anvil_SOURCE_DIR}/include/misc/memalloc_backends/backend_onesho
7777
"${Anvil_SOURCE_DIR}/include/misc/graphics_pipeline_create_info.h"
7878
"${Anvil_SOURCE_DIR}/include/misc/image_create_info.h"
7979
"${Anvil_SOURCE_DIR}/include/misc/image_view_create_info.h"
80+
"${Anvil_SOURCE_DIR}/include/misc/instance_create_info.h"
8081
"${Anvil_SOURCE_DIR}/include/misc/io.h"
8182
"${Anvil_SOURCE_DIR}/include/misc/library.h"
8283
"${Anvil_SOURCE_DIR}/include/misc/memory_allocator.h"
@@ -157,6 +158,7 @@ SET (SRC_LIST "${Anvil_SOURCE_DIR}/include/misc/memalloc_backends/backend_onesho
157158
"${Anvil_SOURCE_DIR}/src/misc/graphics_pipeline_create_info.cpp"
158159
"${Anvil_SOURCE_DIR}/src/misc/image_create_info.cpp"
159160
"${Anvil_SOURCE_DIR}/src/misc/image_view_create_info.cpp"
161+
"${Anvil_SOURCE_DIR}/src/misc/instance_create_info.cpp"
160162
"${Anvil_SOURCE_DIR}/src/misc/io.cpp"
161163
"${Anvil_SOURCE_DIR}/src/misc/library.cpp"
162164
"${Anvil_SOURCE_DIR}/src/misc/memory_allocator.cpp"

examples/DynamicBuffers/src/app.cpp

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "misc/graphics_pipeline_create_info.h"
3838
#include "misc/image_create_info.h"
3939
#include "misc/image_view_create_info.h"
40+
#include "misc/instance_create_info.h"
4041
#include "misc/io.h"
4142
#include "misc/memory_allocator.h"
4243
#include "misc/object_tracker.h"
@@ -291,8 +292,14 @@ void App::draw_frame()
291292
present_wait_semaphore_ptr = curr_frame_signal_semaphore_ptr;
292293

293294
/* Determine the semaphore which the swapchain image */
294-
n_swapchain_image = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
295-
true); /* in_should_block */
295+
{
296+
const auto acquire_result = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
297+
&n_swapchain_image,
298+
true /* in_should_block */);
299+
300+
ANVIL_REDUNDANT_VARIABLE_CONST(acquire_result);
301+
anvil_assert (acquire_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
302+
}
296303

297304
/* Update time value, used by the generator compute shader */
298305
const uint64_t time_msec = m_time.get_time_in_msec();
@@ -313,10 +320,17 @@ void App::draw_frame()
313320
false) /* should_block */
314321
);
315322

316-
m_present_queue_ptr->present(m_swapchain_ptr.get(),
317-
n_swapchain_image,
318-
1, /* n_wait_semaphores */
319-
&present_wait_semaphore_ptr);
323+
{
324+
Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
325+
326+
m_present_queue_ptr->present(m_swapchain_ptr.get(),
327+
n_swapchain_image,
328+
1, /* n_wait_semaphores */
329+
&present_wait_semaphore_ptr,
330+
&present_result);
331+
332+
anvil_assert(present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
333+
}
320334

321335
++n_frames_rendered;
322336

@@ -1227,17 +1241,21 @@ void App::init_window()
12271241
void App::init_vulkan()
12281242
{
12291243
/* Create a Vulkan instance */
1230-
m_instance_ptr = Anvil::Instance::create(APP_NAME, /* app_name */
1231-
APP_NAME, /* engine_name */
1244+
{
1245+
auto create_info_ptr = Anvil::InstanceCreateInfo::create(APP_NAME, /* app_name */
1246+
APP_NAME, /* engine_name */
12321247
#ifdef ENABLE_VALIDATION
1233-
std::bind(&App::on_validation_callback,
1234-
this,
1235-
std::placeholders::_1,
1236-
std::placeholders::_2),
1248+
std::bind(&App::on_validation_callback,
1249+
this,
1250+
std::placeholders::_1,
1251+
std::placeholders::_2),
12371252
#else
1238-
Anvil::DebugCallbackFunction(),
1253+
Anvil::DebugCallbackFunction(),
12391254
#endif
1240-
false); /* in_mt_safe */
1255+
false); /* in_mt_safe */
1256+
1257+
m_instance_ptr = Anvil::Instance::create(std::move(create_info_ptr) );
1258+
}
12411259

12421260
m_physical_device_ptr = m_instance_ptr->get_physical_device(0);
12431261

examples/MultiViewport/src/app.cpp

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "misc/framebuffer_create_info.h"
3434
#include "misc/glsl_to_spirv.h"
3535
#include "misc/graphics_pipeline_create_info.h"
36+
#include "misc/instance_create_info.h"
3637
#include "misc/object_tracker.h"
3738
#include "misc/render_pass_create_info.h"
3839
#include "misc/semaphore_create_info.h"
@@ -240,7 +241,13 @@ void App::draw_frame()
240241
curr_frame_wait_semaphore_ptr = m_frame_wait_semaphores [m_n_last_semaphore_used].get();
241242

242243
/* Determine the semaphore which the swapchain image */
243-
n_swapchain_image = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr);
244+
{
245+
const auto acquire_result = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
246+
&n_swapchain_image);
247+
248+
ANVIL_REDUNDANT_VARIABLE_CONST(acquire_result);
249+
anvil_assert (acquire_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
250+
}
244251

245252
/* Submit work chunk and present */
246253
m_device_ptr->get_universal_queue(0)->submit(
@@ -253,10 +260,18 @@ void App::draw_frame()
253260
false) /* should_block */
254261
);
255262

256-
present_queue_ptr->present(m_swapchain_ptr.get(),
257-
n_swapchain_image,
258-
1, /* n_wait_semaphores */
259-
&curr_frame_signal_semaphore_ptr);
263+
{
264+
Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
265+
266+
present_queue_ptr->present(m_swapchain_ptr.get(),
267+
n_swapchain_image,
268+
1, /* n_wait_semaphores */
269+
&curr_frame_signal_semaphore_ptr,
270+
&present_result);
271+
272+
ANVIL_REDUNDANT_VARIABLE(present_result);
273+
anvil_assert (present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
274+
}
260275

261276
#ifdef ENABLE_OFFSCREEN_RENDERING
262277
{
@@ -908,17 +923,21 @@ void App::init_window()
908923
void App::init_vulkan()
909924
{
910925
/* Create a Vulkan instance */
911-
m_instance_ptr = Anvil::Instance::create(APP_NAME, /* app_name */
912-
APP_NAME, /* engine_name */
926+
{
927+
auto create_info_ptr = Anvil::InstanceCreateInfo::create(APP_NAME, /* app_name */
928+
APP_NAME, /* engine_name */
913929
#ifdef ENABLE_VALIDATION
914-
std::bind(&App::on_validation_callback,
915-
this,
916-
std::placeholders::_1,
917-
std::placeholders::_2),
930+
std::bind(&App::on_validation_callback,
931+
this,
932+
std::placeholders::_1,
933+
std::placeholders::_2),
918934
#else
919-
Anvil::DebugCallbackFunction(),
935+
Anvil::DebugCallbackFunction(),
920936
#endif
921-
false); /* in_mt_safe */
937+
false); /* in_mt_safe */
938+
939+
m_instance_ptr = Anvil::Instance::create(std::move(create_info_ptr) );
940+
}
922941

923942
m_physical_device_ptr = m_instance_ptr->get_physical_device(0);
924943

examples/OcclusionQuery/src/app.cpp

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "misc/graphics_pipeline_create_info.h"
3636
#include "misc/image_create_info.h"
3737
#include "misc/image_view_create_info.h"
38+
#include "misc/instance_create_info.h"
3839
#include "misc/io.h"
3940
#include "misc/object_tracker.h"
4041
#include "misc/render_pass_create_info.h"
@@ -277,8 +278,14 @@ void App::draw_frame()
277278
present_wait_semaphore_ptr = curr_frame_signal_semaphore_ptr;
278279

279280
/* Determine the semaphore which the swapchain image */
280-
n_swapchain_image = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
281-
true); /* in_should_block */
281+
{
282+
const auto acquire_result = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
283+
&n_swapchain_image,
284+
true /* in_should_block */);
285+
286+
ANVIL_REDUNDANT_VARIABLE_CONST(acquire_result);
287+
anvil_assert (acquire_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
288+
}
282289

283290
/* Update time data */
284291
const float time = float(m_time.get_time_in_msec() ) / 1000.0f;
@@ -306,10 +313,18 @@ void App::draw_frame()
306313
false) /* should_block */
307314
);
308315

309-
present_queue_ptr->present(m_swapchain_ptr.get(),
310-
n_swapchain_image,
311-
1, /* n_wait_semaphores */
312-
&present_wait_semaphore_ptr);
316+
{
317+
Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
318+
319+
present_queue_ptr->present(m_swapchain_ptr.get(),
320+
n_swapchain_image,
321+
1, /* n_wait_semaphores */
322+
&present_wait_semaphore_ptr,
323+
&present_result);
324+
325+
ANVIL_REDUNDANT_VARIABLE(present_result);
326+
anvil_assert (present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
327+
}
313328

314329
++n_frames_rendered;
315330

@@ -1064,17 +1079,21 @@ void App::init_window()
10641079
void App::init_vulkan()
10651080
{
10661081
/* Create a Vulkan instance */
1067-
m_instance_ptr = Anvil::Instance::create(APP_NAME, /* in_app_name */
1068-
APP_NAME, /* in_engine_name */
1082+
{
1083+
auto create_info_ptr = Anvil::InstanceCreateInfo::create(APP_NAME, /* in_app_name */
1084+
APP_NAME, /* in_engine_name */
10691085
#ifdef ENABLE_VALIDATION
1070-
std::bind(&App::on_validation_callback,
1071-
this,
1072-
std::placeholders::_1,
1073-
std::placeholders::_2),
1086+
std::bind(&App::on_validation_callback,
1087+
this,
1088+
std::placeholders::_1,
1089+
std::placeholders::_2),
10741090
#else
1075-
Anvil::DebugCallbackFunction(),
1091+
Anvil::DebugCallbackFunction(),
10761092
#endif
1077-
false); /* in_mt_safe */
1093+
false); /* in_mt_safe */
1094+
1095+
m_instance_ptr = Anvil::Instance::create(std::move(create_info_ptr) );
1096+
}
10781097

10791098
m_physical_device_ptr = m_instance_ptr->get_physical_device(0);
10801099

examples/OutOfOrderRasterization/src/app.cpp

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "misc/graphics_pipeline_create_info.h"
3636
#include "misc/image_create_info.h"
3737
#include "misc/image_view_create_info.h"
38+
#include "misc/instance_create_info.h"
3839
#include "misc/io.h"
3940
#include "misc/memory_allocator.h"
4041
#include "misc/object_tracker.h"
@@ -306,8 +307,9 @@ void App::draw_frame()
306307

307308
/* Determine the semaphore which the swapchain image */
308309
{
309-
n_swapchain_image = m_swapchain_ptr->acquire_image(curr_frame_acqusition_wait_semaphore_ptr.get(),
310-
true); /* in_should_block */
310+
m_swapchain_ptr->acquire_image(curr_frame_acqusition_wait_semaphore_ptr.get(),
311+
&n_swapchain_image,
312+
true); /* in_should_block */
311313
}
312314

313315
/* Set up semaphores we're going to use to render this frame. */
@@ -378,10 +380,16 @@ void App::draw_frame()
378380
}
379381

380382
{
383+
Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
384+
381385
m_present_queue_ptr->present(m_swapchain_ptr.get(),
382-
n_swapchain_image,
383-
n_physical_devices, /* n_wait_semaphores */
384-
frame_ready_for_present_semaphores);
386+
n_swapchain_image,
387+
n_physical_devices, /* n_wait_semaphores */
388+
frame_ready_for_present_semaphores,
389+
&present_result);
390+
391+
ANVIL_REDUNDANT_VARIABLE(present_result);
392+
anvil_assert (present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
385393
}
386394

387395
++m_n_frames_drawn;
@@ -1144,17 +1152,21 @@ void App::init_window()
11441152
void App::init_vulkan()
11451153
{
11461154
/* Create a Vulkan instance */
1147-
m_instance_ptr = Anvil::Instance::create("OutOfOrderRasterization", /* app_name */
1148-
"OutOfOrderRasterization", /* engine_name */
1155+
{
1156+
auto create_info_ptr = Anvil::InstanceCreateInfo::create("OutOfOrderRasterization", /* app_name */
1157+
"OutOfOrderRasterization", /* engine_name */
11491158
#ifdef ENABLE_VALIDATION
1150-
std::bind(&App::on_validation_callback,
1151-
this,
1152-
std::placeholders::_1,
1153-
std::placeholders::_2),
1159+
std::bind(&App::on_validation_callback,
1160+
this,
1161+
std::placeholders::_1,
1162+
std::placeholders::_2),
11541163
#else
1155-
Anvil::DebugCallbackFunction(),
1164+
Anvil::DebugCallbackFunction(),
11561165
#endif
1157-
false); /* in_mt_safe */
1166+
false); /* in_mt_safe */
1167+
1168+
m_instance_ptr = Anvil::Instance::create(std::move(create_info_ptr) );
1169+
}
11581170

11591171
/* Determine which extensions we need to request for */
11601172
{

examples/PushConstants/src/app.cpp

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "misc/graphics_pipeline_create_info.h"
3737
#include "misc/image_create_info.h"
3838
#include "misc/image_view_create_info.h"
39+
#include "misc/instance_create_info.h"
3940
#include "misc/io.h"
4041
#include "misc/memory_allocator.h"
4142
#include "misc/object_tracker.h"
@@ -276,8 +277,14 @@ void App::draw_frame()
276277
present_wait_semaphore_ptr = curr_frame_signal_semaphore_ptr;
277278

278279
/* Determine the semaphore which the swapchain image */
279-
n_swapchain_image = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
280-
true); /* in_should_block */
280+
{
281+
const auto acquire_result = m_swapchain_ptr->acquire_image(curr_frame_wait_semaphore_ptr,
282+
&n_swapchain_image,
283+
true); /* in_should_block */
284+
285+
ANVIL_REDUNDANT_VARIABLE_CONST(acquire_result);
286+
anvil_assert (acquire_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
287+
}
281288

282289
/* Submit work chunk and present */
283290
update_data_ub_contents(n_swapchain_image);
@@ -292,10 +299,18 @@ void App::draw_frame()
292299
false /* should_block */)
293300
);
294301

295-
present_queue_ptr->present(m_swapchain_ptr.get(),
296-
n_swapchain_image,
297-
1, /* n_wait_semaphores */
298-
&present_wait_semaphore_ptr);
302+
{
303+
Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
304+
305+
present_queue_ptr->present(m_swapchain_ptr.get(),
306+
n_swapchain_image,
307+
1, /* n_wait_semaphores */
308+
&present_wait_semaphore_ptr,
309+
&present_result);
310+
311+
ANVIL_REDUNDANT_VARIABLE(present_result);
312+
anvil_assert (present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
313+
}
299314

300315
++n_frames_rendered;
301316

@@ -872,17 +887,21 @@ void App::init_window()
872887
void App::init_vulkan()
873888
{
874889
/* Create a Vulkan instance */
875-
m_instance_ptr = Anvil::Instance::create(APP_NAME, /* in_app_name */
876-
APP_NAME, /* in_engine_name */
890+
{
891+
auto create_info_ptr = Anvil::InstanceCreateInfo::create(APP_NAME, /* in_app_name */
892+
APP_NAME, /* in_engine_name */
877893
#ifdef ENABLE_VALIDATION
878-
std::bind(&App::on_validation_callback,
879-
this,
880-
std::placeholders::_1,
881-
std::placeholders::_2),
894+
std::bind(&App::on_validation_callback,
895+
this,
896+
std::placeholders::_1,
897+
std::placeholders::_2),
882898
#else
883-
Anvil::DebugCallbackFunction(),
899+
Anvil::DebugCallbackFunction(),
884900
#endif
885-
false); /* in_mt_safe */
901+
false); /* in_mt_safe */
902+
903+
m_instance_ptr = Anvil::Instance::create(std::move(create_info_ptr) );
904+
}
886905

887906
m_physical_device_ptr = m_instance_ptr->get_physical_device(0);
888907

0 commit comments

Comments
 (0)