Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ff5f2f90b |
+21
-3
@@ -7,6 +7,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr VkFormat V210_OUTPUT_FORMAT =
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
|
||||
std::vector<char> readFile(const std::string& path)
|
||||
{
|
||||
std::ifstream file(path, std::ios::ate | std::ios::binary);
|
||||
@@ -222,6 +225,21 @@ void V210ComputeDecoder::createFeedResources(
|
||||
feed.srcHeight = srcHeight;
|
||||
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;
|
||||
|
||||
createBuffer(
|
||||
@@ -251,7 +269,7 @@ void V210ComputeDecoder::createFeedResources(
|
||||
physicalDevice,
|
||||
dstWidth,
|
||||
dstHeight,
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
V210_OUTPUT_FORMAT,
|
||||
VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_STORAGE_BIT |
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
@@ -264,7 +282,7 @@ void V210ComputeDecoder::createFeedResources(
|
||||
commandPool,
|
||||
graphicsQueue,
|
||||
feed.image,
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
V210_OUTPUT_FORMAT,
|
||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
VK_IMAGE_LAYOUT_GENERAL);
|
||||
|
||||
@@ -272,7 +290,7 @@ void V210ComputeDecoder::createFeedResources(
|
||||
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
viewInfo.image = feed.image;
|
||||
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
viewInfo.format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
viewInfo.format = V210_OUTPUT_FORMAT;
|
||||
viewInfo.subresourceRange.aspectMask =
|
||||
VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
viewInfo.subresourceRange.baseMipLevel = 0;
|
||||
|
||||
@@ -6,7 +6,7 @@ layout(binding = 0) readonly buffer V210Data {
|
||||
uint data[];
|
||||
} v210;
|
||||
|
||||
layout(binding = 1, rgba8) uniform writeonly image2D dstImage;
|
||||
layout(binding = 1, rgba16f) uniform writeonly image2D dstImage;
|
||||
|
||||
layout(push_constant) uniform PushConstants {
|
||||
uint srcWidth;
|
||||
|
||||
Reference in New Issue
Block a user