1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-16 18:30:32 +00:00

Switches to using regular linear interpolation for supersampling.

This commit is contained in:
Thomas Harte 2020-09-14 22:36:00 -04:00
parent eb9903cd10
commit 82dbdf7dfc
2 changed files with 1 additions and 14 deletions

View File

@ -317,7 +317,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
pipelineDescriptor.fragmentFunction = [library newFunctionWithName:@"copyFragment"];
_copyPipeline = [_view.device newRenderPipelineStateWithDescriptor:pipelineDescriptor error:nil];
pipelineDescriptor.fragmentFunction = [library newFunctionWithName:@"supersampleFragment"];
pipelineDescriptor.fragmentFunction = [library newFunctionWithName:@"interpolateFragment"];
_supersamplePipeline = [_view.device newRenderPipelineStateWithDescriptor:pipelineDescriptor error:nil];
pipelineDescriptor.fragmentFunction = [library newFunctionWithName:@"clearFragment"];

View File

@ -390,19 +390,6 @@ DeclareShaders(Red4Green4Blue4, ushort)
DeclareShaders(Red2Green2Blue2, ushort)
DeclareShaders(Red1Green1Blue1, ushort)
// Assumes a 2 -> 1 scaling on both axes; if ever I figure out how to get Metal to do hardware supersampling
// then this fragment shader can be removed.
fragment half4 supersampleFragment(CopyInterpolator vert [[stage_in]], texture2d<half> texture [[texture(0)]]) {
// TODO: can't I do better than this by being careful about positioning and using the linearSampler?
return (
texture.sample(standardSampler, vert.textureCoordinates + float2(0.5f, -1.0f)) +
texture.sample(standardSampler, vert.textureCoordinates + float2(0.5f, 1.0f)) +
texture.sample(standardSampler, vert.textureCoordinates + float2(-1.0f, 0.5f)) +
texture.sample(standardSampler, vert.textureCoordinates + float2(1.0f, -0.5f))
) * half(0.25f);
}
fragment half4 copyFragment(CopyInterpolator vert [[stage_in]], texture2d<half> texture [[texture(0)]]) {
return texture.sample(standardSampler, vert.textureCoordinates);
}