mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
gpu,app,internal/glimpl: update GL backend for the compute renderer
Modern graphics APIs have immutable objects, with mutable data. For example, a texture's dimensions are immutable, while the texture contents is not. Change the GPU API abstraction to match. Clearing a Texture is convenient to do with a plain []byte. Generalize Texture.Upload to take a plain byte slice and introduce a helper function for uploading *image.RGBA data. Add TextureFormatRGBA8 a format for the linear RGB colorspace. Add OpenGL ES 3.1 functions for compute programs. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+22
-2
@@ -8,19 +8,24 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
ALL_BARRIER_BITS = 0xffffffff
|
||||
ARRAY_BUFFER = 0x8892
|
||||
BLEND = 0xbe2
|
||||
CLAMP_TO_EDGE = 0x812f
|
||||
COLOR_ATTACHMENT0 = 0x8ce0
|
||||
COLOR_BUFFER_BIT = 0x4000
|
||||
COMPILE_STATUS = 0x8b81
|
||||
COMPUTE_SHADER = 0x91B9
|
||||
DEPTH_BUFFER_BIT = 0x100
|
||||
DEPTH_ATTACHMENT = 0x8d00
|
||||
DEPTH_COMPONENT16 = 0x81a5
|
||||
DEPTH_COMPONENT24 = 0x81A6
|
||||
DEPTH_COMPONENT32F = 0x8CAC
|
||||
DEPTH_TEST = 0xb71
|
||||
DRAW_FRAMEBUFFER = 0x8CA9
|
||||
DST_COLOR = 0x306
|
||||
DYNAMIC_DRAW = 0x88E8
|
||||
DYNAMIC_READ = 0x88E9
|
||||
ELEMENT_ARRAY_BUFFER = 0x8893
|
||||
EXTENSIONS = 0x1f03
|
||||
FALSE = 0
|
||||
@@ -39,6 +44,7 @@ const (
|
||||
LINEAR = 0x2601
|
||||
LINK_STATUS = 0x8b82
|
||||
LUMINANCE = 0x1909
|
||||
MAP_READ_BIT = 0x0001
|
||||
MAX_TEXTURE_SIZE = 0xd33
|
||||
NEAREST = 0x2600
|
||||
NO_ERROR = 0x0
|
||||
@@ -50,6 +56,8 @@ const (
|
||||
R16F = 0x822d
|
||||
R8 = 0x8229
|
||||
READ_FRAMEBUFFER = 0x8ca8
|
||||
READ_ONLY = 0x88B8
|
||||
READ_WRITE = 0x88BA
|
||||
RED = 0x1903
|
||||
RENDERER = 0x1F01
|
||||
RENDERBUFFER = 0x8d41
|
||||
@@ -59,12 +67,14 @@ const (
|
||||
RGB = 0x1907
|
||||
RGBA = 0x1908
|
||||
RGBA8 = 0x8058
|
||||
SHADER_STORAGE_BUFFER = 0x90D2
|
||||
SHORT = 0x1402
|
||||
SRGB = 0x8c40
|
||||
SRGB_ALPHA_EXT = 0x8c42
|
||||
SRGB8 = 0x8c41
|
||||
SRGB8_ALPHA8 = 0x8c43
|
||||
STATIC_DRAW = 0x88e4
|
||||
STENCIL_BUFFER_BIT = 0x00000400
|
||||
TEXTURE_2D = 0xde1
|
||||
TEXTURE_MAG_FILTER = 0x2800
|
||||
TEXTURE_MIN_FILTER = 0x2801
|
||||
@@ -81,6 +91,7 @@ const (
|
||||
UNSIGNED_SHORT = 0x1403
|
||||
VERSION = 0x1f02
|
||||
VERTEX_SHADER = 0x8b31
|
||||
WRITE_ONLY = 0x88B9
|
||||
ZERO = 0x0
|
||||
|
||||
// EXT_disjoint_timer_query
|
||||
@@ -96,11 +107,14 @@ var _ interface {
|
||||
BindBuffer(target Enum, b Buffer)
|
||||
BindBufferBase(target Enum, index int, buffer Buffer)
|
||||
BindFramebuffer(target Enum, fb Framebuffer)
|
||||
BindImageTexture(unit int, t Texture, level int, layered bool, layer int, access, format Enum)
|
||||
BindRenderbuffer(target Enum, fb Renderbuffer)
|
||||
BindTexture(target Enum, t Texture)
|
||||
BlendEquation(mode Enum)
|
||||
BlendFunc(sfactor, dfactor Enum)
|
||||
BufferData(target Enum, src []byte, usage Enum)
|
||||
BlitFramebuffer(sx0, sy0, sx1, sy1, dx0, dy0, dx1, dy1 int, mask Enum, filter Enum)
|
||||
BufferData(target Enum, size int, usage Enum)
|
||||
BufferSubData(target Enum, offset int, src []byte)
|
||||
CheckFramebufferStatus(target Enum) Enum
|
||||
Clear(mask Enum)
|
||||
ClearColor(red, green, blue, alpha float32)
|
||||
@@ -124,6 +138,7 @@ var _ interface {
|
||||
DepthMask(mask bool)
|
||||
DisableVertexAttribArray(a Attrib)
|
||||
Disable(cap Enum)
|
||||
DispatchCompute(x, y, z int)
|
||||
DrawArrays(mode Enum, first, count int)
|
||||
DrawElements(mode Enum, count int, ty Enum, offset int)
|
||||
Enable(cap Enum)
|
||||
@@ -144,11 +159,15 @@ var _ interface {
|
||||
GetUniformLocation(p Program, name string) Uniform
|
||||
InvalidateFramebuffer(target, attachment Enum)
|
||||
LinkProgram(p Program)
|
||||
MapBufferRange(target Enum, offset, length int, access Enum) []byte
|
||||
MemoryBarrier(barriers Enum)
|
||||
ReadPixels(x, y, width, height int, format, ty Enum, data []byte)
|
||||
RenderbufferStorage(target, internalformat Enum, width, height int)
|
||||
ShaderSource(s Shader, src string)
|
||||
TexImage2D(target Enum, level int, internalFormat int, width, height int, format, ty Enum, data []byte)
|
||||
TexImage2D(target Enum, level int, internalFormat Enum, width, height int, format, ty Enum)
|
||||
TexParameteri(target, pname Enum, param int)
|
||||
TexStorage2D(target Enum, levels int, internalFormat Enum, width, height int)
|
||||
TexSubImage2D(target Enum, level, xoff, yoff int, width, height int, format, ty Enum, data []byte)
|
||||
UniformBlockBinding(p Program, uniformBlockIndex uint, uniformBlockBinding uint)
|
||||
Uniform1f(dst Uniform, v float32)
|
||||
Uniform1i(dst Uniform, v int)
|
||||
@@ -156,6 +175,7 @@ var _ interface {
|
||||
Uniform3f(dst Uniform, v0, v1, v2 float32)
|
||||
Uniform4f(dst Uniform, v0, v1, v2, v3 float32)
|
||||
UseProgram(p Program)
|
||||
UnmapBuffer(target Enum) bool
|
||||
VertexAttribPointer(dst Attrib, size int, ty Enum, normalized bool, stride, offset int)
|
||||
Viewport(x, y, width, height int)
|
||||
} = (*Functions)(nil)
|
||||
|
||||
Reference in New Issue
Block a user