Workaround sampling alpha between eyes
This commit is contained in:
@@ -104,7 +104,7 @@ stream_defoveator::pipeline_t & stream_defoveator::ensure_pipeline(size_t view,
|
||||
|
||||
// pipeline layout
|
||||
vk::PushConstantRange pc_range{
|
||||
.stageFlags = vk::ShaderStageFlagBits::eVertex,
|
||||
.stageFlags = vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment,
|
||||
.size = sizeof(vert_pc),
|
||||
};
|
||||
|
||||
@@ -431,7 +431,7 @@ void stream_defoveator::defoveate(vk::raii::CommandBuffer & command_buffer,
|
||||
command_buffer.beginRenderPass(begin_info, vk::SubpassContents::eInline);
|
||||
command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, *pipeline.pipeline);
|
||||
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, *pipeline.layout, 0, pipeline.ds, {});
|
||||
command_buffer.pushConstants<vert_pc>(*pipeline.layout, vk::ShaderStageFlagBits::eVertex, 0, pc);
|
||||
command_buffer.pushConstants<vert_pc>(*pipeline.layout, vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment, 0, pc);
|
||||
command_buffer.bindVertexBuffers(0, vk::Buffer(buffer), vertices_size * view);
|
||||
command_buffer.draw(required_vertices(foveation[view]), 1, 0, 0);
|
||||
command_buffer.endRenderPass();
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
*/
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform pc
|
||||
{
|
||||
ivec4 rgb_rect;
|
||||
ivec4 a_rect;
|
||||
};
|
||||
|
||||
#ifdef VERT_SHADER
|
||||
|
||||
layout (location = 0) in vec2 vPosition;
|
||||
@@ -25,12 +31,6 @@ layout (location = 1) in uvec2 vUV;
|
||||
|
||||
layout(location = 0) out vec4 outUV;
|
||||
|
||||
layout(push_constant) uniform pc
|
||||
{
|
||||
ivec4 rgb_rect;
|
||||
ivec4 a_rect;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
@@ -70,7 +70,14 @@ vec4 sRGB_to_linear_rgba(vec4 x)
|
||||
void main()
|
||||
{
|
||||
if (alpha == 1)
|
||||
outColor = vec4(texture(rgb[0], inUV.xy).rgb, texture(rgb[1], inUV.zw).r);
|
||||
{
|
||||
// Avoid sampling between the eyes
|
||||
vec2 a = inUV.zw;
|
||||
float d = a.x - 0.5;
|
||||
if (abs(d) *a_rect.z < 1)
|
||||
a.x += (d > 0 ? 1 : -1) / float(a_rect.z);
|
||||
outColor = vec4(texture(rgb[0], inUV.xy).rgb, texture(rgb[1], a).r);
|
||||
}
|
||||
else
|
||||
outColor = texture(rgb[0], inUV.xy).rgba;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user