ui/app/internal/gpu: move sRGBA feature detection to context

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-05-04 15:50:10 +02:00
parent fd9eb029c8
commit 51482b6493
2 changed files with 17 additions and 31 deletions
+2 -9
View File
@@ -859,15 +859,8 @@ func (r *renderer) uploadTexture(img image.Image) {
default:
pixels = copyImage(img, b).Pix
}
var internal int
var format gl.Enum
switch r.ctx.caps.srgbMode {
case srgbES3:
internal, format = gl.SRGB8_ALPHA8, gl.RGBA
case srgbEXT:
internal, format = gl.SRGB_ALPHA_EXT, gl.SRGB_ALPHA_EXT
}
r.ctx.TexImage2D(gl.TEXTURE_2D, 0, internal, w, h, format, gl.UNSIGNED_BYTE, pixels)
tt := r.ctx.caps.srgbaTriple
r.ctx.TexImage2D(gl.TEXTURE_2D, 0, tt.internalFormat, w, h, tt.format, tt.typ, pixels)
}