Probe RGBA16F v210 output

This commit is contained in:
Johanness
2026-05-24 21:45:38 +03:00
parent 102b1fb95f
commit 2ff5f2f90b
2 changed files with 22 additions and 4 deletions
+21 -3
View File
@@ -7,6 +7,9 @@
namespace namespace
{ {
constexpr VkFormat V210_OUTPUT_FORMAT =
VK_FORMAT_R16G16B16A16_SFLOAT;
std::vector<char> readFile(const std::string& path) std::vector<char> readFile(const std::string& path)
{ {
std::ifstream file(path, std::ios::ate | std::ios::binary); std::ifstream file(path, std::ios::ate | std::ios::binary);
@@ -222,6 +225,21 @@ void V210ComputeDecoder::createFeedResources(
feed.srcHeight = srcHeight; feed.srcHeight = srcHeight;
feed.srcStride = srcStride; feed.srcStride = srcStride;
VkFormatProperties formatProperties{};
vkGetPhysicalDeviceFormatProperties(
physicalDevice,
V210_OUTPUT_FORMAT,
&formatProperties);
const VkFormatFeatureFlags requiredFeatures =
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
if ((formatProperties.optimalTilingFeatures & requiredFeatures) !=
requiredFeatures)
{
throw std::runtime_error(
"VK_FORMAT_R16G16B16A16_SFLOAT cannot be used for v210 output");
}
VkDeviceSize v210Size = static_cast<VkDeviceSize>(srcStride) * srcHeight; VkDeviceSize v210Size = static_cast<VkDeviceSize>(srcStride) * srcHeight;
createBuffer( createBuffer(
@@ -251,7 +269,7 @@ void V210ComputeDecoder::createFeedResources(
physicalDevice, physicalDevice,
dstWidth, dstWidth,
dstHeight, dstHeight,
VK_FORMAT_R8G8B8A8_UNORM, V210_OUTPUT_FORMAT,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_STORAGE_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_USAGE_SAMPLED_BIT,
@@ -264,7 +282,7 @@ void V210ComputeDecoder::createFeedResources(
commandPool, commandPool,
graphicsQueue, graphicsQueue,
feed.image, feed.image,
VK_FORMAT_R8G8B8A8_UNORM, V210_OUTPUT_FORMAT,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_LAYOUT_GENERAL); VK_IMAGE_LAYOUT_GENERAL);
@@ -272,7 +290,7 @@ void V210ComputeDecoder::createFeedResources(
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = feed.image; viewInfo.image = feed.image;
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
viewInfo.format = VK_FORMAT_R8G8B8A8_UNORM; viewInfo.format = V210_OUTPUT_FORMAT;
viewInfo.subresourceRange.aspectMask = viewInfo.subresourceRange.aspectMask =
VK_IMAGE_ASPECT_COLOR_BIT; VK_IMAGE_ASPECT_COLOR_BIT;
viewInfo.subresourceRange.baseMipLevel = 0; viewInfo.subresourceRange.baseMipLevel = 0;
+1 -1
View File
@@ -6,7 +6,7 @@ layout(binding = 0) readonly buffer V210Data {
uint data[]; uint data[];
} v210; } v210;
layout(binding = 1, rgba8) uniform writeonly image2D dstImage; layout(binding = 1, rgba16f) uniform writeonly image2D dstImage;
layout(push_constant) uniform PushConstants { layout(push_constant) uniform PushConstants {
uint srcWidth; uint srcWidth;