mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
testing: Bug fix: Image's size should not be in uniform variables
This commit is contained in:
parent
f92253487f
commit
833a364ba8
@ -265,6 +265,8 @@ func (q *commandQueue) Flush() error {
|
|||||||
vs[i*graphics.VertexFloatNum+6] -= 1.0 / s.width * texelAdjustmentFactor
|
vs[i*graphics.VertexFloatNum+6] -= 1.0 / s.width * texelAdjustmentFactor
|
||||||
vs[i*graphics.VertexFloatNum+7] -= 1.0 / s.height * texelAdjustmentFactor
|
vs[i*graphics.VertexFloatNum+7] -= 1.0 / s.height * texelAdjustmentFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Adjust the source sizes in uniform variables.
|
||||||
} else {
|
} else {
|
||||||
n := q.nvertices / graphics.VertexFloatNum
|
n := q.nvertices / graphics.VertexFloatNum
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
|
@ -116,10 +116,8 @@ func TestShaderMultipleSources(t *testing.T) {
|
|||||||
[]float32{1, 1},
|
[]float32{1, 1},
|
||||||
srcs[0],
|
srcs[0],
|
||||||
srcs[1],
|
srcs[1],
|
||||||
[]float32{1, 1},
|
|
||||||
[]float32{0, 0, 1, 1},
|
[]float32{0, 0, 1, 1},
|
||||||
srcs[2],
|
srcs[2],
|
||||||
[]float32{1, 1},
|
|
||||||
[]float32{0, 0, 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)
|
dst.DrawTriangles(nil, quadVertices(1, 1, 0, 0), graphics.QuadIndices(), nil, driver.CompositeModeCopy, driver.FilterNearest, driver.AddressClampToZero, s, us)
|
||||||
|
@ -328,10 +328,6 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16,
|
|||||||
case *Image:
|
case *Image:
|
||||||
us[i] = v.backend.restorable
|
us[i] = v.backend.restorable
|
||||||
if !firstImage {
|
if !firstImage {
|
||||||
i++
|
|
||||||
pos := us[i].([]float32)
|
|
||||||
pos[0] += oxf
|
|
||||||
pos[1] += oyf
|
|
||||||
i++
|
i++
|
||||||
region := us[i].([]float32)
|
region := us[i].([]float32)
|
||||||
region[0] += oxf
|
region[0] += oxf
|
||||||
|
@ -266,9 +266,8 @@ func ShaderProgramFill(r, g, b, a byte) shaderir.Program {
|
|||||||
//
|
//
|
||||||
// 0: the framebuffer size (Vec2)
|
// 0: the framebuffer size (Vec2)
|
||||||
// 1: the first images (Sampler2D)
|
// 1: the first images (Sampler2D)
|
||||||
// 3n-1: the (n+1)th image (Sampler2D)
|
// 2n: the n-th image (Sampler2D)
|
||||||
// 3n: the (n+1)th image's size (Vec2)
|
// 2n+1: the n-th image's region (Vec4)
|
||||||
// 3n+1: the (n+1)th image's region (Vec4)
|
|
||||||
//
|
//
|
||||||
// The first image's size and region are represented in attribute variables.
|
// 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++ {
|
for i := 0; i < imageNum; i++ {
|
||||||
p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Sampler2D})
|
p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Sampler2D})
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Vec2})
|
|
||||||
p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Vec4})
|
p.Uniforms = append(p.Uniforms, shaderir.Type{Main: shaderir.Vec4})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +339,7 @@ func ShaderProgramImages(imageNum int) shaderir.Program {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: shaderir.UniformVariable,
|
Type: shaderir.UniformVariable,
|
||||||
Index: 3*i - 1,
|
Index: 2 * i,
|
||||||
},
|
},
|
||||||
texPos,
|
texPos,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user