mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
gpu,gpu/gl: introduce Backend
A recent change made the OpenGL functions an interface of the functions required for the implementation of GPU, a renderer for Gio operations. That allowed for running Gio on external systems where OpenGL is available. However, to allow for non-OpenGL flavored backends such as Vulkan, Metal and Direct3D, this change introduces Backend for the high-level operations required by GPU. This change also adds a concrete backend to package gl. Type Backend is a first cut heavily based on OpenGL. Future changes will add more backends, where the Backend interface quite possibly will need refinement. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+8
-8
@@ -43,11 +43,11 @@ func (r *resourceCache) put(key interface{}, val resource) {
|
||||
r.newRes[key] = val
|
||||
}
|
||||
|
||||
func (r *resourceCache) frame(ctx *context) {
|
||||
func (r *resourceCache) frame() {
|
||||
for k, v := range r.res {
|
||||
if _, exists := r.newRes[k]; !exists {
|
||||
delete(r.res, k)
|
||||
v.release(ctx)
|
||||
v.release()
|
||||
}
|
||||
}
|
||||
for k, v := range r.newRes {
|
||||
@@ -56,9 +56,9 @@ func (r *resourceCache) frame(ctx *context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *resourceCache) release(ctx *context) {
|
||||
func (r *resourceCache) release() {
|
||||
for _, v := range r.newRes {
|
||||
v.release(ctx)
|
||||
v.release()
|
||||
}
|
||||
r.newRes = nil
|
||||
r.res = nil
|
||||
@@ -87,11 +87,11 @@ func (r *opCache) put(key ops.Key, val resource) {
|
||||
r.newRes[key] = val
|
||||
}
|
||||
|
||||
func (r *opCache) frame(ctx *context) {
|
||||
func (r *opCache) frame() {
|
||||
for k, v := range r.res {
|
||||
if _, exists := r.newRes[k]; !exists {
|
||||
delete(r.res, k)
|
||||
v.release(ctx)
|
||||
v.release()
|
||||
}
|
||||
}
|
||||
for k, v := range r.newRes {
|
||||
@@ -100,9 +100,9 @@ func (r *opCache) frame(ctx *context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *opCache) release(ctx *context) {
|
||||
func (r *opCache) release() {
|
||||
for _, v := range r.newRes {
|
||||
v.release(ctx)
|
||||
v.release()
|
||||
}
|
||||
r.newRes = nil
|
||||
r.res = nil
|
||||
|
||||
Reference in New Issue
Block a user