From 2f491b5be169464bec031fb734ba8eaa3ac38e6d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 24 Feb 2019 13:39:14 -0500 Subject: [PATCH] Reintroduces fragment snapping for composite colour sampling. Thereby uncovers some sort of slightly-off recording of scan lines. On the Apple II, individual scans reach the ScanTarget at a density of exactly 0.25 colour cycles per pixel. So that timing information propagates exactly. But the whole lines that are composed via ::announce end up trying to fit 0.250154 colour cycles per pixel. Which creates a phase error as the display progresses from left to right. This will need to be resolved in order to be able to fix the Apple II's intended colour phase. But, also, it's probably what was wrong with the Oric. And, quite possibly, why the single-step shader didn't work. --- Outputs/OpenGL/ScanTargetGLSLFragments.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Outputs/OpenGL/ScanTargetGLSLFragments.cpp b/Outputs/OpenGL/ScanTargetGLSLFragments.cpp index fa6b3705c..2c54330df 100644 --- a/Outputs/OpenGL/ScanTargetGLSLFragments.cpp +++ b/Outputs/OpenGL/ScanTargetGLSLFragments.cpp @@ -360,6 +360,7 @@ std::unique_ptr ScanTarget::conversion_shader() const { if((modals_.display_type == DisplayType::SVideo) || (modals_.display_type == DisplayType::CompositeColour)) { vertex_shader += "float centreCompositeAngle = abs(mix(startCompositeAngle, endCompositeAngle, lateral)) * 4.0 / 64.0;" + "centreCompositeAngle = floor(centreCompositeAngle);" "qamTextureCoordinates[0] = vec2(centreCompositeAngle - 1.5, lineY + 0.5) / textureSize(textureName, 0);" "qamTextureCoordinates[1] = vec2(centreCompositeAngle - 0.5, lineY + 0.5) / textureSize(textureName, 0);" "qamTextureCoordinates[2] = vec2(centreCompositeAngle + 0.5, lineY + 0.5) / textureSize(textureName, 0);" @@ -595,7 +596,8 @@ std::unique_ptr ScanTarget::qam_separation_shader() const { "compositeAngle = mix(startCompositeAngle, endCompositeAngle, lateral) / 64.0;" - "vec2 eyePosition = vec2(abs(compositeAngle) * 4.0, lineY + longitudinal) / vec2(2048.0, 2048.0);" + "float snappedCompositeAngle = floor(abs(compositeAngle) * 4.0);" + "vec2 eyePosition = vec2(snappedCompositeAngle, lineY + longitudinal) / vec2(2048.0, 2048.0);" "gl_Position = vec4(eyePosition*2.0 - vec2(1.0), 0.0, 1.0);" "compositeAngle = compositeAngle * 2.0 * 3.141592654;"