Skip to content

Commit a13b276

Browse files
Merge pull request #146 from GPUOpen-LibrariesAndSDKs/update_wk14
Bug-fixes and improvements.
2 parents 5dab34f + abfe7eb commit a13b276

22 files changed

Lines changed: 591 additions & 497 deletions

CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@ option(ANVIL_INCLUDE_XCB_WINDOW_SYSTEM_SUPPORT "Includes XCB window system s
66
option(ANVIL_LINK_EXAMPLES "Build examples showing how to use Anvil" OFF)
77
option(ANVIL_LINK_STATICALLY_WITH_VULKAN_LIB "Link statically with Vulkan loader. If disabled, Anvil will load the func ptrs from ANVIL_VULKAN_DYNAMIC_DLL_DEPENDENCY at VK instance creation time" ON)
88
option(ANVIL_LINK_WITH_GLSLANG "Links with glslang, instead of spawning a new process whenever GLSL->SPIR-V conversion is required" ON)
9+
option(ANVIL_USE_BUILT_IN_GLSLANG "Use glslang version included with Anvil. If disabled, Anvil will assume ANVIL_GLSLANG_PATH holds path to library's root directory." ON)
910
option(ANVIL_USE_BUILT_IN_VULKAN_HEADERS "Use built-in Vulkan headers. If disabled, VK_SDK_PATH and VULKAN_SDK env vars will be assumed to hold the location where the headers can be found." ON)
1011

11-
1212
if (MSVC)
1313
set (DEFAULT_DYNAMIC_VK_DLL "vulkan-1.dll")
1414
else()
1515
set (DEFAULT_DYNAMIC_VK_DLL "libvulkan.so")
1616
endif()
1717

18+
if (ANVIL_USE_BUILT_IN_GLSLANG)
19+
set(ANVIL_GLSLANG_PATH "${Anvil_SOURCE_DIR}/deps/glslang")
20+
else()
21+
set(ANVIL_GLSLANG_PATH "${Anvil_SOURCE_DIR}/deps/glslang"
22+
CACHE STRING "Path to glslang directory")
23+
endif()
24+
1825
if (NOT ANVIL_LINK_STATICALLY_WITH_VULKAN_LIB)
1926
set(ANVIL_VULKAN_DYNAMIC_DLL "${DEFAULT_DYNAMIC_VK_DLL}"
2027
CACHE STRING "DLL to load Vulkan entrypoints from at Vulkan instance creation time. Only used if ANVIL_LINK_STATICALLY_WITH_VULKAN_LIB is disabled. Only occurs at first Vulkan instance creation time")
@@ -31,6 +38,7 @@ configure_file("include/config.h.in" "include/config.h")
3138
include_directories("${Anvil_BINARY_DIR}/include"
3239
"${Anvil_SOURCE_DIR}"
3340
"${Anvil_SOURCE_DIR}/deps"
41+
"${ANVIL_GLSLANG_PATH}"
3442
"${Anvil_SOURCE_DIR}/include")
3543

3644
# Include the Vulkan header.
@@ -261,7 +269,7 @@ if (WIN32)
261269
target_link_libraries(Anvil glslang OGLCompiler OSDependent SPIRV ${VULKAN_LIBRARY})
262270
else()
263271
target_link_libraries(Anvil ${VULKAN_LIBRARY})
264-
endif()
272+
endif()
265273
else()
266274
if (ANVIL_LINK_WITH_GLSLANG)
267275
target_link_libraries(Anvil glslang OGLCompiler OSDependent SPIRV ${VULKAN_LIBRARY} pthread)
@@ -281,11 +289,7 @@ if (ANVIL_LINK_WITH_GLSLANG)
281289
set(ENABLE_HLSL OFF CACHE BOOL ".." FORCE)
282290
set(ENABLE_OPT OFF CACHE BOOL ".." FORCE)
283291

284-
if (WIN32)
285-
add_subdirectory("deps\\glslang")
286-
else()
287-
add_subdirectory("deps/glslang")
288-
endif()
292+
add_subdirectory("${ANVIL_GLSLANG_PATH}")
289293
endif()
290294

291295
if (ANVIL_LINK_EXAMPLES)

examples/DynamicBuffers/src/app.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,7 @@ void App::init_dsgs()
880880

881881
/* Create the descriptor set layouts for the generator program. */
882882
m_producer_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
883-
producer_dsg_create_info_ptrs,
884-
false); /* releaseable_sets */
883+
producer_dsg_create_info_ptrs);
885884

