Commit Graph

48 Commits

Author SHA1 Message Date
Martin Fouilleul 28f5af32fa [graphics] Allocate canvases and fonts from graphics subsystem's arena 2023-03-01 11:37:33 +01:00
Martin Fouilleul 6bf989564d [graphics] use a single handle arena for all graphics subsystem handles 2023-02-28 20:33:55 +01:00
Martin Fouilleul 5a19c03ad6 [canvas] removing unused old atlasing api 2023-02-28 18:47:45 +01:00
Martin Fouilleul 3615775168 [canvas] decompose image atlas API into simple rect atlas API + image atlas helpers. This avoids creating a bunch of new types/handles, and exposes the underlying image/sourceRegion so that user code can freely use these for more complex scenarios (eg drawing only a sub-region of an atlased image, or using an atlas image for arbitrary path filling) 2023-02-28 16:54:39 +01:00
Martin Fouilleul d4bceba7e9 [canvas] basic image atlas API 2023-02-28 13:16:36 +01:00
martinfouilleul 8f834fa1a5 [wip, canvas, gl] implementing basic image API 2023-02-27 19:25:41 +01:00
Martin Fouilleul 30aa6a4a48 [canvas] Put primitive's transform in the attributes struct. When rendering, set current transform at the beginning of mg_next_shape(). (This avoid using an additional prevTransform matrix to correctly setup uvTransform when mg_finalize_shape() at the beginning of mg_next_shape()) 2023-02-27 15:01:44 +01:00
Martin Fouilleul 9ed630fc55 [canvas]
- Clear final surface to clear color, and enable blending layers onto it
- Fixed Batching bug where we were writing to vertex/shape buffers while the previous batch is using them
- Fixed bug where uvTransform uses transform of next shape instead of that of shape being finalized
2023-02-27 11:56:04 +01:00
Martin Fouilleul e66932e624 [canvas] Set command attributes to canvas->attributes by default in mg_push_command() 2023-02-25 15:35:24 +01:00
Martin Fouilleul 193afb61fd [canvas] move canvas structs decl from graphics_internal.h to graphics.c, keep only surface/canvas backend interface stuff in graphics_internal.h 2023-02-25 15:23:15 +01:00
Martin Fouilleul 074b17b743 [canvas] Set transform matrix as part of primitive and don't replay push/pop during render 2023-02-25 14:20:07 +01:00
Martin Fouilleul b24de5d969 [canvas] Allow setting image source region 2023-02-25 12:59:49 +01:00
Martin Fouilleul 50569a1427 Allow setting texture on arbitrary path fills 2023-02-24 23:06:39 +01:00
Martin Fouilleul 4333ed02b0 [canvas] remove image draw commands, replace with rect/rounded rects + image source 2023-02-24 22:59:33 +01:00
Martin Fouilleul 1b62ec568c [canvas, mtl backend] Handle image rotation 2023-02-24 20:40:16 +01:00
Martin Fouilleul bb106b717f Build user-space bounding box of shape in mg_push_vertex() _before_ transforming vertices 2023-02-24 19:20:05 +01:00
Martin Fouilleul 11c25bf001 Make transform implicit in mg_push_vertex() 2023-02-24 19:11:03 +01:00
Martin Fouilleul 5be019d166 [canvas, metal] compute uv coords in shader using uvTransformed computed in canvas backend, using shape bounding box, image dimension, source and dest regions 2023-02-24 18:50:46 +01:00
Martin Fouilleul fd4c4e7be3 [canvas] simple image API 2023-02-24 12:01:00 +01:00
Martin Fouilleul d1b71110bb - Fixed metal canvas backend's drawBatch argument order
- Removed texturing in metal shader while we work on image API
- Started working on simple image API
2023-02-23 18:30:47 +01:00
Martin Fouilleul 2b60db292a [wip] image api 2023-02-23 17:07:41 +01:00
Martin Fouilleul 2232b647ed reintroduced GLES backend to osx 2023-02-20 11:05:01 +01:00
martinfouilleul 333d3e9f9c [gles, wip] reintroducing egl surface (for win32 at first) 2023-02-17 18:56:16 +01:00
martinfouilleul 80ea8db687 [surface/canvas cleanup]
- Make build-time and runtime backend selection a bit easier
- Reorganized backend-specific files with slightly more coherent naming scheme
2023-02-10 16:56:10 +01:00
martinfouilleul f54f639db5 properly destroying windows and fonts 2023-02-10 12:05:52 +01:00
martinfouilleul 35e396e4c4 [canvas cleanup]
- Remove attributes/color arguments in functions where we don't need them anymore (since they're defined when calling mg_next_shape())
- Renamed "_with_zindex" functions with "_path" -> these function only fill a path (eg rect), but don't increment the current shape
2023-02-09 17:02:58 +01:00
martinfouilleul 09a18419e4 [canvas] make shapeIndex implicit in calls to mg_push_vertex 2023-02-09 16:42:02 +01:00
martinfouilleul 4e816a838b [Clean canvas/shaders]
- Simplified shader names, prefix embedded strings by "glsl_"
- Extracted shader compilation in common function
- Add shader version string and common structs in canvas code rather than in every shader file
- Renamed zIndex with shapeIndex everywhere
2023-02-09 16:14:15 +01:00
martinfouilleul 7cf4c3d925 opengl surface/renderer: set surface scaling according to dpi of first monitor. Use that dpi to scale backing texture of canvas renderer. Note: changing monitor isn't handled yet! 2023-02-08 18:22:54 +01:00
martinfouilleul 7fbc4ba270 canvas renderer: Use clip rects to cull tiles/pixels in tiling and drawing passes 2023-02-08 12:59:31 +01:00
martinfouilleul e6e674ee04 Allow setting surface swap interval in opengl surface 2023-02-08 11:49:00 +01:00
martinfouilleul c982b524c0 Merge branch 'gl_canvas' of ssh://git.forkingpaths.dev/martinfouilleul/milepost into gl_canvas 2023-02-08 10:47:20 +01:00
martinfouilleul 38c27f21d6 canvas: allow flushing externally built commands with mg_flush_commands() 2023-02-08 10:46:12 +01:00
Martin Fouilleul afaa95fe07 applied canvas changes to metal backend 2023-02-08 10:42:21 +01:00
martinfouilleul 2419ab7889 opengl canvas renderer: splitting vertex data and shape data 2023-02-07 18:59:51 +01:00
martinfouilleul 5788cdbcda Desktop opengl 4.3 canvas 2023-02-07 13:24:14 +01:00
martinfouilleul 19988d045e breaking triangle buffer into batches each time the current image changes 2023-02-02 18:57:57 +01:00
martinfouilleul 0796b2cbcd Switched to fixed point in gles triangle rasterization, and fixed wrong offset curve check collapsing the internal control points 2023-02-02 11:40:22 +01:00
martinfouilleul e0300e9e3c Fixed indexing in gles_canvas_fragment shaders and fixed native keys buffer 2023-02-01 16:23:51 +01:00
Martin Fouilleul bd7e1a15f1 - Conflating mp_views and surfaces
- Implicit canvas context in canvas API
- GLES window surface on mac
2023-01-28 17:24:43 +01:00
Martin Fouilleul 9bf62d2218 re-working graphics surfaces 2022-12-26 18:33:31 +01:00
Martin Fouilleul db5b4966e9 - Restructure osx version to use mp_app_internal.h/mp_app.c
- test new run loop structure on osx
2022-12-24 15:33:32 +01:00
martinfouilleul 2421871c3e windows port initial commit: simple window with GL 4.3 context 2022-12-21 12:03:55 +01:00
Martin Fouilleul 440668129c Remote GLES surfaces 2022-08-19 20:55:00 +02:00
Martin Fouilleul 13cccdf5de trying to integrate mg_surface_client/server 2022-08-19 19:46:31 +02:00
Martin Fouilleul c3f149c910 Fixing metal compute shader coordinate bug that prevented rendering the last row/column of tiles 2022-08-15 17:20:44 +02:00
Martin Fouilleul 094b0efc33 text box 2022-08-15 10:20:29 +02:00
Martin Fouilleul 39cfa35bfd initial commit 2022-08-14 18:19:40 +02:00