aboutsummaryrefslogtreecommitdiff
path: root/graphics.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-04-05 08:36:24 +0000
committerrodri <rgl@antares-labs.eu>2024-04-05 08:36:24 +0000
commit2c286986893435895528d59c7db624261ac5571b (patch)
tree5d3a47ce5e05f0c4a08da7a35865b3a56f9aaae0 /graphics.h
parent8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff (diff)
downloadlibgraphics-2c286986893435895528d59c7db624261ac5571b.tar.gz
libgraphics-2c286986893435895528d59c7db624261ac5571b.tar.bz2
libgraphics-2c286986893435895528d59c7db624261ac5571b.zip
simplify the job scheduler. correct two mistakes regarding the Viewport.
> They made two mistakes. they hanged the wrong man and they didn't finish the job. so Clint Eastwood came back to kick my ass. the mistakes in question were that the Viewport shouldn't know about double buffering, conceptually it has a framebuffer and that's it. the second one was passing it to the renderer, when the renderer couldn't care less about what a viewport is.
Diffstat (limited to 'graphics.h')
-rw-r--r--graphics.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/graphics.h b/graphics.h
index 7dcc7ff..9a46914 100644
--- a/graphics.h
+++ b/graphics.h
@@ -79,6 +79,7 @@ struct Vertex
Color c; /* shading color */
Point2 uv; /* texture coordinate */
OBJMaterial *mtl;
+
/* TODO it'd be neat to use a dynamic hash table instead */
Vertexattr *attrs; /* attributes (aka varyings) */
ulong nattrs;
@@ -118,6 +119,7 @@ struct Entity
{
RFrame3;
Model *mdl;
+
Entity *prev, *next;
};
@@ -150,9 +152,7 @@ struct FSparams
struct SUparams
{
Framebuf *fb;
- int id;
Memimage *frag;
- Channel *donec;
Renderjob *job;
Entity *entity;
@@ -177,14 +177,11 @@ struct Renderer
struct Renderjob
{
- Viewport *v;
+ Framebuf *fb;
Scene *scene;
Shadertab *shaders;
Channel *donec;
-
ulong nrem; /* remaining entities to process */
- ulong lastid;
- uvlong time0;
Renderjob *next;
};
@@ -207,6 +204,8 @@ struct Framebufctl
void (*memdraw)(Framebufctl*, Memimage*);
void (*swap)(Framebufctl*);
void (*reset)(Framebufctl*);
+ Framebuf *(*getfb)(Framebufctl*);
+ Framebuf *(*getbb)(Framebufctl*);
};
struct Viewport
@@ -217,7 +216,6 @@ struct Viewport
void (*draw)(Viewport*, Image*);
void (*memdraw)(Viewport*, Memimage*);
Framebuf *(*getfb)(Viewport*);
- Framebuf *(*getbb)(Viewport*);
};
struct Camera