1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

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.
This commit is contained in:
Thomas Harte 2019-02-24 13:39:14 -05:00
parent de7ebead23
commit 2f491b5be1

View File

@ -360,6 +360,7 @@ std::unique_ptr<Shader> 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<Shader> 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;"