Commit Graph

636 Commits

Author SHA1 Message Date
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
martinfouilleul 1250dfd7c1 hardcode GL/GLES versions per-platform for now 2023-02-22 18:30:10 +01:00
martinfouilleul 4b9b182762 Removed todo. Track todos/dev notes/etc in external obsidian vault for now 2023-02-22 17:21:31 +01:00
martinfouilleul 0f5c93b767 [win32 build] use /DELAYLOAD option for libEGL and libGLESv2 to allow apps that don't use GLES backend to work without redistributing those unused DLLs 2023-02-21 19:02:16 +01:00
martinfouilleul 665c63c3d0 [win32 build/link]
- Build milepost as a dynamic library
- Add import/export directives to public API symbols
- Change example build scripts accordingly
2023-02-21 18:43:30 +01:00
Martin Fouilleul dc2961f513 updated todo 2023-02-21 17:22:18 +01:00
Martin Fouilleul 3b26c92c85 [osx build/linking]
- Remove the need for client apps to explicitly link with all dependent libs and frameworks
- Don't require redistributing libEGL/libGLES if not used, by linking them with '-weak-l' option
- Change examples build scripts accordingly
2023-02-21 17:09:26 +01:00
Martin Fouilleul 94373d12ae [surface] extracted common layer functionality from osx surfaces. Use layer in platform-agnostic egl surface. 2023-02-21 13:40:30 +01:00
martinfouilleul 9ea9ea7636 [surface] abstracted child window layer from win32 surfaces 2023-02-21 12:35:22 +01:00
martinfouilleul 5ac512c15e [wgl] Keep dummy window/context around for gl context creation, and don't reload wgl functions every time 2023-02-20 20:20:52 +01:00
martinfouilleul 64d7b31e5c destroy gles surfaces resources 2023-02-20 19:38:24 +01:00
martinfouilleul 2dccfa5547 [win32 surfaces] Backing win32 surfaces with child window and implementing frame/hidding control 2023-02-20 18:34:29 +01:00
Martin Fouilleul 4306d0a01c back osx surfaces by CALayer 2023-02-20 16:49:44 +01:00
Martin Fouilleul 2232b647ed reintroduced GLES backend to osx 2023-02-20 11:05:01 +01:00
martinfouilleul 9eaa125129 add GLES headers to ext 2023-02-17 18:57:01 +01:00
martinfouilleul 333d3e9f9c [gles, wip] reintroducing egl surface (for win32 at first) 2023-02-17 18:56:16 +01:00
martinfouilleul 20e425494f Use a custom GL loader to allow different versions of GL/GLES APIs to co-exist. The loader fills an api struct with GL functions pointers.
We have a per-thread pointer to select which api struct is used, and GL functions are pound-defined to call the versions in that struct.
GL/GLES surfaces can use one of the loader function to load their api, and the prepare proc of the surface sets its api as the current one
before gl calls are issued.
2023-02-16 19:35:01 +01:00
Martin Fouilleul 54df26232c [wip, opengl] include gl headers in generated glapi files 2023-02-16 15:16:51 +01:00
Martin Fouilleul a32e2165c7 [wip, opengl] parsing opengl xml spec to auto-generate gl/gles loader 2023-02-16 13:59:11 +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 08d3521b61 [canvas/surface cleanup]
- properly destroy gl canvas backend
- properly destroy gl surface
2023-02-09 18:40:42 +01:00
martinfouilleul af7cbae1fa [canvas cleanup] cleanup canvas resources on creation failure 2023-02-09 18:18:12 +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 4a8c77f023 - Move and Zoom perf_text example with the mouse
- Reverted to using 4 bits of subpixel precision and computing cross products with 32 bits integers, for perf reasons
- Fixed some confusion in tile array size vs number of elements (could still clean-up naming a bit though)
- Fixed bug where triangles on the left or below canvas boundaries where bucketted to the first colum/row of tiles
- Fixed bug in mouse button message handling (was always sending press on left button)
2023-02-09 13:09:41 +01:00
martinfouilleul 833767d6e2 move text with the mouse in perf_text example 2023-02-09 09:50:53 +01:00
martinfouilleul 21c604104f fix mp_app_get_resource_path() 2023-02-08 20:40:48 +01:00
martinfouilleul c0601961f1 Reposition window when changing dpi 2023-02-08 20:40:48 +01:00
martinfouilleul 3f58b2ac3d glsl canvas shader: do cross products in 64 bits fixed point to avoid overflow 2023-02-08 20:36:39 +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 f0bc88c4fb gl canvas renderer with buffer re-specification 2023-02-07 17:00:59 +01:00
martinfouilleul 5788cdbcda Desktop opengl 4.3 canvas 2023-02-07 13:24:14 +01:00
martinfouilleul 91780b12c7 reorder fields in glsl vertex struct to be less wasteful 2023-02-06 17:01:32 +01:00
martinfouilleul 5754fc1ad2 using temporary buffer to build canvas verex data and use glBufferData with exact number of vertices to submit buffer to gpu 2023-02-06 16:14:43 +01:00
martinfouilleul 3dfaea1bba temporarily reducing vertex buffer size to test perf impact 2023-02-06 09:20:52 +01:00