mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/graphicsdriver/opengl, metal, directx: add comments
Updates #1212
This commit is contained in:
parent
a10f3d1dad
commit
4203a3b68a
@ -175,7 +175,7 @@ float4 PSMain(PSInput input) : SV_TARGET {
|
|||||||
float2 pos = input.texcoord;
|
float2 pos = input.texcoord;
|
||||||
float2 texel_size = 1.0 / source_size;
|
float2 texel_size = 1.0 / source_size;
|
||||||
|
|
||||||
// Shift 1/512 [texel] to avoid the tie-breaking issue.
|
// Shift 1/512 [texel] to avoid the tie-breaking issue (#1212).
|
||||||
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
||||||
float2 p0 = pos - (texel_size) / 2.0 + (texel_size / 512.0);
|
float2 p0 = pos - (texel_size) / 2.0 + (texel_size / 512.0);
|
||||||
float2 p1 = pos + (texel_size) / 2.0 + (texel_size / 512.0);
|
float2 p1 = pos + (texel_size) / 2.0 + (texel_size / 512.0);
|
||||||
|
@ -129,7 +129,7 @@ struct ColorFromTexel<FILTER_LINEAR, ADDRESS_UNSAFE> {
|
|||||||
inline float4 Do(VertexOut v, texture2d<float> texture, constant float2& source_size, constant float4& source_region) {
|
inline float4 Do(VertexOut v, texture2d<float> texture, constant float2& source_size, constant float4& source_region) {
|
||||||
const float2 texel_size = 1 / source_size;
|
const float2 texel_size = 1 / source_size;
|
||||||
|
|
||||||
// Shift 1/512 [texel] to avoid the tie-breaking issue.
|
// Shift 1/512 [texel] to avoid the tie-breaking issue (#1212).
|
||||||
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
||||||
float2 p0 = v.tex - texel_size / 2.0 + (texel_size / 512.0);
|
float2 p0 = v.tex - texel_size / 2.0 + (texel_size / 512.0);
|
||||||
float2 p1 = v.tex + texel_size / 2.0 + (texel_size / 512.0);
|
float2 p1 = v.tex + texel_size / 2.0 + (texel_size / 512.0);
|
||||||
@ -149,7 +149,7 @@ struct ColorFromTexel<FILTER_LINEAR, address> {
|
|||||||
inline float4 Do(VertexOut v, texture2d<float> texture, constant float2& source_size, constant float4& source_region) {
|
inline float4 Do(VertexOut v, texture2d<float> texture, constant float2& source_size, constant float4& source_region) {
|
||||||
const float2 texel_size = 1 / source_size;
|
const float2 texel_size = 1 / source_size;
|
||||||
|
|
||||||
// Shift 1/512 [texel] to avoid the tie-breaking issue.
|
// Shift 1/512 [texel] to avoid the tie-breaking issue (#1212).
|
||||||
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
||||||
float2 p0 = v.tex - texel_size / 2.0 + (texel_size / 512.0);
|
float2 p0 = v.tex - texel_size / 2.0 + (texel_size / 512.0);
|
||||||
float2 p1 = v.tex + texel_size / 2.0 + (texel_size / 512.0);
|
float2 p1 = v.tex + texel_size / 2.0 + (texel_size / 512.0);
|
||||||
|
@ -192,7 +192,7 @@ void main(void) {
|
|||||||
vec4 color;
|
vec4 color;
|
||||||
highp vec2 texel_size = 1.0 / source_size;
|
highp vec2 texel_size = 1.0 / source_size;
|
||||||
|
|
||||||
// Shift 1/512 [texel] to avoid the tie-breaking issue.
|
// Shift 1/512 [texel] to avoid the tie-breaking issue (#1212).
|
||||||
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
// As all the vertex positions are aligned to 1/16 [pixel], this shiting should work in most cases.
|
||||||
highp vec2 p0 = pos - (texel_size) / 2.0 + (texel_size / 512.0);
|
highp vec2 p0 = pos - (texel_size) / 2.0 + (texel_size / 512.0);
|
||||||
highp vec2 p1 = pos + (texel_size) / 2.0 + (texel_size / 512.0);
|
highp vec2 p1 = pos + (texel_size) / 2.0 + (texel_size / 512.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user