mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
gpu: avoid internal uniform buffer pointers
Uniform buffers are byte slice backed by Go structs. However, if a uniform buffer value is embedded in a larger structure with pointers, the Cgo pointer checker will complain. Avoid the error by moving the uniform values into separate structures. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+20
-14
@@ -216,22 +216,26 @@ type blitter struct {
|
||||
viewport image.Point
|
||||
prog [2]*program
|
||||
layout backend.InputLayout
|
||||
colUniforms struct {
|
||||
vert struct {
|
||||
blitUniforms
|
||||
_ [8]byte // Padding to a multiple of 16.
|
||||
}
|
||||
frag struct {
|
||||
colorUniforms
|
||||
}
|
||||
colUniforms *blitColUniforms
|
||||
texUniforms *blitTexUniforms
|
||||
quadVerts backend.Buffer
|
||||
}
|
||||
|
||||
type blitColUniforms struct {
|
||||
vert struct {
|
||||
blitUniforms
|
||||
_ [8]byte // Padding to a multiple of 16.
|
||||
}
|
||||
texUniforms struct {
|
||||
vert struct {
|
||||
blitUniforms
|
||||
_ [8]byte // Padding to a multiple of 16.
|
||||
}
|
||||
frag struct {
|
||||
colorUniforms
|
||||
}
|
||||
}
|
||||
|
||||
type blitTexUniforms struct {
|
||||
vert struct {
|
||||
blitUniforms
|
||||
_ [8]byte // Padding to a multiple of 16.
|
||||
}
|
||||
quadVerts backend.Buffer
|
||||
}
|
||||
|
||||
type uniformBuffer struct {
|
||||
@@ -431,6 +435,8 @@ func newBlitter(ctx backend.Device) *blitter {
|
||||
ctx: ctx,
|
||||
quadVerts: quadVerts,
|
||||
}
|
||||
b.colUniforms = new(blitColUniforms)
|
||||
b.texUniforms = new(blitTexUniforms)
|
||||
prog, layout, err := createColorPrograms(ctx, shader_blit_vert, shader_blit_frag,
|
||||
[2]interface{}{&b.colUniforms.vert, &b.texUniforms.vert}, [2]interface{}{&b.colUniforms.frag, nil})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user