internal/graphicsdriver: refactoring

This commit is contained in:
Hajime Hoshi 2022-11-12 21:03:54 +09:00
parent 419bb4c1e9
commit a406904a51
3 changed files with 12 additions and 12 deletions

View File

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

View File

@ -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]

View File

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