Skip to content

Commit

Permalink
Implement up to GL 4.4
Browse files Browse the repository at this point in the history
* passthrough the vendor/renderer from the host to client
* added two new environment variables for vendor/renderer overriding
* vsync works in applications tested, so removed note from README
* added CEIL_DIV macro for clarity
* replaced long with uintptr_t for better compatibility across compilers
  • Loading branch information
dmaivel committed Jul 4, 2024
1 parent 2d3ccc8 commit 071c026
Show file tree
Hide file tree
Showing 5 changed files with 2,433 additions and 24 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ options:
-o enables fps overlay on clients (shows server side fps)
-n enable networking instead of shared memory
-x remove shared memory file
-g [MAJOR.MINOR] report specific opengl version (default: 3.3)
-g [MAJOR.MINOR] report specific opengl version (default: 4.4)
-r [WIDTHxHEIGHT] set max resolution (default: 1920x1080)
-m [SIZE] max amount of megabytes program may allocate (default: 16mib)
-p [PORT] if networking is enabled, specify which port to use (default: 3000)
Expand All @@ -74,6 +74,8 @@ options:
| GL_VERSION_OVERRIDE | Digit.Digit | | Override the OpenGL version on the client side. Otherwise, the client uses the version reported by the server. Available for both Windows and Linux clients. |
| GLX_VERSION_OVERRIDE | Digit.Digit | 1.4 | Override the GLX version on the client side. Only available for Linux clients. |
| GLSL_VERSION_OVERRIDE | Digit.Digit | 3.3 | Override the GLSL version on the client side. Available for both Windows and Linux clients. |
| GL_VENDOR_OVERRIDE | String | `passthrough` | Override the vendor string on the client side. Available for both Windows and Linux clients. |
| GL_RENDERER_OVERRIDE | String | `passthrough` | Override the renderer string on the client side. Available for both Windows and Linux clients. |
| SGL_NET_OVER_SHARED | Ip:Port | | If networking is enabled, this environment variable must exist on the guest. Available for both Windows and Linux clients. |
| SGL_RUN_WITH_LOW_PRIORITY | Boolean | true | On older CPUs, by setting the process priority to low / `IDLE_PRIORITY_CLASS`, applications will run smoother as the kernel driver is given more CPU time. This may not be needed on systems with newer CPUs. Only available for Windows clients. |
Expand Down Expand Up @@ -246,18 +248,17 @@ This list describes the amount of functions left from each standard to implement
- [x] 3.2 (~14 remaining)
- [x] 3.3 (~29 remaining)
- [ ] OpenGL 4
- [ ] 4.0 (~24 remaining) (~46 total)
- [ ] 4.1 (~36 remaining) (~89 total)
- [ ] 4.2 (~4 remaining) (~12 total)
- [ ] 4.3 (~24 remaining) (~44 total)
- [ ] 4.4 (~8 remaining) (~9 total)
- [ ] 4.5 (~51 remaining) (~122 total)
- [x] 4.0 (~46 total)
- [x] 4.1 (~89 total)
- [x] 4.2 (~12 total)
- [x] 4.3 (~44 total)
- [x] 4.4 (~9 total)
- [ ] 4.5 (~42 remaining) (~122 total)
- [x] 4.6 (~4 total)
# Limitations / Issues
- Frame glitches possible when running multiple clients
- Clients may reserve too much memory according to server's allocated memory
- No Vsync
- Resizing is possible, no proper implementation
- New GLX FB configs may cause applications using `freeglut` or `glad` to no longer run
Expand Down
6 changes: 4 additions & 2 deletions inc/sharedgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
#define SGL_VP_DOWNLOAD_BLOCK_SIZE_IN_BYTES 3072
#define SGL_VP_DOWNLOAD_BLOCK_SIZE (SGL_VP_DOWNLOAD_BLOCK_SIZE_IN_BYTES / sizeof(int))

#define SGL_DEFAULT_MAJOR 3
#define SGL_DEFAULT_MINOR 3
#define SGL_DEFAULT_MAJOR 4
#define SGL_DEFAULT_MINOR 4

#define SGL_SHARED_MEMORY_NAME "sharedgl_shared_memory"

#define CEIL_DIV(num, den) ((num + den - 1) / den)

inline bool is_value_likely_an_offset(const void *p)
{
uintptr_t v = (uintptr_t)p;
Expand Down
Loading

0 comments on commit 071c026

Please sign in to comment.