Skip to content

Commit

Permalink
Less expensive moiré fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyHairy committed Nov 28, 2021
1 parent d3ba722 commit f2bbd48
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.6

## All

* Better version of my 1.0.5 video fix.
# 1.0.5

## All
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "6502.ts",
"version": "1.0.5",
"version": "1.0.6",
"description": "A 6502 emulator written in typescript",
"author": "[email protected]",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/web/driver/video/NtscProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class NtscProcessor implements Processor {

render(texture: WebGLTexture): void {
this._pass(texture, this._targetPass1, this._programPass1, 960);
this._pass(this._targetPass1, this._targetPass2, this._programPass2, 960);
this._pass(this._targetPass1, this._targetPass2, this._programPass2, 480);
}

getWidth(): number {
Expand Down Expand Up @@ -131,7 +131,7 @@ class NtscProcessor implements Processor {
gl.TEXTURE_2D,
0,
gl.RGBA,
960,
texture === this._targetPass2 ? 480 : 960,
height,
0,
gl.RGBA,
Expand Down
20 changes: 10 additions & 10 deletions src/web/driver/video/shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export namespace vsh {

export const enum attribute {
vertexPosition = 'a_VertexPosition',
textureCoordinate = 'a_TextureCoordinate'
textureCoordinate = 'a_TextureCoordinate',
}
}
}
Expand All @@ -71,7 +71,7 @@ export namespace fsh {
`;

export const enum uniform {
textureUnit = 'u_Sampler0'
textureUnit = 'u_Sampler0',
}
}

Expand All @@ -93,7 +93,7 @@ export namespace fsh {

export const enum uniform {
textureUnit = 'u_Sampler0',
gamma = 'u_Gamma'
gamma = 'u_Gamma',
}
}

Expand Down Expand Up @@ -130,7 +130,7 @@ export namespace fsh {
export const enum uniform {
level = 'u_PhosphorLevel',
textureUnitNew = 'u_Sampler_NewImage',
textureUnitPrevious = 'u_Sampler_PreviousImage'
textureUnitPrevious = 'u_Sampler_PreviousImage',
}
}

Expand Down Expand Up @@ -216,7 +216,7 @@ export namespace fsh {
export const enum uniform {
textureUnit = 'u_Sampler0',
artifacting = 'u_Artifacting',
fringing = 'u_Fringing'
fringing = 'u_Fringing',
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ export namespace fsh {
0.084016453,
0.1355635,
0.175261268,
0.190176552
0.190176552,
];

const chromaFilter = [
Expand Down Expand Up @@ -274,7 +274,7 @@ export namespace fsh {
0.068803602,
0.074356193,
0.077856564,
0.079052396
0.079052396,
];

function maybeUnpack(capabilities: Capabilities, expr: string): string {
Expand Down Expand Up @@ -321,7 +321,7 @@ export namespace fsh {
}
vec3 fetch_offset(int offset) {
float x = v_TextureCoordinate.x + float(offset) / 960.0;
float x = (floor(v_TextureCoordinate.x * 960.0) + 0.5 + float(offset)) / 960.0;
return step(0.0, x) * step(-1.0, -x) *
${maybeUnpack(capabilities, 'texture2D(u_Sampler0, vec2(x, v_TextureCoordinate.y))')};
Expand Down Expand Up @@ -351,7 +351,7 @@ export namespace fsh {
`;

export const enum uniform {
textureUnit = 'u_Sampler0'
textureUnit = 'u_Sampler0',
}
}

Expand All @@ -376,7 +376,7 @@ export namespace fsh {
export const enum uniform {
textureUnit = 'u_Sampler0',
level = 'u_Level',
height = 'u_Height'
height = 'u_Height',
}
}
}

0 comments on commit f2bbd48

Please sign in to comment.