internal/graphicsdriver/opengl, metal, directx: add comments

Updates #1212
This commit is contained in:
Hajime Hoshi 2022-10-01 15:21:00 +09:00
parent a10f3d1dad
commit 4203a3b68a
3 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);