diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index 214d65042..972074edd 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -265,6 +265,8 @@ func (q *commandQueue) Flush() error { vs[i*graphics.VertexFloatNum+6] -= 1.0 / s.width * texelAdjustmentFactor vs[i*graphics.VertexFloatNum+7] -= 1.0 / s.height * texelAdjustmentFactor } + + // TODO: Adjust the source sizes in uniform variables. } else { n := q.nvertices / graphics.VertexFloatNum for i := 0; i < n; i++ { diff --git a/internal/restorable/shader_test.go b/internal/restorable/shader_test.go index 77a3d9d74..da49ae9a2 100644 --- a/internal/restorable/shader_test.go +++ b/internal/restorable/shader_test.go @@ -116,10 +116,8 @@ func TestShaderMultipleSources(t *testing.T) { []float32{1, 1}, srcs[0], srcs[1], - []float32{1, 1}, []float32{0, 0, 1, 1}, srcs[2], - []float32{1, 1}, []float32{0, 0, 1, 1}, } dst.DrawTriangles(nil, quadVertices(1, 1, 0, 0), graphics.QuadIndices(), nil, driver.CompositeModeCopy, driver.FilterNearest, driver.AddressClampToZero, s, us) diff --git a/internal/shareable/image.go b/internal/shareable/image.go index 995cf6b87..ba632d36a 100644 --- a/internal/shareable/image.go +++ b/internal/shareable/image.go @@ -328,10 +328,6 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16, case *Image: us[i] = v.backend.restorable if !firstImage { - i++ - pos := us[i].([]float32) - pos[0] += oxf - pos[1] += oyf i++ region := us[i].([]float32) region[0] += oxf diff --git a/internal/testing/shader.go b/internal/testing/shader.go index 29bc8573d..ba4e3c4d5 100644 --- a/internal/testing/shader.go +++ b/internal/testing/shader.go @@ -266,9 +266,8 @@ func ShaderProgramFill(r, g, b, a byte) shaderir.Program { // // 0: the framebuffer size (Vec2) // 1: the first images (Sampler2D) -// 3n-1: the (n+1)th image (Sampler2D) -// 3n: the (n+1)th image's size (Vec2) -// 3n+1: the (n+1)th image's region (Vec4) +// 2n: the n-th image (Sampler2D) +// 2n+1: the n-th image's region (Vec4) // // The first image's size and region are represented in attribute variables. // @@ -283,7 +282,6 @@ func ShaderProgramImages(imageNum int) shaderir.Program { for i := 0; i < imageNum; i++ { p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Sampler2D}) if i > 0 { - p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Vec2}) p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Vec4}) } } @@ -341,7 +339,7 @@ func ShaderProgramImages(imageNum int) shaderir.Program { }, { Type: shaderir.UniformVariable, - Index: 3*i - 1, + Index: 2 * i, }, texPos, },