Hello
I want to use Vulkan to Present the HDR Image on HDR display device,but I found the result is not correct.
the left side is vulkan result, the right side is a compared application result.
the
SwapSurface
Format used is:availableFormat.format == VK_FORMAT_R16G16B16A16_SFLOAT && availableFormat.colorSpace == VK_COLOR_SPACE_HDR10_ST2084_EXT
the Image is pfm format, Use VK_FORMAT_R32G32B32_SFLOAT
ImageFormat. the colour space is scrgb, the value is linear RGB.
createImage(texWidth, texHeight, VK_FORMAT_R32G32B32_SFLOAT, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, textureImage, textureImageMemory);
you can get a pfm file form here: PFM Format Documentation (pauldebevec.com)
the vertex shader is:
// filename is “shader_f.txt” 22_shader_ubo.vert
#version 450
layout(binding = 0) uniform UniformBufferObject {
mat4 model;
mat4 view;
mat4 proj;
} ubo;
layout(location = 0) in vec2 inPosition;
layout(location = 1) in vec3 inColor;
layout(location = 2) in vec2 inTexCoord;
layout(location = 0) out vec3 fragColor;
layout(location = 1) out vec2 fragTexCoord;
void main() {
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 0.0, 1.0);
fragColor = inColor;
fragTexCoord = inTexCoord;
}
the fragment shader is:
// file name is “shader_f.txt” 22_shader_ubo.frag
#version 450
layout(binding = 0) uniform UniformBufferObject {
mat4 model;
mat4 view;
mat4 proj;
} ubo;
layout(binding = 1) uniform sampler2D texSampler;
layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
void main() {
outColor = texture(texSampler, fragTexCoord);
}
the mian code is copy from here vulkan-tutorial.com/code/16_frames_in_flight.cpp
I want know how to let the render result become correct.Thanks.