mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver: refactoring
This commit is contained in:
parent
419bb4c1e9
commit
a406904a51
@ -1224,10 +1224,10 @@ func (g *Graphics) DrawTriangles(dstID graphicsdriver.ImageID, srcs [graphics.Sh
|
|||||||
// match. Then, the Y direction must be inverted.
|
// match. Then, the Y direction must be inverted.
|
||||||
const idx = graphics.ProjectionMatrixUniformVariableIndex
|
const idx = graphics.ProjectionMatrixUniformVariableIndex
|
||||||
// Invert the sign bits as float32 values.
|
// Invert the sign bits as float32 values.
|
||||||
uniforms[idx][1] = uniforms[idx][1] ^ (1 << 31)
|
uniforms[idx][1] ^= 1 << 31
|
||||||
uniforms[idx][5] = uniforms[idx][5] ^ (1 << 31)
|
uniforms[idx][5] ^= 1 << 31
|
||||||
uniforms[idx][9] = uniforms[idx][9] ^ (1 << 31)
|
uniforms[idx][9] ^= 1 << 31
|
||||||
uniforms[idx][13] = uniforms[idx][13] ^ (1 << 31)
|
uniforms[idx][13] ^= 1 << 31
|
||||||
|
|
||||||
flattenUniforms := shader.flattenUniforms(uniforms)
|
flattenUniforms := shader.flattenUniforms(uniforms)
|
||||||
|
|
||||||
|
@ -568,10 +568,10 @@ func (g *Graphics) DrawTriangles(dstID graphicsdriver.ImageID, srcIDs [graphics.
|
|||||||
// In Metal, the NDC's Y direction (upward) and the framebuffer's Y direction (downward) don't
|
// In Metal, the NDC's Y direction (upward) and the framebuffer's Y direction (downward) don't
|
||||||
// match. Then, the Y direction must be inverted.
|
// match. Then, the Y direction must be inverted.
|
||||||
// Invert the sign bits as float32 values.
|
// Invert the sign bits as float32 values.
|
||||||
v[1] = v[1] ^ (1 << 31)
|
v[1] ^= 1 << 31
|
||||||
v[5] = v[5] ^ (1 << 31)
|
v[5] ^= 1 << 31
|
||||||
v[9] = v[9] ^ (1 << 31)
|
v[9] ^= 1 << 31
|
||||||
v[13] = v[13] ^ (1 << 31)
|
v[13] ^= 1 << 31
|
||||||
}
|
}
|
||||||
|
|
||||||
t := g.shaders[shaderID].ir.Uniforms[i]
|
t := g.shaders[shaderID].ir.Uniforms[i]
|
||||||
|
@ -214,10 +214,10 @@ func (g *Graphics) DrawTriangles(dstID graphicsdriver.ImageID, srcIDs [graphics.
|
|||||||
if destination.screen {
|
if destination.screen {
|
||||||
const idx = graphics.ProjectionMatrixUniformVariableIndex
|
const idx = graphics.ProjectionMatrixUniformVariableIndex
|
||||||
// Invert the sign bits as float32 values.
|
// Invert the sign bits as float32 values.
|
||||||
g.uniformVars[idx].value[1] = g.uniformVars[idx].value[1] ^ (1 << 31)
|
g.uniformVars[idx].value[1] ^= 1 << 31
|
||||||
g.uniformVars[idx].value[5] = g.uniformVars[idx].value[5] ^ (1 << 31)
|
g.uniformVars[idx].value[5] ^= 1 << 31
|
||||||
g.uniformVars[idx].value[9] = g.uniformVars[idx].value[9] ^ (1 << 31)
|
g.uniformVars[idx].value[9] ^= 1 << 31
|
||||||
g.uniformVars[idx].value[13] = g.uniformVars[idx].value[13] ^ (1 << 31)
|
g.uniformVars[idx].value[13] ^= 1 << 31
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgs [graphics.ShaderImageCount]textureVariable
|
var imgs [graphics.ShaderImageCount]textureVariable
|
||||||
|
Loading…
Reference in New Issue
Block a user