886885

887886
m_producer_dsg_ptr->set_binding_item(0, /* n_set */
@@ -902,8 +901,7 @@ void App::init_dsgs()
902901

903902
/* Set up the descriptor set layout for the renderer program. */
904903
m_consumer_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
905-
consumer_dsg_create_info_ptrs,
906-
false); /* releaseable_sets */
904+
consumer_dsg_create_info_ptrs);
907905

908906

909907
m_consumer_dsg_ptr->set_binding_item(0, /* n_set */
@@ -1019,11 +1017,18 @@ void App::init_gfx_pipelines()
10191017
Anvil::ShaderModuleStageEntryPoint(), /* tess_evaluation_shader */
10201018
*m_consumer_vs_ptr);
10211019

1022-
consumer_pipeline_info_ptr->add_vertex_attribute (0, /* location */
1023-
Anvil::Format::R8G8_UNORM,
1024-
0, /* offset_in_bytes */
1025-
sizeof(char) * 2, /* stride_in_bytes */
1026-
Anvil::VertexInputRate::INSTANCE);
1020+
{
1021+
Anvil::VertexInputAttribute attribute(0, /* in_location */
1022+
Anvil::Format::R8G8_UNORM,
1023+
0); /* in_offset_in_bytes */
1024+
1025+
consumer_pipeline_info_ptr->add_vertex_binding(0, /* in_binding */
1026+
Anvil::VertexInputRate::INSTANCE,
1027+
sizeof(char) * 2, /* in_stride_in_bytes */
1028+
1, /* in_attribute_ptrs */
1029+
&attribute);
1030+
}
1031+
10271032
consumer_pipeline_info_ptr->set_descriptor_set_create_info(m_consumer_dsg_ptr->get_descriptor_set_create_info() );
10281033
consumer_pipeline_info_ptr->set_primitive_topology (Anvil::PrimitiveTopology::LINE_STRIP);
10291034
consumer_pipeline_info_ptr->set_rasterization_properties (Anvil::PolygonMode::FILL,

examples/MultiViewport/src/app.cpp

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -736,36 +736,65 @@ void App::init_gfx_pipelines()
736736
Anvil::DynamicState::VIEWPORT);
737737
gfx_pipeline_create_info_ptr->toggle_primitive_restart (true /* should_enable */);
738738

