Skip to content

Commit

Permalink
Update Granite.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed May 25, 2024
1 parent d7746d1 commit 66b9bf3
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Granite
Submodule Granite updated 246 files
3 changes: 3 additions & 0 deletions generate_standalone_codebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ cp -v Granite/util/temporary_hashmap.hpp "$OUTDIR/util/"
cp -v Granite/util/timeline_trace_file.* "$OUTDIR/util/"
cp -v Granite/util/thread_name.* "$OUTDIR/util/"
cp -v Granite/util/thread_id.* "$OUTDIR/util/"
cp -v Granite/util/dynamic_array.hpp "$OUTDIR/util/"
cp -v Granite/util/environment.* "$OUTDIR/util/"
cp -v Granite/third_party/volk/volk.h "$OUTDIR/volk/"
cp -v Granite/third_party/volk/volk.c "$OUTDIR/volk/"
cp -v Granite/vulkan/*.cpp "$OUTDIR/vulkan/"
cp -v Granite/vulkan/*.hpp "$OUTDIR/vulkan/"
rm "$OUTDIR/vulkan/*dxgi*"
cp -v Granite/vulkan/texture/texture_format.* "$OUTDIR/vulkan/texture"
cp -v Granite/third_party/khronos/vulkan-headers/include/vulkan/*.h "$OUTDIR/vulkan-headers/include/vulkan"
cp -v Granite/third_party/khronos/vulkan-headers/include/vk_video/*.h "$OUTDIR/vulkan-headers/include/vk_video"
Expand Down
4 changes: 4 additions & 0 deletions integration_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ struct GLFWPlatform : public Vulkan::WSIPlatform
glfwPollEvents();
}

void poll_input_async(Granite::InputTrackerHandler *) override
{
}

void update_framebuffer_size()
{
int actual_width, actual_height;
Expand Down
4 changes: 2 additions & 2 deletions integration_example_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ int main()

// Validate that the GL device and Vulkan device match. Relevant for Win32 where LUID is a thing.
auto &features = device.get_device_features();
if (features.id_properties.deviceLUIDValid)
if (features.vk11_props.deviceLUIDValid)
{
GLubyte luid[GL_LUID_SIZE_EXT] = {};
glGetUnsignedBytevEXT(GL_DEVICE_LUID_EXT, luid);

if (memcmp(features.id_properties.deviceLUID, luid, GL_LUID_SIZE_EXT) != 0)
if (memcmp(features.vk11_props.deviceLUID, luid, GL_LUID_SIZE_EXT) != 0)
{
LOGE("LUID mismatch.\n");
return EXIT_FAILURE;
Expand Down
1 change: 1 addition & 0 deletions parallel-rdp/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PARALLEL_RDP_SOURCES_CXX := \
$(PARALLEL_RDP_IMPLEMENTATION)/util/aligned_alloc.cpp \
$(PARALLEL_RDP_IMPLEMENTATION)/util/timer.cpp \
$(PARALLEL_RDP_IMPLEMENTATION)/util/timeline_trace_file.cpp \
$(PARALLEL_RDP_IMPLEMENTATION)/util/environment.cpp \
$(PARALLEL_RDP_IMPLEMENTATION)/util/thread_name.cpp

PARALLEL_RDP_SOURCES_C := \
Expand Down
46 changes: 23 additions & 23 deletions parallel-rdp/rdp_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,38 +165,38 @@ bool Renderer::init_caps()
LOGI("Allow small types = %d.\n", int(allow_small_types));
}

if (!features.storage_16bit_features.storageBuffer16BitAccess)
if (!features.vk11_features.storageBuffer16BitAccess)
{
LOGE("VK_KHR_16bit_storage for SSBOs is not supported! This is a minimum requirement for paraLLEl-RDP.\n");
LOGE("16-bit storage for SSBOs is not supported! This is a minimum requirement for paraLLEl-RDP.\n");
return false;
}

if (!features.storage_8bit_features.storageBuffer8BitAccess)
if (!features.vk12_features.storageBuffer8BitAccess)
{
LOGE("VK_KHR_8bit_storage for SSBOs is not supported! This is a minimum requirement for paraLLEl-RDP.\n");
LOGE("8-bit storage for SSBOs is not supported! This is a minimum requirement for paraLLEl-RDP.\n");
return false;
}

// Driver workarounds here for 8/16-bit integer support.
if (features.supports_driver_properties && !forces_small_types)
{
if (features.driver_properties.driverID == VK_DRIVER_ID_AMD_PROPRIETARY_KHR)
if (features.driver_id == VK_DRIVER_ID_AMD_PROPRIETARY_KHR)
{
LOGW("Current proprietary AMD driver is known to be buggy with 8/16-bit integer arithmetic, disabling support for time being.\n");
allow_small_types = false;
}
else if (features.driver_properties.driverID == VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR ||
features.driver_properties.driverID == VK_DRIVER_ID_MESA_RADV_KHR)
else if (features.driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR ||
features.driver_id == VK_DRIVER_ID_MESA_RADV_KHR)
{
LOGW("Current open-source AMD drivers are known to be slightly faster without 8/16-bit integer arithmetic.\n");
allow_small_types = false;
}
else if (features.driver_properties.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR)
else if (features.driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR)
{
LOGW("Current NVIDIA driver is known to be slightly faster without 8/16-bit integer arithmetic.\n");
allow_small_types = false;
}
else if (features.driver_properties.driverID == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR)
else if (features.driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR)
{
LOGW("Current proprietary Intel Windows driver is tested to perform much better without 8/16-bit integer support.\n");
allow_small_types = false;
Expand All @@ -209,7 +209,7 @@ bool Renderer::init_caps()
{
caps.supports_small_integer_arithmetic = false;
}
else if (features.enabled_features.shaderInt16 && features.float16_int8_features.shaderInt8)
else if (features.enabled_features.shaderInt16 && features.vk12_features.shaderInt8)
{
LOGI("Enabling 8 and 16-bit integer arithmetic support for more efficient shaders!\n");
caps.supports_small_integer_arithmetic = true;
Expand All @@ -220,7 +220,7 @@ bool Renderer::init_caps()
caps.supports_small_integer_arithmetic = false;
}

uint32_t subgroup_size = features.subgroup_properties.subgroupSize;
uint32_t subgroup_size = features.vk11_props.subgroupSize;

const VkSubgroupFeatureFlags required =
VK_SUBGROUP_FEATURE_BALLOT_BIT |
Expand All @@ -230,15 +230,15 @@ bool Renderer::init_caps()

caps.subgroup_tile_binning =
allow_subgroup &&
(features.subgroup_properties.supportedOperations & required) == required &&
(features.subgroup_properties.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT) != 0 &&
(features.vk11_props.subgroupSupportedOperations & required) == required &&
(features.vk11_props.subgroupSupportedStages & VK_SHADER_STAGE_COMPUTE_BIT) != 0 &&
can_support_minimum_subgroup_size(32) && subgroup_size <= 64;

caps.subgroup_depth_blend =
caps.super_sample_readback &&
allow_subgroup &&
(features.subgroup_properties.supportedOperations & required) == required &&
(features.subgroup_properties.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT) != 0;
(features.vk11_props.subgroupSupportedOperations & required) == required &&
(features.vk11_props.subgroupSupportedOperations & VK_SHADER_STAGE_COMPUTE_BIT) != 0;

return true;
}
Expand Down Expand Up @@ -1864,7 +1864,7 @@ void Renderer::submit_tile_binning_combined(Vulkan::CommandBuffer &cmd, bool ups
cmd.push_constants(&push, 0, sizeof(push));

auto &features = device->get_device_features();
uint32_t subgroup_size = features.subgroup_properties.subgroupSize;
uint32_t subgroup_size = features.vk11_props.subgroupSize;

Vulkan::QueryPoolHandle start_ts, end_ts;
if (caps.timestamp >= 2)
Expand Down Expand Up @@ -3532,27 +3532,27 @@ void Renderer::set_primitive_color(uint8_t min_level, uint8_t prim_lod_frac, uin

bool Renderer::can_support_minimum_subgroup_size(unsigned size) const
{
return supports_subgroup_size_control(size, device->get_device_features().subgroup_properties.subgroupSize);
return supports_subgroup_size_control(size, device->get_device_features().vk11_props.subgroupSize);
}

bool Renderer::supports_subgroup_size_control(uint32_t minimum_size, uint32_t maximum_size) const
{
auto &features = device->get_device_features();

if (!features.subgroup_size_control_features.computeFullSubgroups)
if (!features.vk13_features.computeFullSubgroups)
return false;

bool use_varying = minimum_size <= features.subgroup_size_control_properties.minSubgroupSize &&
maximum_size >= features.subgroup_size_control_properties.maxSubgroupSize;
bool use_varying = minimum_size <= features.vk13_props.minSubgroupSize &&
maximum_size >= features.vk13_props.maxSubgroupSize;

if (!use_varying)
{
bool outside_range = minimum_size > features.subgroup_size_control_properties.maxSubgroupSize ||
maximum_size < features.subgroup_size_control_properties.minSubgroupSize;
bool outside_range = minimum_size > features.vk13_props.maxSubgroupSize ||
maximum_size < features.vk13_props.minSubgroupSize;
if (outside_range)
return false;

if ((features.subgroup_size_control_properties.requiredSubgroupSizeStages & VK_SHADER_STAGE_COMPUTE_BIT) == 0)
if ((features.vk13_props.requiredSubgroupSizeStages & VK_SHADER_STAGE_COMPUTE_BIT) == 0)
return false;
}

Expand Down
12 changes: 6 additions & 6 deletions parallel-rdp/video_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,8 @@ Vulkan::ImageHandle VideoInterface::scale_stage(Vulkan::CommandBuffer &cmd, cons
{
if (prev_image_is_external)
{
cmd.acquire_external_image_barrier(*prev_scanout_image, prev_image_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
cmd.acquire_image_barrier(*prev_scanout_image, prev_image_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
}
else if (prev_image_layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
{
Expand Down Expand Up @@ -1396,10 +1396,10 @@ Vulkan::ImageHandle VideoInterface::scanout(VkImageLayout target_layout, const S
if (options.export_handle_type != Vulkan::ExternalHandle::get_opaque_memory_handle_type())
target_layout = VK_IMAGE_LAYOUT_GENERAL;

cmd->release_external_image_barrier(*scale_image, src_layout,
target_layout,
layout_to_stage(src_layout),
layout_to_access(src_layout));
cmd->release_image_barrier(*scale_image, src_layout,
target_layout,
layout_to_stage(src_layout),
layout_to_access(src_layout));
}
else
{
Expand Down

0 comments on commit 66b9bf3

Please sign in to comment.