739-
gfx_pipeline_create_info_ptr->add_vertex_attribute(g_vertex_attribute_location,
740-
mesh_vertex_data_format,
741-
0, /* offset_in_bytes */
742-
sizeof(float) * n_mesh_vertex_components, /* stride_in_bytes */
743-
Anvil::VertexInputRate::VERTEX,
744-
g_vertex_attribute_binding);
745-
gfx_pipeline_create_info_ptr->add_vertex_attribute(g_color1_attribute_location,
746-
mesh_color_data_format,
747-
0, /* offset_in_bytes */
748-
sizeof(float) * n_mesh_color_components, /* stride_in_bytes */
749-
Anvil::VertexInputRate::VERTEX,
750-
g_color1_attribute_binding);
751-
gfx_pipeline_create_info_ptr->add_vertex_attribute(g_color2_attribute_location,
752-
mesh_color_data_format,
753-
0, /* offset_in_bytes */
754-
sizeof(float) * n_mesh_color_components, /* stride_in_bytes */
755-
Anvil::VertexInputRate::VERTEX,
756-
g_color2_attribute_binding);
757-
gfx_pipeline_create_info_ptr->add_vertex_attribute(g_color3_attribute_location,
758-
mesh_color_data_format,
759-
0, /* offset_in_bytes */
760-
sizeof(float) * n_mesh_color_components, /* stride_in_bytes */
761-
Anvil::VertexInputRate::VERTEX,
762-
g_color3_attribute_binding);
763-
gfx_pipeline_create_info_ptr->add_vertex_attribute(g_color4_attribute_location,
764-
mesh_color_data_format,
765-
0, /* offset_in_bytes */
766-
sizeof(float) * n_mesh_color_components, /* stride_in_bytes */
767-
Anvil::VertexInputRate::VERTEX,
768-
g_color4_attribute_binding);
739+
{
740+
Anvil::VertexInputAttribute attribute(g_vertex_attribute_location,
741+
mesh_vertex_data_format,
742+
0); /* in_offset_in_bytes */
743+
744+
gfx_pipeline_create_info_ptr->add_vertex_binding(g_vertex_attribute_binding,
745+
Anvil::VertexInputRate::VERTEX,
746+
sizeof(float) * n_mesh_vertex_components, /* in_stride_in_bytes */
747+
1, /* in_n_attributes */
748+
&attribute);
749+
}
750+
751+
{
752+
Anvil::VertexInputAttribute attribute(g_color1_attribute_location,
753+
mesh_color_data_format,
754+
0); /* in_offset_in_bytes */
755+
756+
gfx_pipeline_create_info_ptr->add_vertex_binding(g_color1_attribute_binding,
757+
Anvil::VertexInputRate::VERTEX,
758+
sizeof(float) * n_mesh_color_components, /* in_stride_in_bytes */
759+
1, /* in_n_attributes */
760+
&attribute);
761+
}
762+
763+
{
764+
Anvil::VertexInputAttribute attribute(g_color2_attribute_location,
765+
mesh_color_data_format,
766+
0); /* in_offset_in_bytes */
767+
768+
gfx_pipeline_create_info_ptr->add_vertex_binding(g_color2_attribute_binding,
769+
Anvil::VertexInputRate::VERTEX,
770+
sizeof(float) * n_mesh_color_components, /* in_stride_in_bytes */
771+
1, /* in_n_attributes */
772+
&attribute);
773+
}
774+
775+
{
776+
Anvil::VertexInputAttribute attribute(g_color3_attribute_location,
777+
mesh_color_data_format,
778+
0); /* in_offset_in_bytes */
779+
780+
gfx_pipeline_create_info_ptr->add_vertex_binding(g_color3_attribute_binding,
781+
Anvil::VertexInputRate::VERTEX,
782+
sizeof(float) * n_mesh_color_components, /* in_stride_in_bytes */
783+
1, /* in_n_attributes */
784+
&attribute);
785+
}
786+
787+
{
788+
Anvil::VertexInputAttribute attribute(g_color4_attribute_location,
789+
mesh_color_data_format,
790+
0); /* in_offset_in_bytes */
791+
792+
gfx_pipeline_create_info_ptr->add_vertex_binding(g_color4_attribute_binding,
793+
Anvil::VertexInputRate::VERTEX,
794+
sizeof(float) * n_mesh_color_components, /* in_stride_in_bytes */
795+
1, /* in_n_attributes */
796+
&attribute);
797+
}
769798

770799
for (uint32_t n_scissor_box = 0;
771800
n_scissor_box < sizeof(scissors) / sizeof(scissors[0]);

examples/OcclusionQuery/src/app.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,14 +627,11 @@ void App::init_dsgs()
627627
Anvil::ShaderStageFlagBits::VERTEX_BIT);
628628

629629
m_1stpass_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
630-
dsg_1stpass_create_info_ptrs,
631-
false); /* in_releaseable_sets */
630+
dsg_1stpass_create_info_ptrs);
632631
m_2ndpass_tri_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
633-
tri_dsg_2ndpass_create_info_ptrs,
634-
false); /* in_releaseable_sets */
632+
tri_dsg_2ndpass_create_info_ptrs);
635633
m_2ndpass_quad_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
636-
quad_dsg_2ndpass_create_info_ptrs,
637-
false); /* in_releaseable_sets */
634+
quad_dsg_2ndpass_create_info_ptrs);
638635

639636
m_1stpass_dsg_ptr->set_binding_item (0, /* n_set */
640637
0, /* binding_index */

examples/OutOfOrderRasterization/src/app.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,8 +1441,7 @@ void App::init_dsgs()
14411441
Anvil::ShaderStageFlagBits::VERTEX_BIT);
14421442

14431443
new_dsg_ptr = Anvil::DescriptorSetGroup::create(m_device_ptr.get(),
1444-
new_dsg_create_info_ptr,
1445-
false); /* in_releaseable_sets */
1444+
new_dsg_create_info_ptr);
14461445
}
14471446

14481447
new_dsg_ptr->set_binding_item(0, /* n_set */
@@ -1482,11 +1481,17 @@ void App::init_gfx_pipelines()
14821481
Anvil::ShaderModuleStageEntryPoint(), /* in_te_entrypoint */
14831482
*m_vs_entrypoint_ptr);
14841483

1485-
pipeline_create_info_ptr->add_vertex_attribute(0, /* location */
1486-
Anvil::Format::R32G32B32_SFLOAT,
1487-
0, /* offset_in_bytes */
1488-
sizeof(float) * 3, /* stride_in_bytes */
1489-
Anvil::VertexInputRate::VERTEX);
1484+
{
1485+
auto attribute = Anvil::VertexInputAttribute(0, /* location */
1486+
Anvil::Format::R32G32B32_SFLOAT,
1487+
0); /* offset_in_bytes */
1488+
1489+
pipeline_create_info_ptr->add_vertex_binding(0, /* in_binding */
1490+
Anvil::VertexInputRate::VERTEX,
1491+
sizeof(float) * 3, /* in_stride_in_bytes */
1492+
1, /* in_n_attributes */
1493+
&attribute);
1494+
}
14901495

14911496
pipeline_create_info_ptr->set_descriptor_set_create_info(m_dsg_ptrs[0]->get_descriptor_set_create_info() );
14921497

@@ -1708,11 +1713,18 @@ void App::init_renderpasses()
17081713
Anvil::ShaderModuleStageEntryPoint(), /* in_te_entrypoint */
17091714
*m_vs_entrypoint_ptr);
17101715

1711-
gfx_pipeline_create_info_ptr->add_vertex_attribute (0, /* location */
1712-
Anvil::Format::R32G32B32_SFLOAT,
1713-
0, /* offset_in_bytes */
1714-
sizeof(float) * 3, /* stride_in_bytes */
1715-
Anvil::VertexInputRate::VERTEX);
1716+
{
1717+
auto attribute = Anvil::VertexInputAttribute(0, /* location */
1718+
Anvil::Format::R32G32B32_SFLOAT,
1719+
0); /* offset_in_bytes */
1720+
1721+
gfx_pipeline_create_info_ptr->add_vertex_binding(0, /* in_binding */
1722+
Anvil::VertexInputRate::VERTEX,
1723+
sizeof(float) * 3, /* stride_in_bytes */
1724+
1, /* in_n_attributes */
1725+
&attribute);
1726+
}
1727+
17161728
gfx_pipeline_create_info_ptr->set_descriptor_set_create_info(m_dsg_ptrs[0]->get_descriptor_set_create_info() );
17171729

17181730
gfx_manager_ptr->add_pipeline(std::move(gfx_pipeline_create_info_ptr),

0 commit comments

Comments
 (0)