diff --git a/CMakeLists.txt b/CMakeLists.txt index b68809c..9b05583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,20 @@ cmake_minimum_required(VERSION 3.5.0) -project(sharedgl VERSION 0.7.2 LANGUAGES C) +project(sharedgl VERSION 0.8.0 LANGUAGES C) include_directories(${CMAKE_SOURCE_DIR}/inc) # set(CMAKE_C_COMPILER "clang") +option(LINUX_LIB32 "Compile 32-bit libGL. Does not affect server." OFF) + IF(WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz") ELSE() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") ENDIF(WIN32) -file(GLOB GLOBBED_SERVER_SOURCES CONFIGURE_DEPENDS "src/server/*.c" "src/network/*.c") +file(GLOB GLOBBED_SERVER_SOURCES CONFIGURE_DEPENDS "src/server/*.c" "src/network/*.c" "src/client/scratch.c") # client stuff IF(UNIX) @@ -35,6 +37,10 @@ IF(UNIX) target_link_libraries(sharedgl-core X11) set_target_properties(sharedgl-core PROPERTIES OUTPUT_NAME "GL") set_target_properties(sharedgl-core PROPERTIES VERSION 1) + IF(LINUX_LIB32) + target_compile_options(sharedgl-core PRIVATE "-m32") + target_link_options(sharedgl-core PRIVATE "-m32") + ENDIF(LINUX_LIB32) ELSEIF(WIN32) add_library(sharedgl-core SHARED ${GLOBBED_CLIENT_SOURCES} ${GLOBBED_CLIENT_P_SOURCES}) IF(CMAKE_GENERATOR_PLATFORM MATCHES "Win32") diff --git a/README.md b/README.md index 87cec1d..3425308 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,16 @@ cmake --build . --target sharedgl-core --config Release For detailed build instructions for Windows, visit the [Windows section](#windows-in-a-vm). +### Build options + +These CMake options are accessible by either: +1. Using `ccmake` on `build` folder +2. Configuring with `-D...` + +| **Option** | **Legal values** | **Default** | **Description** | +|-|-|-|-| +| LINUX_LIB32 | ON/OFF | OFF | Enable if you wish to build the Linux client library (libGL) as 32-bit. This does not affect the server. | + # Usage The server must be started on the host before running any clients. Note that the server can only be ran on Linux. @@ -70,7 +80,6 @@ Variables labeled with `host` get their values from the host/server when their o | **Option** | **Legal values** | **Default** | **Description** | |-|-|-|-| -| SGL_SHARED_MEMORY_DIRECT | Boolean | true | If you intend on only running a single accelerated application at a time, this variable ensures maximum performance by writing/reading directly to/from shared memory. Make sure to set to `false` if you intend on using multiclient support. Available for both Windows and Linux clients. | | SGL_WINED3D_DONT_VFLIP | Boolean | false | If running a DirectX application via WineD3D, ensure this variable is set to `true` in order for the application to render the framebuffer in the proper orientation. Only available for Windows clients. | | SGL_RUN_WITH_LOW_PRIORITY | Boolean | false | On single core setups, by setting the process priority to low / `IDLE_PRIORITY_CLASS`, applications will run smoother as the kernel driver is given more CPU time. Users should only set this to `true` if the VM has only a single VCPU. Only available for Windows clients. | | GL_VERSION_OVERRIDE | Digit.Digit | `host` | Override the OpenGL version on the client side. Available for both Windows and Linux clients. | @@ -122,8 +131,6 @@ There are two possible drivers one may use: ``` 3. By default, this builds for Windows 10 x64 (`10_X64`). If you wish to compile for a different version or multiple versions, you must provide it through the command line like so: `kcertify.bat 10_X64,10_NI_X64`. A list of OS versions is provided on MSDN [here](https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/inf2cat). -If using multiclient support, please read about `SGL_SHARED_MEMORY_DIRECT` in the [environment variables](#environment-variables) section. - ### Library / ICD There are two ways to install the library on windows: diff --git a/inc/client/pb.h b/inc/client/pb.h index a33eead..aef494e 100644 --- a/inc/client/pb.h +++ b/inc/client/pb.h @@ -23,6 +23,9 @@ struct pb_net_hooks { void pb_set_net(struct pb_net_hooks hooks, size_t internal_alloc_size); #ifndef _WIN32 +/* + * to-do: determine if direct_access is really unneeded + */ void pb_set(int pb, bool direct_access); #else void pb_set(bool direct_access); diff --git a/inc/commongl.h b/inc/commongl.h index bf706e6..82f76e8 100644 --- a/inc/commongl.h +++ b/inc/commongl.h @@ -21,12 +21,15 @@ typedef int GLfixed; typedef unsigned long GLuint64; typedef long GLint64; typedef struct __GLsync *GLsync; +typedef int GLhandleARB; +typedef char GLcharARB; typedef void (*GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); /* GL types for handling large vertex buffer objects */ typedef long GLintptr; typedef signed long GLsizeiptr; +typedef signed long GLsizeiptrARB; /* Boolean */ #define GL_FALSE (GLboolean)0 diff --git a/inc/server/overlay_font.h b/inc/server/overlay_font.h new file mode 100644 index 0000000..743597c --- /dev/null +++ b/inc/server/overlay_font.h @@ -0,0 +1,267 @@ +#ifndef _OVERLAY_FONT_H_ +#define _OVERLAY_FONT_H_ + +#define CHAR_WIDTH 8 +#define CHAR_HEIGHT 16 + +static const unsigned char IBM[4096] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x7e, 0x24, 0x24, 0x7e, 0x48, 0x48, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x3e, 0x49, 0x48, 0x38, 0x0e, 0x09, 0x49, 0x3e, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x31, 0x4a, 0x4a, 0x34, 0x08, 0x08, 0x16, 0x29, 0x29, 0x46, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x22, 0x14, 0x18, 0x29, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, 0x2a, 0x1c, 0x2a, 0x49, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x24, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x1c, 0x02, 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x14, 0x24, 0x44, 0x44, 0x7e, 0x04, 0x04, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x4a, 0x56, 0x52, 0x52, 0x52, 0x4e, 0x20, 0x1e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x4e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x66, 0x66, 0x5a, 0x5a, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, 0x52, 0x4a, 0x4a, 0x46, 0x46, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x5a, 0x66, 0x3c, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x7c, 0x48, 0x44, 0x44, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x30, 0x0c, 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x5a, 0x5a, 0x66, 0x66, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, + 0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3a, 0x44, 0x44, 0x44, 0x38, 0x20, 0x3c, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x48, 0x30, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x02, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x30, 0x0c, 0x02, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x02, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x10, 0x10, 0x08, 0x08, 0x10, 0x20, 0x10, 0x08, 0x08, 0x10, 0x10, 0x0c, + 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x10, 0x08, 0x04, 0x08, 0x10, 0x10, 0x08, 0x08, 0x30, + 0x00, 0x00, 0x00, 0x31, 0x49, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x73, 0xca, 0x4b, 0xca, 0x73, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x71, 0xca, 0x73, 0xc2, 0x42, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x49, 0xca, 0x7a, 0xca, 0x49, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x73, 0xca, 0x73, 0xca, 0x72, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x4b, 0xea, 0x5b, 0xca, 0x4b, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x74, 0xa6, 0x25, 0xa4, 0x74, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x4b, 0xea, 0x5b, 0xca, 0x4b, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x31, 0x88, 0x73, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x79, 0xc2, 0x79, 0xc0, 0x7b, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x4b, 0xc9, 0x79, 0xc9, 0x49, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x25, 0xa4, 0x3c, 0xa4, 0x24, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x45, 0xc4, 0x44, 0xa8, 0x10, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x72, 0xca, 0x72, 0xc2, 0x43, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x72, 0xca, 0x72, 0xc2, 0x43, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x0e, 0x89, 0x0e, 0x8a, 0x09, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x31, 0x88, 0x73, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x31, 0x88, 0x73, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x71, 0xca, 0x4a, 0xca, 0x71, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x72, 0xca, 0x72, 0xc2, 0x41, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x72, 0xca, 0x72, 0xc2, 0x41, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x3b, 0xc1, 0x31, 0x89, 0x71, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x42, 0xc2, 0x39, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x22, 0xb6, 0x2a, 0xa2, 0x22, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x3b, 0xc2, 0x33, 0x8a, 0x72, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x7b, 0xc2, 0x7b, 0xc2, 0x7a, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x32, 0x8a, 0x71, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x33, 0xc4, 0x25, 0x94, 0x63, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x32, 0x8a, 0x71, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x39, 0xc2, 0x41, 0xc0, 0x3b, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x0e, 0x90, 0x0c, 0x82, 0x1c, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x31, 0xca, 0x49, 0xc8, 0x33, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x1c, 0x92, 0x1c, 0x90, 0x10, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0xaa, 0x00, 0x80, 0x00, 0x80, 0x33, 0xca, 0x7b, 0xca, 0x4a, 0x80, 0x00, 0x80, 0x00, 0x80, 0x55, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3e, 0x49, 0x48, 0x48, 0x49, 0x3e, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0e, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x3e, 0x61, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x3c, 0x24, 0x42, 0x42, 0x24, 0x3c, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x7f, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x3c, 0x42, 0x42, 0x3c, 0x02, 0x42, 0x3c, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0xa1, 0xa1, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x02, 0x1e, 0x22, 0x1e, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x24, 0x24, 0x48, 0x24, 0x24, 0x12, 0x12, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x02, 0x00, 0x00, + 0xaa, 0x00, 0x80, 0x3a, 0xc2, 0x33, 0x8a, 0x72, 0x80, 0x00, 0x80, 0x03, 0x80, 0x00, 0x80, 0x55, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0xb9, 0xa5, 0xa5, 0xb9, 0xa9, 0xa5, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x20, 0x40, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x66, 0x59, 0x40, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7a, 0x7a, 0x7a, 0x3a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x30, + 0x00, 0x00, 0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x22, 0x22, 0x22, 0x1c, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x24, 0x24, 0x12, 0x24, 0x24, 0x48, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x62, 0x24, 0x28, 0x28, 0x12, 0x16, 0x2a, 0x4e, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x62, 0x24, 0x28, 0x28, 0x14, 0x1a, 0x22, 0x44, 0x4e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x62, 0x12, 0x24, 0x18, 0x68, 0x12, 0x16, 0x2a, 0x4e, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x20, 0x40, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x18, 0x24, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x32, 0x4c, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x18, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x28, 0x48, 0x48, 0x7f, 0x48, 0x48, 0x48, 0x48, 0x4f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x08, 0x30, + 0x30, 0x0c, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x18, 0x24, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, + 0x18, 0x06, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x18, 0x24, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0xf2, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00, + 0x32, 0x4c, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, 0x52, 0x4a, 0x4a, 0x46, 0x46, 0x42, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x18, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x32, 0x4c, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x24, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x3a, 0x44, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x22, 0x5c, 0x40, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x18, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x0c, 0x30, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x78, 0x44, 0x42, 0x42, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x48, 0x58, 0x44, 0x42, 0x42, 0x52, 0x4c, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3e, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x49, 0x09, 0x3f, 0x48, 0x48, 0x49, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x08, 0x30, + 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x32, 0x0c, 0x14, 0x22, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3c, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x3c, 0x40, 0x00, + 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x02, 0x3c, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x40, 0x40, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x02, 0x3c, +}; + +#endif \ No newline at end of file diff --git a/inc/sharedgl.h b/inc/sharedgl.h index 80a29b9..b5f56f5 100644 --- a/inc/sharedgl.h +++ b/inc/sharedgl.h @@ -28,18 +28,19 @@ fprintf(stderr, __VA_ARGS__); \ } -#define SGL_OFFSET_REGISTER_SUBMIT (sizeof(int) * 0) -#define SGL_OFFSET_REGISTER_RETVAL (sizeof(int) * 1) -#define SGL_OFFSET_REGISTER_READY_HINT (sizeof(int) * 2) -#define SGL_OFFSET_REGISTER_LOCK (sizeof(int) * 3) -#define SGL_OFFSET_REGISTER_CLAIM_ID (sizeof(int) * 4) -#define SGL_OFFSET_REGISTER_CONNECT (sizeof(int) * 5) -#define SGL_OFFSET_REGISTER_FBSTART (sizeof(int) * 6) -#define SGL_OFFSET_REGISTER_MEMSIZE (sizeof(int) * 8) -#define SGL_OFFSET_REGISTER_GLMAJ (sizeof(int) * 11) -#define SGL_OFFSET_REGISTER_GLMIN (sizeof(int) * 12) -#define SGL_OFFSET_REGISTER_RETVAL_V (sizeof(int) * 13) -#define SGL_OFFSET_COMMAND_START 0x1000 +#define SGL_OFFSET_REGISTER_SUBMIT (sizeof(int) * 0) +#define SGL_OFFSET_REGISTER_RETVAL (sizeof(int) * 1) +#define SGL_OFFSET_REGISTER_READY_HINT (sizeof(int) * 2) +#define SGL_OFFSET_REGISTER_LOCK (sizeof(int) * 3) +#define SGL_OFFSET_REGISTER_CLAIM_ID (sizeof(int) * 4) +#define SGL_OFFSET_REGISTER_CONNECT (sizeof(int) * 5) +#define SGL_OFFSET_REGISTER_FBSTART (sizeof(int) * 6) +#define SGL_OFFSET_REGISTER_MEMSIZE (sizeof(int) * 8) +#define SGL_OFFSET_REGISTER_SWAP_BUFFERS_SYNC (sizeof(int) * 10) +#define SGL_OFFSET_REGISTER_GLMAJ (sizeof(int) * 11) +#define SGL_OFFSET_REGISTER_GLMIN (sizeof(int) * 12) +#define SGL_OFFSET_REGISTER_RETVAL_V (sizeof(int) * 13) +#define SGL_OFFSET_COMMAND_START 0x1000 /* * max return in RETVAL_V is 4044 @@ -64,10 +65,11 @@ # define FORCEINLINE __attribute__((always_inline)) #endif +#define LIKELY_OFFSET_LIMIT 0x100000 static inline bool is_value_likely_an_offset(const void *p) { uintptr_t v = (uintptr_t)p; - return v < 0x100000; + return v < LIKELY_OFFSET_LIMIT; } /* @@ -75,7 +77,7 @@ static inline bool is_value_likely_an_offset(const void *p) */ enum { SGL_CMD_INVALID, - SGL_CMD_FLIP, // USE SGL_CMD_REQUEST_FRAMEBUFFER INSTEAD + SGL_CMD_FLIP, // USE SGL_CMD_SWAP_BUFFERS INSTEAD SGL_CMD_SEND_DATA, SGL_CMD_GET_CONTEXT, SGL_CMD_SET_CONTEXT, @@ -88,7 +90,7 @@ enum { SGL_CMD_REPORT_DIMS, // NOT USED SGL_CMD_HELLO_WORLD, SGL_CMD_GOODBYE_WORLD, - SGL_CMD_REQUEST_FRAMEBUFFER, + SGL_CMD_SWAP_BUFFERS, SGL_CMD_CULLFACE, SGL_CMD_FRONTFACE, @@ -1138,6 +1140,41 @@ enum { SGL_CMD_MULTIDRAWARRAYSINDIRECTCOUNT, SGL_CMD_MULTIDRAWELEMENTSINDIRECTCOUNT, SGL_CMD_POLYGONOFFSETCLAMP, + + SGL_CMD_GETOBJECTPARAMETERIVARB, + SGL_CMD_ATTACHOBJECTARB, + SGL_CMD_BINDATTRIBLOCATIONARB, + SGL_CMD_BINDBUFFERARB, + SGL_CMD_BINDPROGRAMARB, + SGL_CMD_BUFFERDATAARB, + SGL_CMD_COMPILESHADERARB, + SGL_CMD_CREATEPROGRAMOBJECTARB, + SGL_CMD_CREATESHADEROBJECTARB, + SGL_CMD_DELETEBUFFERSARB, + SGL_CMD_DELETEOBJECTARB, + SGL_CMD_DELETEPROGRAMSARB, + SGL_CMD_DELETEQUERIESARB, + SGL_CMD_DETACHOBJECTARB, + SGL_CMD_GENBUFFERSARB, + SGL_CMD_GENPROGRAMSARB, + SGL_CMD_GENQUERIESARB, + SGL_CMD_GETINFOLOGARB, + SGL_CMD_GETPROGRAMIVARB, + SGL_CMD_GETUNIFORMLOCATIONARB, + SGL_CMD_LINKPROGRAMARB, + SGL_CMD_MAPBUFFERARB, + SGL_CMD_PROGRAMSTRINGARB, + SGL_CMD_SHADERSOURCEARB, + SGL_CMD_UNIFORM1IARB, + SGL_CMD_PROGRAMENVPARAMETERS4FVEXT, + SGL_CMD_COLORMASKINDEXEDEXT, + SGL_CMD_ENABLEINDEXEDEXT, + SGL_CMD_DISABLEINDEXEDEXT, + SGL_CMD_GETBOOLEANINDEXEDVEXT, + SGL_CMD_ACTIVETEXTUREARB, + SGL_CMD_MULTITEXCOORD2FARB, + SGL_CMD_BUFFERSUBDATAARB, + SGL_CMD_MAX }; diff --git a/src/client/glimpl.c b/src/client/glimpl.c index b8a19f9..ec92203 100644 --- a/src/client/glimpl.c +++ b/src/client/glimpl.c @@ -21,7 +21,7 @@ #include #endif -#define GLIMPL_USES_SHARED_MEMORY (net_ctx == NULL) +#define GLIMPL_RUNTIME_USES_SHARED_MEMORY (net_ctx == NULL) #define GLIMPL_MAX_OBJECTS 256 #define GLIMPL_MAX_TEXTURES 8 @@ -140,7 +140,7 @@ struct gl_map_buffer glimpl_map_buffer; float glimpl_global_matrix_double_to_float[GLIMPL_MAX_COUNT_FOR_MATRIX_OP]; -#define NUM_EXTENSIONS 78 +#define NUM_EXTENSIONS 84 static const char *glimpl_extensions_full = "GL_ARB_ES2_compatibility " "GL_ARB_ES3_compatibility " "GL_ARB_color_buffer_float " @@ -218,7 +218,14 @@ static const char *glimpl_extensions_full = "GL_ARB_ES2_compatibility " "GL_EXT_texture_filter_anisotropic " "GL_EXT_texture_sRGB " "GL_EXT_texture_sRGB_decode " - "GL_NV_texture_barrier "; + "GL_NV_texture_barrier " + "GL_NV_texture_barrier " + "GL_ARB_occlusion_query " + "GL_ARB_vertex_array_bgra " + "GL_EXT_vertex_array_bgra " + "GL_EXT_direct_state_access " + "GL_EXT_framebuffer_multisample_blit_scaled " + "GL_EXT_texture_compression_dxt1"; static const char glimpl_extensions_list[NUM_EXTENSIONS][48] = { "GL_ARB_ES2_compatibility", @@ -298,7 +305,13 @@ static const char glimpl_extensions_list[NUM_EXTENSIONS][48] = { "GL_EXT_texture_filter_anisotropic", "GL_EXT_texture_sRGB", "GL_EXT_texture_sRGB_decode", - "GL_NV_texture_barrier" + "GL_NV_texture_barrier", + "GL_ARB_occlusion_query", + "GL_ARB_vertex_array_bgra", + "GL_EXT_vertex_array_bgra", + "GL_EXT_direct_state_access", + "GL_EXT_framebuffer_multisample_blit_scaled", + "GL_EXT_texture_compression_dxt1" }; /* fake variables to be used with network feature only */ @@ -353,13 +366,14 @@ static void push_string(const char *s) { int len = strlen(s); int last = 0; + int rem = len % 4; + int shift = 0; + for (int j = 0; j < len / 4; j++) { pb_push(*(int*)&s[j * 4]); last = *(int*)&s[j * 4]; } - int rem = len % 4; - int shift = 0; if (rem != 0) { int res = 0; while (rem) { @@ -382,84 +396,85 @@ static void push_string(const char *s) */ bool expecting_retval = true; -void glimpl_submit() +static inline void submit_shm() { /* - * processor stops at 0 + * lock */ - pb_push(0); + spin_lock(lockg); - if (GLIMPL_USES_SHARED_MEMORY) { - /* - * lock - */ - spin_lock(lockg); + /* + * hint to server that we're ready + */ + pb_write(SGL_OFFSET_REGISTER_READY_HINT, client_id); - /* - * hint to server that we're ready - */ - pb_write(SGL_OFFSET_REGISTER_READY_HINT, client_id); + /* + * copy internal buffer to shared memory and submit + */ + pb_copy_to_shared(); + pb_write(SGL_OFFSET_REGISTER_SUBMIT, 1); + while (pb_read(SGL_OFFSET_REGISTER_SUBMIT) == 1); + pb_reset(); - /* - * copy internal buffer to shared memory and submit - */ - pb_copy_to_shared(); - pb_write(SGL_OFFSET_REGISTER_SUBMIT, 1); - while (pb_read(SGL_OFFSET_REGISTER_SUBMIT) == 1); - pb_reset(); + /* + * unlock + */ + spin_unlock(lockg); +} - /* - * unlock - */ - spin_unlock(lockg); +static inline void submit_net() +{ + void *ptr = pb_iptr(0); + size_t size = pb_size(); + int blocks = CEIL_DIV(size, SGL_FIFO_UPLOAD_COMMAND_BLOCK_SIZE); + size_t min_size = 0; + size_t count = size / 4; + struct sgl_packet_retval packet; + + /* + * packet + */ + for (int i = 0; i < blocks; i++) { + size_t packet_count = count > SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT ? SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT : count; + + struct sgl_packet_fifo_upload packet = { + /* client_id = */ client_id, + /* expected_chunks = */ blocks, + /* index = */ i, + /* count = */ packet_count, + /* commands = */ { 0 } + }; + + memcpy(packet.commands, (char*)ptr + (i * SGL_FIFO_UPLOAD_COMMAND_BLOCK_SIZE), packet_count * sizeof(uint32_t)); + net_send_tcp(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet)); + + count -= SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT; } - else { - /* - * get internal pointer & used size - */ - void *ptr = pb_iptr(0); - size_t size = pb_size(); - - int blocks = size / SGL_FIFO_UPLOAD_COMMAND_BLOCK_SIZE + (size % SGL_FIFO_UPLOAD_COMMAND_BLOCK_SIZE != 0); - size_t min_size = 0; - /* - * packet - */ -retry:; - size_t count = size / 4; - for (int i = 0; i < blocks; i++) { - size_t packet_count = count > SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT ? SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT : count; - - struct sgl_packet_fifo_upload packet = { - /* client_id = */ client_id, - /* expected_chunks = */ blocks, - /* index = */ i, - /* count = */ packet_count, - /* commands = */ { 0 } - }; - - memcpy(packet.commands, (char*)ptr + (i * SGL_FIFO_UPLOAD_COMMAND_BLOCK_SIZE), packet_count * sizeof(uint32_t)); - net_send_tcp(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet)); - - count -= SGL_FIFO_UPLOAD_COMMAND_BLOCK_COUNT; - } + /* + * get retval registers + */ + if (expecting_retval) + net_recv_tcp_timeout(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet), 500); - /* - * get retval registers - */ - struct sgl_packet_retval packet; - if (expecting_retval) - if (!net_recv_tcp_timeout(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet), 500)) - goto retry; + /* + * write response into fake register space + */ + memcpy(fake_register_space, &packet, 256 + 8); + pb_reset(); +} - /* - * write response into fake register space - */ - memcpy(fake_register_space, &packet, 256 + 8); +void glimpl_submit() +{ + /* + * processor stops at 0 + */ + pb_push(0); - pb_reset(); - } + if (GLIMPL_RUNTIME_USES_SHARED_MEMORY) + submit_shm(); + else + submit_net(); } void glimpl_goodbye() @@ -488,159 +503,174 @@ void glimpl_goodbye() #endif } -void glimpl_swap_buffers(int width, int height, int vflip, int format) +static inline void swap_buffers_shm(int width, int height, int vflip, int format) { - if (GLIMPL_USES_SHARED_MEMORY) { - pb_push(SGL_CMD_REQUEST_FRAMEBUFFER); - pb_push(width); - pb_push(height); - pb_push(vflip); - pb_push(format); - glimpl_submit(); - } - else { - glimpl_submit(); + pb_push(SGL_CMD_SWAP_BUFFERS); + pb_push(width); + pb_push(height); + pb_push(vflip); + pb_push(format); + glimpl_submit(); +} - struct sgl_packet_swapbuffers_request packet = { - /* client_id = */ client_id, - /* width = */ width, - /* height = */ height, - /* vflip = */ vflip, - /* format = */ format - }; +static inline void swap_buffers_net(int width, int height, int vflip, int format) +{ + int expected = CEIL_DIV((width * height * 4), SGL_SWAPBUFFERS_RESULT_SIZE); + struct sgl_packet_sync sync; - net_send_udp(net_ctx, &packet, sizeof(packet), 0); - - int expected = CEIL_DIV((width * height * 4), SGL_SWAPBUFFERS_RESULT_SIZE); + glimpl_submit(); - // wait for sync, timeout appears to disturb fifo upload - struct sgl_packet_sync sync; - net_recv_tcp(net_ctx, NET_SOCKET_SERVER, &sync, sizeof(sync)); + struct sgl_packet_swapbuffers_request packet = { + /* client_id = */ client_id, + /* width = */ width, + /* height = */ height, + /* vflip = */ vflip, + /* format = */ format + }; - for (int i = 0; i < expected * 4; i++) { - struct sgl_packet_swapbuffers_result result; - // while (net_recv_udp(net_ctx, &result, sizeof(result), 0) == -1); - int recieved = net_recv_udp(net_ctx, &result, sizeof(result), 0); + net_send_udp(net_ctx, &packet, sizeof(packet), 0); - // global, so throwout any results that aren't ours (possible vuln for other applications? idk) - if (result.client_id != client_id || recieved < 0) { - // i--; - continue; - } + // wait for sync, timeout appears to disturb fifo upload + net_recv_tcp(net_ctx, NET_SOCKET_SERVER, &sync, sizeof(sync)); - memcpy((char*)fake_framebuffer + (result.index * SGL_SWAPBUFFERS_RESULT_SIZE), result.result, result.size); + for (int i = 0; i < expected * 4; i++) { + struct sgl_packet_swapbuffers_result result; + // while (net_recv_udp(net_ctx, &result, sizeof(result), 0) == -1); + int recieved = net_recv_udp(net_ctx, &result, sizeof(result), 0); + + // global, so throwout any results that aren't ours (possible vuln for other applications? idk) + if (result.client_id != client_id || recieved < 0) { + // i--; + continue; } + + memcpy((char*)fake_framebuffer + (result.index * SGL_SWAPBUFFERS_RESULT_SIZE), result.result, result.size); } } +void glimpl_swap_buffers(int width, int height, int vflip, int format) +{ + if (GLIMPL_RUNTIME_USES_SHARED_MEMORY) + swap_buffers_shm(width, height, vflip, format); + else + swap_buffers_net(width, height, vflip, format); +} + void *glimpl_fb_address() { /* fake framebuffer used with network feature only */ - if (fake_framebuffer) + if (!GLIMPL_RUNTIME_USES_SHARED_MEMORY) return fake_framebuffer; return pb_ptr(pb_read64(SGL_OFFSET_REGISTER_FBSTART)); } -void glimpl_init() +static inline void init_shm(bool use_direct_access) { - char *network = getenv("SGL_NET_OVER_SHARED"); - char *direct_access = getenv("SGL_SHARED_MEMORY_DIRECT"); - - bool use_direct_access = direct_access == NULL; - if (direct_access != NULL) - use_direct_access = strcmp(direct_access, "true") == 0; - - if (network == NULL) { #ifndef _WIN32 - int fd = shm_open(SGL_SHARED_MEMORY_NAME, O_RDWR, S_IRWXU); - if (fd == -1) - fd = sgl_detect_device_memory("/dev/sharedgl"); - if (fd == -1) { - fprintf(stderr, "glimpl_init: failed to find memory\n"); - exit(1); - } + int fd = shm_open(SGL_SHARED_MEMORY_NAME, O_RDWR, S_IRWXU); + if (fd == -1) + fd = sgl_detect_device_memory("/dev/sharedgl"); + if (fd == -1) { + fprintf(stderr, "init_shm: failed to find memory\n"); + exit(1); + } - pb_set(fd, use_direct_access); + pb_set(fd, use_direct_access); #else - pb_set(use_direct_access); + pb_set(use_direct_access); #endif - pb_reset(); - } - else { - /* - * string is formatted address:port, so we want to split it into two strings - */ - for (char *c = network; *c; c++) { - if (*c == ':') { - *c = 0; - break; - } - } + pb_reset(); +} - char *res = net_init_client(&net_ctx, network, atoi(&network[strlen(network) + 1])); - if (res != NULL) { - fprintf(stderr, "glimpl_init: could not initialize client (%s)\n", res); - exit(1); +static inline void shm_create_context() +{ + lockg = pb_ptr(SGL_OFFSET_REGISTER_LOCK); + + /* + * claim client id and increment the register for the + * next claimee to claim + */ + spin_lock(lockg); + client_id = pb_read(SGL_OFFSET_REGISTER_CLAIM_ID); + pb_write(SGL_OFFSET_REGISTER_READY_HINT, client_id); + pb_write(SGL_OFFSET_REGISTER_CLAIM_ID, client_id + 1); + + /* + * notify the server we would like to connect + */ + pb_write(SGL_OFFSET_REGISTER_CONNECT, client_id); + spin_unlock(lockg); + + /* + * submit + */ + pb_push(SGL_CMD_CREATE_CONTEXT); + glimpl_submit(); + + int packed_dims = pb_read(SGL_OFFSET_REGISTER_RETVAL); + icd_set_max_dimensions(UNPACK_A(packed_dims), UNPACK_B(packed_dims)); +} + +static inline void init_net(char *network) +{ + struct sgl_packet_connect packet = { 0 }; + char *res; + struct pb_net_hooks hooks = { + pb_read_hook, + pb_read64_hook, + NULL, + NULL, + NULL, + pb_ptr_hook, + NULL + }; + + /* + * string is formatted address:port, so we want to split it into two strings + */ + for (char *c = network; *c; c++) { + if (*c == ':') { + *c = 0; + break; } + } - struct sgl_packet_connect packet = { 0 }; - net_recv_tcp(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet)); + res = net_init_client(&net_ctx, network, atoi(&network[strlen(network) + 1])); + if (res != NULL) { + fprintf(stderr, "init_net: could not initialize client (%s)\n", res); + exit(1); + } - glimpl_major = packet.gl_major; - glimpl_minor = packet.gl_minor; + net_recv_tcp(net_ctx, NET_SOCKET_SERVER, &packet, sizeof(packet)); - client_id = packet.client_id; + glimpl_major = packet.gl_major; + glimpl_minor = packet.gl_minor; - fake_register_space = malloc(SGL_OFFSET_COMMAND_START); - fake_framebuffer = malloc(packet.framebuffer_size); + client_id = packet.client_id; - struct pb_net_hooks hooks = { - pb_read_hook, - pb_read64_hook, - NULL, - NULL, - NULL, - pb_ptr_hook, - NULL - }; + fake_register_space = malloc(SGL_OFFSET_COMMAND_START); + fake_framebuffer = malloc(packet.framebuffer_size); - pb_set_net(hooks, packet.fifo_size); + pb_set_net(hooks, packet.fifo_size); - icd_set_max_dimensions(packet.max_width, packet.max_height); - } + icd_set_max_dimensions(packet.max_width, packet.max_height); +} +void glimpl_init() +{ + char *network = getenv("SGL_NET_OVER_SHARED"); char *gl_version_override = getenv("GL_VERSION_OVERRIDE"); + if (network == NULL) + init_shm(false); + else + init_net(network); + glimpl_major = gl_version_override ? gl_version_override[0] - '0' : pb_read(SGL_OFFSET_REGISTER_GLMAJ); glimpl_minor = gl_version_override ? gl_version_override[2] - '0' : pb_read(SGL_OFFSET_REGISTER_GLMIN); - if (GLIMPL_USES_SHARED_MEMORY) { - lockg = pb_ptr(SGL_OFFSET_REGISTER_LOCK); - - /* - * claim client id and increment the register for the - * next claimee to claim - */ - spin_lock(lockg); - client_id = pb_read(SGL_OFFSET_REGISTER_CLAIM_ID); - pb_write(SGL_OFFSET_REGISTER_READY_HINT, client_id); - pb_write(SGL_OFFSET_REGISTER_CLAIM_ID, client_id + 1); - - /* - * notify the server we would like to connect - */ - pb_write(SGL_OFFSET_REGISTER_CONNECT, client_id); - spin_unlock(lockg); - - /* - * submit - */ - pb_push(SGL_CMD_CREATE_CONTEXT); - glimpl_submit(); - - int packed_dims = pb_read(SGL_OFFSET_REGISTER_RETVAL); - icd_set_max_dimensions(UNPACK_A(packed_dims), UNPACK_B(packed_dims)); - } + if (GLIMPL_RUNTIME_USES_SHARED_MEMORY) + shm_create_context(); glimpl_map_buffer.mem = scratch_buffer_get(0x1000); } @@ -665,6 +695,7 @@ static inline size_t glimpl_get_pixel_size(GLenum format) case GL_RGB: case GL_BGR: case GL_RGB8: + case GL_DEPTH_COMPONENT: return 3; case GL_LUMINANCE_ALPHA: case GL_RG: @@ -684,13 +715,14 @@ static inline size_t glimpl_get_pixel_size(GLenum format) case GL_RGBA16UI: return 8; default: + STUB(); return 1; } } static inline size_t glimpl_type_size(GLenum type) { - switch(type) { + switch(type) { case GL_BYTE: case GL_UNSIGNED_BYTE: return sizeof(GLbyte); @@ -710,9 +742,10 @@ static inline size_t glimpl_type_size(GLenum type) return sizeof(GLfixed); case GL_HALF_FLOAT: return sizeof(GLshort); - } + } - return 1; + STUB(); + return 1; } static inline void glimpl_upload_buffer(const void *data, size_t size) @@ -755,6 +788,24 @@ static void glimpl_upload_texture(GLsizei width, GLsizei height, GLsizei depth, glimpl_upload_buffer(pixels, total_size); } +static inline void glimpl_push_vertex_attrib_pointers(int count) +{ + for (int i = 0; i < GLIMPL_MAX_OBJECTS; i++) { + struct gl_vertex_attrib_pointer *vap = &glimpl_vaps[i]; + if (vap->client_managed) { + glimpl_upload_buffer(vap->ptr, vap->size * count * glimpl_type_size(vap->type)); + + pb_push(SGL_CMD_VERTEXATTRIBPOINTER); + pb_push(vap->index); + pb_push(vap->size); + pb_push(vap->type); + pb_push(vap->normalized); + pb_push(vap->stride); + pb_push(LIKELY_OFFSET_LIMIT + 1); // force server to use upload + } + } +} + static inline bool glimpl_push_client_pointer(int count, int size, int type, int stride, const void *pointer) { const unsigned char *data = pointer; @@ -782,7 +833,7 @@ static inline bool glimpl_push_client_pointer(int count, int size, int type, int static inline void glimpl_push_client_pointers(int mode, int count) { if (glimpl_normal_ptr.in_use) { - bool status = glimpl_push_client_pointer(count, glimpl_vertex_ptr.size, + bool status = glimpl_push_client_pointer(count, 3, /* probably not glimpl_vertex_ptr.size */ glimpl_normal_ptr.type, glimpl_normal_ptr.stride, glimpl_normal_ptr.pointer); pb_push(SGL_CMD_NORMALPOINTER); @@ -793,7 +844,11 @@ static inline void glimpl_push_client_pointers(int mode, int count) } if (glimpl_color_ptr.in_use) { - bool status = glimpl_push_client_pointer(count, glimpl_color_ptr.size, + int true_size = glimpl_color_ptr.size; + if (true_size > 8) + true_size = glimpl_get_pixel_size(true_size); + + bool status = glimpl_push_client_pointer(count, true_size, glimpl_color_ptr.type, glimpl_color_ptr.stride, glimpl_color_ptr.pointer); pb_push(SGL_CMD_COLORPOINTER); @@ -866,6 +921,7 @@ static inline void glimpl_draw_elements(int mode, int type, int start, int end, // increment bc we want count, not the value of the largest index max_index++; + glimpl_push_vertex_attrib_pointers(max_index); glimpl_push_client_pointers(mode, max_index); /* @@ -1012,10 +1068,10 @@ static void glimpl_get_buffer_parameter(int cmd, GLuint buffer, GLenum pname, GL static void *glimpl_map_buffer_range(int cmd, GLenum buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) { bool ranged = true; - if (glimpl_map_buffer.in_use) { - fprintf(stderr, "glimpl_map_buffer_range: map buffer already in use, returning NULL\n"); - return NULL; - } + // if (glimpl_map_buffer.in_use) { + // fprintf(stderr, "glimpl_map_buffer_range: map buffer already in use, returning NULL\n"); + // return glimpl_map_buffer.mem; + // } /* * length is 0 when this function is called by glMapBuffer, glMapNamedBuffer @@ -1059,6 +1115,34 @@ static void *glimpl_map_buffer_range(int cmd, GLenum buffer, GLintptr offset, GL return glimpl_map_buffer.mem; } +static inline bool glimpl_unmap_buffer(int cmd, int buffer) +{ + if (glimpl_map_buffer.target != buffer) { + fprintf(stderr, "glimpl_unmap_buffer: target mismatch\n"); + return GL_FALSE; + } + + glimpl_upload_buffer(glimpl_map_buffer.mem, glimpl_map_buffer.length); + + pb_push(cmd); + pb_push(buffer); + pb_push(glimpl_map_buffer.length); // internal + + glimpl_submit(); + int res = pb_read(SGL_OFFSET_REGISTER_RETVAL); + return *(bool*)&res; +} + +static inline void glimpl_flush_mapped_buffer_range(int cmd, int buffer, int offset, int length) +{ + glimpl_upload_buffer((char*)glimpl_map_buffer.mem + offset, length); + + pb_push(cmd); + pb_push(buffer); + pb_push(offset); + pb_push(length); +} + static void glimpl_invalidate_framebuffer(int cmd, bool is_subframebuffer, GLenum framebuffer, GLsizei n_attachments, const GLenum *attachments, int x, int y, int width, int height) { @@ -1387,56 +1471,7 @@ void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_grou void glDrawArrays(GLenum mode, GLint first, GLsizei count) { - // struct gl_vertex_attrib_pointer *vap = glimpl_get_enabled_vap(); - // if (vap) { - // if (vap->client_managed) { - // if (!is_value_likely_an_offset(vap->ptr)) { - // pb_push(SGL_CMD_VP_UPLOAD); - // pb_push(vap->size * count); - // for (int i = 0; i < vap->size * count; i++) - // pb_push(vap->ptr[i]); - // } - - // pb_push(SGL_CMD_VERTEXATTRIBPOINTER); - // pb_push(vap->index); - // pb_push(vap->size); - // pb_push(vap->type); - // pb_push(vap->normalized); - // pb_push(vap->stride); - // pb_push((int)((uintptr_t)vap->ptr & 0x00000000FFFFFFFF)); - - // pb_push(SGL_CMD_ENABLEVERTEXATTRIBARRAY); - // pb_push(vap->index); - // } - // } - // else { - // glimpl_push_client_pointers(mode, count); - // } - - for (int i = 0; i < GLIMPL_MAX_OBJECTS; i++) { - struct gl_vertex_attrib_pointer *vap = &glimpl_vaps[i]; - if (vap->client_managed) { - bool is_ptr_offset = is_value_likely_an_offset(vap->ptr); - if (!is_ptr_offset) { - pb_push(SGL_CMD_VP_UPLOAD); - pb_push(vap->size * count); - for (int i = 0; i < vap->size * count; i++) - pb_push(vap->ptr[i]); - } - - pb_push(SGL_CMD_VERTEXATTRIBPOINTER); - pb_push(vap->index); - pb_push(vap->size); - pb_push(vap->type); - pb_push(vap->normalized); - pb_push(vap->stride); - pb_push(is_ptr_offset ? (int)(uintptr_t)vap->ptr : 0xFFFFFFFF); // force server to use upload - - pb_push(SGL_CMD_ENABLEVERTEXATTRIBARRAY); - pb_push(vap->index); - } - } - + glimpl_push_vertex_attrib_pointers(count); glimpl_push_client_pointers(mode, count); pb_push(SGL_CMD_DRAWARRAYS); @@ -1618,11 +1653,14 @@ void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) *params = pb_read(SGL_OFFSET_REGISTER_RETVAL); } -void glGetObjectParameterivARB(void *obj, GLenum pname, GLint* params) +void glGetObjectParameterivARB(GLhandleARB obj, GLenum pname, GLint *params) { - STUB(); - /* stub */ - *params = GL_TRUE; + pb_push(SGL_CMD_GETOBJECTPARAMETERIVARB); + pb_push(obj); + pb_push(pname); + + glimpl_submit(); + *params = pb_read(SGL_OFFSET_REGISTER_RETVAL); } static inline void real_glGetString(GLenum name, char *string) @@ -1754,7 +1792,42 @@ void glGetDoublev(GLenum pname, GLdouble* data) void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels) { - STUB(); + int width = 0, height = 0, depth = 0; + switch (target) { + case GL_TEXTURE_3D: + glimpl_get_texture_level_parameter(SGL_CMD_GETTEXLEVELPARAMETERIV, target, level, GL_TEXTURE_DEPTH, &depth); + case GL_TEXTURE_2D: + case GL_TEXTURE_RECTANGLE: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + glimpl_get_texture_level_parameter(SGL_CMD_GETTEXLEVELPARAMETERIV, target, level, GL_TEXTURE_HEIGHT, &height); + case GL_TEXTURE_1D: + case GL_TEXTURE_1D_ARRAY: + glimpl_get_texture_level_parameter(SGL_CMD_GETTEXLEVELPARAMETERIV, target, level, GL_TEXTURE_WIDTH, &width); + break; + } + + if (!depth) depth = 1; + if (!height) height = 1; + if (!width) width = 1; + + size_t total_size = width * height * depth * glimpl_get_pixel_size(format); + + pb_push(SGL_CMD_GETTEXIMAGE); + pb_push(target); + pb_push(level); + pb_push(format); + pb_push(type); + pb_push(total_size); + + glimpl_submit(); + glimpl_download_buffer(pixels, total_size); } void glLightModelfv(GLenum pname, const GLfloat* params) @@ -1848,13 +1921,12 @@ void glShadeModel(GLenum mode) void glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { - glimpl_submit(); + pb_push(SGL_CMD_SHADERSOURCE); + pb_push(shader); + pb_push(count); - for (int i = 0; i < count; i++) { - pb_push(SGL_CMD_SHADERSOURCE); - pb_push(shader); + for (int i = 0; i < count; i++) push_string(string[i]); - } glimpl_submit(); } @@ -1960,7 +2032,7 @@ void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean norm .client_managed = client_managed }; - // if (!client_managed) { + if (!client_managed) { pb_push(SGL_CMD_VERTEXATTRIBPOINTER); pb_push(index); pb_push(size); @@ -1968,7 +2040,7 @@ void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean norm pb_push(normalized); pb_push(stride); pb_push((int)((uintptr_t)pointer)); - // } + } } void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) @@ -3396,11 +3468,6 @@ void glActiveTexture(GLenum texture) pb_push(texture); } -void glActiveTextureARB(GLenum texture) -{ - glActiveTexture(texture); -} - void glSampleCoverage(GLfloat value, GLboolean invert) { pb_push(SGL_CMD_SAMPLECOVERAGE); @@ -3751,25 +3818,7 @@ GLboolean glIsBuffer(GLuint buffer) GLboolean glUnmapBuffer(GLenum target) { - if (glimpl_map_buffer.target != target) { - fprintf(stderr, "glUnmapBuffer: target mismatch\n"); - return GL_FALSE; - } - - pb_push(SGL_CMD_VP_UPLOAD); - pb_push(glimpl_map_buffer.length / 4 + (glimpl_map_buffer.length % 4 != 0)); - pb_memcpy(glimpl_map_buffer.mem, glimpl_map_buffer.length + ((glimpl_map_buffer.length % 4 != 0) * sizeof(int))); - - if (glimpl_map_buffer.in_use) { - glimpl_map_buffer.in_use = false; - } - - pb_push(SGL_CMD_UNMAPBUFFER); - pb_push(target); - pb_push(glimpl_map_buffer.length); - - glimpl_submit(); - return pb_read(SGL_OFFSET_REGISTER_RETVAL); + return glimpl_unmap_buffer(SGL_CMD_UNMAPBUFFER, target); } void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) @@ -4337,10 +4386,7 @@ void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) { - pb_push(SGL_CMD_FLUSHMAPPEDBUFFERRANGE); - pb_push(target); - pb_push(offset); - pb_push(length); + glimpl_flush_mapped_buffer_range(SGL_CMD_FLUSHMAPPEDBUFFERRANGE, target, offset, length); } GLboolean glIsVertexArray(GLuint array) @@ -5308,19 +5354,12 @@ void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr re GLboolean glUnmapNamedBuffer(GLuint buffer) { - pb_push(SGL_CMD_UNMAPNAMEDBUFFER); - pb_push(buffer); - - glimpl_submit(); - return pb_read(SGL_OFFSET_REGISTER_RETVAL); + return glimpl_unmap_buffer(SGL_CMD_UNMAPNAMEDBUFFER, buffer); } void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length) { - pb_push(SGL_CMD_FLUSHMAPPEDNAMEDBUFFERRANGE); - pb_push(buffer); - pb_push(offset); - pb_push(length); + glimpl_flush_mapped_buffer_range(SGL_CMD_FLUSHMAPPEDNAMEDBUFFERRANGE, buffer, offset, length); } void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) @@ -8009,6 +8048,9 @@ void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsize return; } + glimpl_push_vertex_attrib_pointers(count); + glimpl_push_client_pointers(mode, count); + pb_push(SGL_CMD_DRAWRANGEELEMENTSBASEVERTEX); pb_push(mode); pb_push(start); @@ -8639,8 +8681,7 @@ void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum // pb_push(program); // pb_push(bufSize); - fprintf(stderr, "glGetProgramBinary: stub\n"); - + STUB(); } void glProgramBinary(GLuint program, GLenum binaryFormat, const void* binary, GLsizei length) @@ -9894,6 +9935,283 @@ void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GL STUB(); } +void glAttachObjectARB(GLhandleARB containerObj, GLhandleARB obj) +{ + pb_push(SGL_CMD_ATTACHOBJECTARB); + pb_push(containerObj); + pb_push(obj); +} + +void glBindAttribLocationARB(GLhandleARB programObj, GLuint index, const GLcharARB* name) +{ + pb_push(SGL_CMD_BINDATTRIBLOCATIONARB); + pb_push(programObj); + pb_push(index); + push_string(name); +} + +void glBindBufferARB(GLenum target, GLuint buffer) +{ + pb_push(SGL_CMD_BINDBUFFERARB); + pb_push(target); + pb_push(buffer); +} + +void glBindProgramARB(GLenum target, GLuint program) +{ + pb_push(SGL_CMD_BINDPROGRAMARB); + pb_push(target); + pb_push(program); +} + +void glBufferDataARB(GLenum target, GLsizeiptrARB size, const void* data, GLenum usage) +{ + glimpl_buffer_store_data(SGL_CMD_BUFFERDATAARB, target, size, data, usage); +} + +void glBufferSubDataARB(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) +{ + glimpl_buffer_subdata(SGL_CMD_BUFFERSUBDATAARB, target, offset, size, data); +} + +void glCompileShaderARB(GLhandleARB shaderObj) +{ + pb_push(SGL_CMD_COMPILESHADERARB); + pb_push(shaderObj); +} + +GLhandleARB glCreateProgramObjectARB(void) +{ + pb_push(SGL_CMD_CREATEPROGRAMOBJECTARB); + + glimpl_submit(); + return pb_read(SGL_OFFSET_REGISTER_RETVAL); +} + +GLhandleARB glCreateShaderObjectARB(GLenum shaderType) +{ + pb_push(SGL_CMD_CREATESHADEROBJECTARB); + pb_push(shaderType); + + glimpl_submit(); + return pb_read(SGL_OFFSET_REGISTER_RETVAL); +} + +void glDeleteBuffersARB(GLsizei n, const GLuint* buffers) +{ + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_DELETEBUFFERSARB); + pb_push(buffers[i]); + } +} + +void glDeleteObjectARB(GLhandleARB obj) +{ + pb_push(SGL_CMD_DELETEOBJECTARB); + pb_push(obj); +} + +void glDeleteProgramsARB(GLsizei n, const GLuint* programs) +{ + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_DELETEPROGRAMSARB); + pb_push(programs[i]); + } +} + +void glDeleteQueriesARB(GLsizei n, const GLuint* ids) +{ + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_DELETEQUERIESARB); + pb_push(ids[i]); + } +} + +void glDetachObjectARB(GLhandleARB containerObj, GLhandleARB attachedObj) +{ + pb_push(SGL_CMD_DETACHOBJECTARB); + pb_push(containerObj); + pb_push(attachedObj); +} + +// void glGenBuffersARB(GLsizei n, GLuint* buffers) +// { +// glGenBuffers(n, buffers); +// } + +void glGenBuffersARB(GLsizei n, GLuint* buffers) +{ + GLuint *p = buffers; + + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_GENBUFFERSARB); + // pb_push(1); + + glimpl_submit(); + *p++ = pb_read(SGL_OFFSET_REGISTER_RETVAL); + } +} + +void glGenProgramsARB(GLsizei n, GLuint* programs) +{ + GLuint *p = programs; + + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_GENPROGRAMSARB); + // pb_push(1); + + glimpl_submit(); + *p++ = pb_read(SGL_OFFSET_REGISTER_RETVAL); + } +} + +void glGenQueriesARB(GLsizei n, GLuint* ids) +{ + GLuint *p = ids; + + for (int i = 0; i < n; i++) { + pb_push(SGL_CMD_GENQUERIESARB); + // pb_push(1); + + glimpl_submit(); + *p++ = pb_read(SGL_OFFSET_REGISTER_RETVAL); + } +} + +void glGetInfoLogARB(GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB* infoLog) +{ + pb_push(SGL_CMD_GETINFOLOGARB); + pb_push(obj); + pb_push(maxLength); + + glimpl_submit(); + + uintptr_t ptr = (uintptr_t)pb_ptr(SGL_OFFSET_REGISTER_RETVAL_V); + GLsizei length_notptr; + + memcpy(&length_notptr, (void*)(ptr + 0), sizeof(*length)); + if (length != NULL) + *length = length_notptr; + + memcpy(infoLog, (void*)(ptr + sizeof(*length)), length_notptr); +} + +void glGetProgramivARB(GLenum target, GLenum pname, GLint* params) +{ + pb_push(SGL_CMD_GETPROGRAMIVARB); + pb_push(target); + pb_push(pname); + + glimpl_submit(); + *params = pb_read(SGL_OFFSET_REGISTER_RETVAL); +} + +GLint glGetUniformLocationARB(GLhandleARB programObj, const GLcharARB* name) +{ + pb_push(SGL_CMD_GETUNIFORMLOCATIONARB); + pb_push(programObj); + push_string(name); + + glimpl_submit(); + return pb_read(SGL_OFFSET_REGISTER_RETVAL); +} + +void glLinkProgramARB(GLhandleARB programObj) +{ + pb_push(SGL_CMD_LINKPROGRAMARB); + pb_push(programObj); +} + +void* glMapBufferARB(GLenum target, GLenum access) +{ + return glimpl_map_buffer_range(SGL_CMD_MAPBUFFERARB, target, 0, 0, access); +} + +void glProgramStringARB(GLenum target, GLenum format, GLsizei len, const void* string) +{ + pb_push(SGL_CMD_PROGRAMSTRINGARB); + pb_push(target); + pb_push(format); + pb_push(len); + push_string(string); +} + +void glShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint* length) +{ + pb_push(SGL_CMD_SHADERSOURCEARB); + pb_push(shaderObj); + pb_push(count); + + for (int i = 0; i < count; i++) + push_string(string[i]); + + glimpl_submit(); +} + +void glUniform1iARB(GLint location, GLint v0) +{ + pb_push(SGL_CMD_UNIFORM1IARB); + pb_push(location); + pb_push(v0); +} + +void glProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat* params) +{ + pb_push(SGL_CMD_PROGRAMENVPARAMETERS4FVEXT); + pb_push(target); + pb_push(index); + pb_push(count); + pb_memcpy(params, count * 4 * sizeof(float)); +} + +void glColorMaskIndexedEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) +{ + pb_push(SGL_CMD_COLORMASKINDEXEDEXT); + pb_push(index); + pb_push(r); + pb_push(g); + pb_push(b); + pb_push(a); +} + +void glEnableIndexedEXT(GLenum target, GLuint index) +{ + pb_push(SGL_CMD_ENABLEINDEXEDEXT); + pb_push(target); + pb_push(index); +} + +void glDisableIndexedEXT(GLenum target, GLuint index) +{ + pb_push(SGL_CMD_DISABLEINDEXEDEXT); + pb_push(target); + pb_push(index); +} + +void glGetBooleanIndexedvEXT(GLenum target, GLuint index, GLboolean* data) +{ + pb_push(SGL_CMD_GETBOOLEANINDEXEDVEXT); + pb_push(target); + pb_push(index); + + glimpl_submit(); + *data = *(GLboolean*)pb_ptr(SGL_OFFSET_REGISTER_RETVAL); +} + +void glActiveTextureARB(GLenum texture) +{ + pb_push(SGL_CMD_ACTIVETEXTUREARB); + pb_push(texture); +} + +void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + pb_push(SGL_CMD_MULTITEXCOORD2FARB); + pb_push(target); + pb_pushf(s); + pb_pushf(t); +} + #ifdef _WIN32 static const GLCLTPROCTABLE cpt = diff --git a/src/client/memory.c b/src/client/memory.c index e182252..09d605f 100644 --- a/src/client/memory.c +++ b/src/client/memory.c @@ -14,11 +14,13 @@ int sgl_detect_device_memory(const char *path) { - DIR *directory = opendir(path); + DIR *directory; + struct dirent *entry = NULL; + + directory = opendir(path); if (directory == NULL) return -1; - struct dirent *entry = NULL; while ((entry = readdir(directory)) != NULL) { char full_name[256] = { 0 }; snprintf(full_name, 100, "%s/%s", path, entry->d_name); diff --git a/src/client/pb.c b/src/client/pb.c index c0d5196..4c980d8 100644 --- a/src/client/pb.c +++ b/src/client/pb.c @@ -58,9 +58,11 @@ static struct pb_net_hooks net_hooks = { NULL }; #ifndef _WIN32 void pb_set(int fd, bool direct_access) { + uintptr_t alloc_size; + ptr = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + alloc_size = *(uintptr_t*)(ptr + SGL_OFFSET_REGISTER_MEMSIZE); - uintptr_t alloc_size = *(uintptr_t*)(ptr + SGL_OFFSET_REGISTER_MEMSIZE); munmap(ptr, 0x1000); ptr = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); diff --git a/src/client/platform/glx.c b/src/client/platform/glx.c index f094a0d..129f9c5 100644 --- a/src/client/platform/glx.c +++ b/src/client/platform/glx.c @@ -4,6 +4,9 @@ #include #include +#include +#include + #include #include #include @@ -20,6 +23,8 @@ static const char *glx_majmin_string = "1.4"; static int max_width, max_height, real_width, real_height; +static void *swap_sync_lock; + ICD_SET_MAX_DIMENSIONS_DEFINITION(max_width, max_height, real_width, real_height); ICD_RESIZE_DEFINITION(real_width, real_height); @@ -310,6 +315,18 @@ XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list) { + /* + * probably not needed, stuck around for testing + */ + int *attribs = (int*)attrib_list; + while (*attribs) { + int attrib = *attribs++; + int value = *attribs++; + + if (attrib == GLX_CONTEXT_PROFILE_MASK_ARB && value == GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) + return NULL; + } + return glXCreateContext(dpy, NULL, 0, 0); } @@ -378,6 +395,8 @@ void glXSwapBuffers(Display* dpy, GLXDrawable drawable) static struct glx_swap_data swap_data = { 0 }; if (swap_data.initialized == false) { + swap_sync_lock = pb_ptr(SGL_OFFSET_REGISTER_SWAP_BUFFERS_SYNC); + XWindowAttributes attr; XGetWindowAttributes(dpy, drawable, &attr); @@ -397,24 +416,30 @@ void glXSwapBuffers(Display* dpy, GLXDrawable drawable) swap_data.initialized = true; } + /* lock */ + spin_lock(swap_sync_lock); + /* swap */ glimpl_swap_buffers(real_width, real_height, 1, GL_BGRA); /* display */ XPutImage(dpy, drawable, swap_data.gc, swap_data.ximage, 0, 0, 0, 0, real_width, real_height); + /* unlock */ + spin_unlock(swap_sync_lock); + /* sync */ XSync(dpy, False); } void* glXGetProcAddressARB(char* s) { - char str[64]; - if (strstr(s, "EXT") || strstr(s, "ARB")) { - strcpy(str, s); - str[strlen(str) - 3] = 0; - return NULL; - } + // char str[64]; + // if (strstr(s, "EXT") || strstr(s, "ARB")) { + // strcpy(str, s); + // str[strlen(str) - 3] = 0; + // return NULL; + // } /* to-do: use stripped str? */ return dlsym(NULL, s); diff --git a/src/client/platform/windrv.c b/src/client/platform/windrv.c index b6c0e33..158e5b9 100644 --- a/src/client/platform/windrv.c +++ b/src/client/platform/windrv.c @@ -6,6 +6,9 @@ #include #include +#include +#include + #include #include @@ -16,6 +19,8 @@ static struct WGLCALLBACKS callbacks; static int max_width, max_height, real_width, real_height; +static void *swap_sync_lock; + ICD_SET_MAX_DIMENSIONS_DEFINITION(max_width, max_height, real_width, real_height); ICD_RESIZE_DEFINITION(real_width, real_height); @@ -324,14 +329,19 @@ BOOL APIENTRY DrvSwapBuffers(HDC hdc) bmi.bmiHeader.biWidth = max_width; bmi.bmiHeader.biHeight = -max_height; + swap_sync_lock = pb_ptr(SGL_OFFSET_REGISTER_SWAP_BUFFERS_SYNC); framebuffer = glimpl_fb_address(); init = 1; } + spin_lock(swap_sync_lock); + glimpl_swap_buffers(real_width, real_height, do_vflip, GL_BGRA); /* to-do: fix overlay so vflip and -Height won't be needed */ SetDIBitsToDevice(hdc, 0, 0, real_width, real_height, 0, 0, 0, real_height, framebuffer, &bmi, DIB_RGB_COLORS); // StretchDIBits(hdc, 0, 0, real_width, real_height, 0, 0, real_width, real_height, framebuffer, &bmi, DIB_RGB_COLORS, SRCCOPY); + spin_unlock(swap_sync_lock); + return TRUE; } diff --git a/src/client/scratch.c b/src/client/scratch.c index dd3a525..ed62bb8 100644 --- a/src/client/scratch.c +++ b/src/client/scratch.c @@ -22,10 +22,12 @@ static inline uintptr_t align_to_4kb(uintptr_t ptr) #ifdef _WIN32 static void *windows_mremap(void *old_address, size_t old_size, size_t new_size) { + MEMORY_BASIC_INFORMATION mbi; + void *new_address; + /* * check to see if we can extend the current allocation */ - MEMORY_BASIC_INFORMATION mbi; if (VirtualQuery((char*)old_address + old_size, &mbi, sizeof(mbi)) == sizeof(mbi)) if (mbi.State == MEM_FREE && mbi.RegionSize >= (new_size - old_size)) if (VirtualAlloc((char*)old_address + old_size, new_size - old_size, MEM_COMMIT, PAGE_READWRITE)) @@ -35,7 +37,7 @@ static void *windows_mremap(void *old_address, size_t old_size, size_t new_size) * otherwise, allocate a new region, copy, free * this can be expensive, but will rarely be performed */ - void *new_address = VirtualAlloc(NULL, new_size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + new_address = VirtualAlloc(NULL, new_size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); if (new_address) { memcpy(new_address, old_address, old_size); VirtualFree(old_address, 0, MEM_RELEASE); diff --git a/src/client/winmain.c b/src/client/winmain.c index 24d51f2..4521ae7 100644 --- a/src/client/winmain.c +++ b/src/client/winmain.c @@ -10,6 +10,8 @@ static char env_value[16]; BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { if (reason == DLL_PROCESS_ATTACH) { + DWORD result; + /* * some weird hack that can speed up processes, reducing apparent lag; * by setting the priority of the program to "low", we give the kernel @@ -18,7 +20,7 @@ BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) * * appears to benefit systems with a single VCPU the most */ - DWORD result = GetEnvironmentVariableA("SGL_RUN_WITH_LOW_PRIORITY", env_value, 16); + result = GetEnvironmentVariableA("SGL_RUN_WITH_LOW_PRIORITY", env_value, 16); if (strcmp(env_value, "true") == 0) SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); diff --git a/src/server/main.c b/src/server/main.c index c89c233..db178e2 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -98,7 +98,7 @@ int main(int argc, char **argv) for (int i = 1; i < argc; i++) { switch (argv[i][1]) { case 'h': - printf(usage, SGL_DEFAULT_MAJOR, SGL_DEFAULT_MINOR); + fprintf(stderr, usage, SGL_DEFAULT_MAJOR, SGL_DEFAULT_MINOR); return 0; case 'v': print_virtual_machine_arguments = true; diff --git a/src/server/overlay.c b/src/server/overlay.c index e890c50..3ad44bc 100644 --- a/src/server/overlay.c +++ b/src/server/overlay.c @@ -3,1061 +3,35 @@ #include #include -static const unsigned char IBM[4096] = -{ - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x81, - 0xa5, 0x81, 0x81, 0xbd, - 0x99, 0x81, 0x81, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0xff, - 0xdb, 0xff, 0xff, 0xc3, - 0xe7, 0xff, 0xff, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x6c, 0xfe, 0xfe, 0xfe, - 0xfe, 0x7c, 0x38, 0x10, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x7c, 0xfe, - 0x7c, 0x38, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, - 0x3c, 0x3c, 0xe7, 0xe7, - 0xe7, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, - 0x3c, 0x7e, 0xff, 0xff, - 0x7e, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, - 0x3c, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xe7, 0xc3, - 0xc3, 0xe7, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3c, 0x66, 0x42, - 0x42, 0x66, 0x3c, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xc3, 0x99, 0xbd, - 0xbd, 0x99, 0xc3, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x1e, 0x0e, - 0x1a, 0x32, 0x78, 0xcc, - 0xcc, 0xcc, 0xcc, 0x78, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, - 0x66, 0x66, 0x66, 0x3c, - 0x18, 0x7e, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3f, 0x33, - 0x3f, 0x30, 0x30, 0x30, - 0x30, 0x70, 0xf0, 0xe0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0x63, - 0x7f, 0x63, 0x63, 0x63, - 0x63, 0x67, 0xe7, 0xe6, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, - 0x18, 0xdb, 0x3c, 0xe7, - 0x3c, 0xdb, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xc0, 0xe0, - 0xf0, 0xf8, 0xfe, 0xf8, - 0xf0, 0xe0, 0xc0, 0x80, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x06, 0x0e, - 0x1e, 0x3e, 0xfe, 0x3e, - 0x1e, 0x0e, 0x06, 0x02, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, - 0x7e, 0x18, 0x18, 0x18, - 0x7e, 0x3c, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, - 0x66, 0x00, 0x66, 0x66, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0xdb, - 0xdb, 0xdb, 0x7b, 0x1b, - 0x1b, 0x1b, 0x1b, 0x1b, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0x60, - 0x38, 0x6c, 0xc6, 0xc6, - 0x6c, 0x38, 0x0c, 0xc6, - 0x7c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xfe, 0xfe, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, - 0x7e, 0x18, 0x18, 0x18, - 0x7e, 0x3c, 0x18, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, - 0x7e, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x7e, 0x3c, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x0c, 0xfe, - 0x0c, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x60, 0xfe, - 0x60, 0x30, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xc0, - 0xc0, 0xfe, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x28, 0x6c, 0xfe, - 0x6c, 0x28, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x38, 0x7c, - 0x7c, 0xfe, 0xfe, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xfe, 0x7c, 0x7c, - 0x38, 0x38, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, - 0x3c, 0x3c, 0x18, 0x18, - 0x18, 0x00, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x66, 0x66, 0x66, - 0x24, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x6c, - 0x6c, 0xfe, 0x6c, 0x6c, - 0x6c, 0xfe, 0x6c, 0x6c, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x7c, 0xc6, - 0xc2, 0xc0, 0x7c, 0x06, - 0x06, 0x86, 0xc6, 0x7c, - 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xc2, 0xc6, 0x0c, 0x18, - 0x30, 0x60, 0xc6, 0x86, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, - 0x6c, 0x38, 0x76, 0xdc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x30, 0x30, - 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x18, - 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x18, 0x0c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x18, - 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x18, 0x30, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x66, 0x3c, 0xff, - 0x3c, 0x66, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x7e, - 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x18, - 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x02, 0x06, 0x0c, 0x18, - 0x30, 0x60, 0xc0, 0x80, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, - 0xc6, 0xc6, 0xd6, 0xd6, - 0xc6, 0xc6, 0x6c, 0x38, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x38, - 0x78, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0x06, 0x0c, 0x18, 0x30, - 0x60, 0xc0, 0xc6, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0x06, 0x06, 0x3c, 0x06, - 0x06, 0x06, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x1c, - 0x3c, 0x6c, 0xcc, 0xfe, - 0x0c, 0x0c, 0x0c, 0x1e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc0, - 0xc0, 0xc0, 0xfc, 0x06, - 0x06, 0x06, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x60, - 0xc0, 0xc0, 0xfc, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, - 0x06, 0x06, 0x0c, 0x18, - 0x30, 0x30, 0x30, 0x30, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0xc6, 0x7c, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0xc6, 0x7e, 0x06, - 0x06, 0x06, 0x0c, 0x78, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x30, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, - 0x0c, 0x18, 0x30, 0x60, - 0x30, 0x18, 0x0c, 0x06, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7e, 0x00, 0x00, - 0x7e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x60, - 0x30, 0x18, 0x0c, 0x06, - 0x0c, 0x18, 0x30, 0x60, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0x0c, 0x18, 0x18, - 0x18, 0x00, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, - 0xc6, 0xc6, 0xde, 0xde, - 0xde, 0xdc, 0xc0, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x38, - 0x6c, 0xc6, 0xc6, 0xfe, - 0xc6, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, - 0x66, 0x66, 0x7c, 0x66, - 0x66, 0x66, 0x66, 0xfc, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, - 0xc2, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc2, 0x66, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0x6c, - 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x6c, 0xf8, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, - 0x62, 0x68, 0x78, 0x68, - 0x60, 0x62, 0x66, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, - 0x62, 0x68, 0x78, 0x68, - 0x60, 0x60, 0x60, 0xf0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, - 0xc2, 0xc0, 0xc0, 0xde, - 0xc6, 0xc6, 0x66, 0x3a, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, - 0xc6, 0xc6, 0xfe, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, - 0xcc, 0xcc, 0xcc, 0x78, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe6, 0x66, - 0x66, 0x6c, 0x78, 0x78, - 0x6c, 0x66, 0x66, 0xe6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x60, - 0x60, 0x60, 0x60, 0x60, - 0x60, 0x62, 0x66, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xee, - 0xfe, 0xfe, 0xd6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xe6, - 0xf6, 0xfe, 0xde, 0xce, - 0xc6, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, - 0x66, 0x66, 0x7c, 0x60, - 0x60, 0x60, 0x60, 0xf0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xd6, 0xde, 0x7c, - 0x0c, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, - 0x66, 0x66, 0x7c, 0x6c, - 0x66, 0x66, 0x66, 0xe6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, - 0xc6, 0x60, 0x38, 0x0c, - 0x06, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x7e, - 0x5a, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0x6c, 0x38, 0x10, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, - 0xc6, 0xc6, 0xd6, 0xd6, - 0xd6, 0xfe, 0xee, 0x6c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, - 0x6c, 0x7c, 0x38, 0x38, - 0x7c, 0x6c, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, - 0x66, 0x66, 0x3c, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, - 0x86, 0x0c, 0x18, 0x30, - 0x60, 0xc2, 0xc6, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x30, - 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, - 0xc0, 0xe0, 0x70, 0x38, - 0x1c, 0x0e, 0x06, 0x02, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x6c, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, - 0x30, 0x30, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x60, - 0x60, 0x78, 0x6c, 0x66, - 0x66, 0x66, 0x66, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0xc0, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x0c, - 0x0c, 0x3c, 0x6c, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, - 0x64, 0x60, 0xf0, 0x60, - 0x60, 0x60, 0x60, 0xf0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x76, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x7c, - 0x0c, 0xcc, 0x78, 0x00, - 0x00, 0x00, 0xe0, 0x60, - 0x60, 0x6c, 0x76, 0x66, - 0x66, 0x66, 0x66, 0xe6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, - 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, - 0x00, 0x0e, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, - 0x66, 0x66, 0x3c, 0x00, - 0x00, 0x00, 0xe0, 0x60, - 0x60, 0x66, 0x6c, 0x78, - 0x78, 0x6c, 0x66, 0xe6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xec, 0xfe, 0xd6, - 0xd6, 0xd6, 0xd6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x7c, - 0x60, 0x60, 0xf0, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x76, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x7c, - 0x0c, 0x0c, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdc, 0x76, 0x66, - 0x60, 0x60, 0x60, 0xf0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0x60, - 0x38, 0x0c, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x30, - 0x30, 0xfc, 0x30, 0x30, - 0x30, 0x30, 0x36, 0x1c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x3c, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0xc6, 0xd6, - 0xd6, 0xd6, 0xfe, 0x6c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0x6c, 0x38, - 0x38, 0x38, 0x6c, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7e, - 0x06, 0x0c, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfe, 0xcc, 0x18, - 0x30, 0x60, 0xc6, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x18, - 0x18, 0x18, 0x70, 0x18, - 0x18, 0x18, 0x18, 0x0e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, - 0x18, 0x18, 0x00, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x18, - 0x18, 0x18, 0x0e, 0x18, - 0x18, 0x18, 0x18, 0x70, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x6c, 0xc6, - 0xc6, 0xc6, 0xfe, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, - 0xc2, 0xc0, 0xc0, 0xc0, - 0xc2, 0x66, 0x3c, 0x0c, - 0x06, 0x7c, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0x00, - 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, - 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0x00, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x38, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x66, 0x60, 0x60, - 0x66, 0x3c, 0x0c, 0x06, - 0x3c, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, - 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, - 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, - 0x00, 0x7c, 0xc6, 0xfe, - 0xc0, 0xc0, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x00, - 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x3c, 0x66, - 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, - 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0x00, 0x10, - 0x38, 0x6c, 0xc6, 0xc6, - 0xfe, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x38, 0x6c, 0x38, 0x00, - 0x38, 0x6c, 0xc6, 0xc6, - 0xfe, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x30, 0x60, 0x00, - 0xfe, 0x66, 0x60, 0x7c, - 0x60, 0x60, 0x66, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcc, 0x76, 0x36, - 0x7e, 0xd8, 0xd8, 0x6e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3e, 0x6c, - 0xcc, 0xcc, 0xfe, 0xcc, - 0xcc, 0xcc, 0xcc, 0xce, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, - 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, - 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, - 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x78, 0xcc, - 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, - 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0x00, - 0x00, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7e, - 0x06, 0x0c, 0x78, 0x00, - 0x00, 0xc6, 0x00, 0x7c, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0x00, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x3c, - 0x66, 0x60, 0x60, 0x60, - 0x66, 0x3c, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x64, - 0x60, 0xf0, 0x60, 0x60, - 0x60, 0x60, 0xe6, 0xfc, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, - 0x3c, 0x18, 0x7e, 0x18, - 0x7e, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xcc, 0xcc, - 0xf8, 0xc4, 0xcc, 0xde, - 0xcc, 0xcc, 0xcc, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0e, 0x1b, 0x18, - 0x18, 0x18, 0x7e, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0xd8, 0x70, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, - 0x00, 0x78, 0x0c, 0x7c, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, - 0x00, 0x38, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, - 0x00, 0x7c, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, - 0x00, 0xcc, 0xcc, 0xcc, - 0xcc, 0xcc, 0xcc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, - 0x00, 0xdc, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, - 0x00, 0x00, 0x00, 0x00, - 0x76, 0xdc, 0x00, 0xc6, - 0xe6, 0xf6, 0xfe, 0xde, - 0xce, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3c, 0x6c, 0x6c, - 0x3e, 0x00, 0x7e, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x6c, - 0x38, 0x00, 0x7c, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x30, - 0x00, 0x30, 0x30, 0x60, - 0xc0, 0xc6, 0xc6, 0x7c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc0, - 0xc0, 0xc0, 0xc0, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x06, - 0x06, 0x06, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xc0, 0xc2, - 0xc6, 0xcc, 0x18, 0x30, - 0x60, 0xdc, 0x86, 0x0c, - 0x18, 0x3e, 0x00, 0x00, - 0x00, 0xc0, 0xc0, 0xc2, - 0xc6, 0xcc, 0x18, 0x30, - 0x66, 0xce, 0x9e, 0x3e, - 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, - 0x00, 0x18, 0x18, 0x18, - 0x3c, 0x3c, 0x3c, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x36, 0x6c, 0xd8, - 0x6c, 0x36, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xd8, 0x6c, 0x36, - 0x6c, 0xd8, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x11, 0x44, 0x11, 0x44, - 0x11, 0x44, 0x11, 0x44, - 0x11, 0x44, 0x11, 0x44, - 0x11, 0x44, 0x11, 0x44, - 0x55, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0x55, 0xaa, - 0xdd, 0x77, 0xdd, 0x77, - 0xdd, 0x77, 0xdd, 0x77, - 0xdd, 0x77, 0xdd, 0x77, - 0xdd, 0x77, 0xdd, 0x77, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0xf8, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0xf6, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0x18, 0xf8, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0xf6, 0x06, 0xf6, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfe, 0x06, 0xf6, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0xf6, 0x06, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0xf8, 0x18, 0xf8, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x1f, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x1f, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x37, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x37, 0x30, 0x3f, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3f, 0x30, 0x37, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0xf7, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0xf7, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x37, 0x30, 0x37, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0xf7, 0x00, 0xf7, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0xff, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0xff, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x3f, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x1f, 0x18, 0x1f, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x1f, 0x18, 0x1f, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x3f, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0xff, - 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0xff, 0x18, 0xff, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xf8, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1f, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, - 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, - 0xf0, 0xf0, 0xf0, 0xf0, - 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, - 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x76, 0xdc, 0xd8, - 0xd8, 0xd8, 0xdc, 0x76, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x78, 0xcc, - 0xcc, 0xcc, 0xd8, 0xcc, - 0xc6, 0xc6, 0xc6, 0xcc, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, - 0xc6, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc0, 0xc0, 0xc0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfe, 0x6c, 0x6c, 0x6c, - 0x6c, 0x6c, 0x6c, 0x6c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, - 0xc6, 0x60, 0x30, 0x18, - 0x30, 0x60, 0xc6, 0xfe, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7e, 0xd8, 0xd8, - 0xd8, 0xd8, 0xd8, 0x70, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x66, 0x66, 0x66, 0x66, - 0x66, 0x7c, 0x60, 0x60, - 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x76, 0xdc, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7e, - 0x18, 0x3c, 0x66, 0x66, - 0x66, 0x3c, 0x18, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, - 0x6c, 0xc6, 0xc6, 0xfe, - 0xc6, 0xc6, 0x6c, 0x38, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, - 0xc6, 0xc6, 0xc6, 0x6c, - 0x6c, 0x6c, 0x6c, 0xee, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x30, - 0x18, 0x0c, 0x3e, 0x66, - 0x66, 0x66, 0x66, 0x3c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7e, 0xdb, 0xdb, - 0xdb, 0x7e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, - 0x06, 0x7e, 0xdb, 0xdb, - 0xf3, 0x7e, 0x60, 0xc0, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x30, - 0x60, 0x60, 0x7c, 0x60, - 0x60, 0x60, 0x30, 0x1c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, - 0xc6, 0xc6, 0xc6, 0xc6, - 0xc6, 0xc6, 0xc6, 0xc6, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x00, 0xfe, - 0x00, 0x00, 0xfe, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x7e, 0x18, - 0x18, 0x00, 0x00, 0xff, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, - 0x18, 0x0c, 0x06, 0x0c, - 0x18, 0x30, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, - 0x18, 0x30, 0x60, 0x30, - 0x18, 0x0c, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x1b, - 0x1b, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, - 0xd8, 0xd8, 0xd8, 0x70, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x00, 0x7e, - 0x00, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x76, 0xdc, 0x00, - 0x76, 0xdc, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x6c, - 0x38, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, - 0x18, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0xec, - 0x6c, 0x6c, 0x3c, 0x1c, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0xd8, 0x6c, 0x6c, - 0x6c, 0x6c, 0x6c, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x70, 0xd8, 0x30, - 0x60, 0xc8, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x7c, 0x7c, 0x7c, 0x7c, - 0x7c, 0x7c, 0x7c, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; +#include static void overlay_draw_char(int *display, int width, char c, int x, int y, unsigned int fg) { int mask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; - const unsigned char *gylph = IBM + (int)c * 16; + const unsigned char *gylph = IBM + (int)c * CHAR_HEIGHT; unsigned char *color; - for (int cy = 0; cy < 16; cy++) - for (int cx = 0; cx < 8; cx++) { + for (int cy = 0; cy < CHAR_HEIGHT; cy++) + for (int cx = 0; cx < CHAR_WIDTH; cx++) { /* * darken pixels */ - color = (unsigned char*)&display[(y + cy) * width + (x + (7 - cx))]; + color = (unsigned char*)&display[(y + cy) * width + (x + ((CHAR_WIDTH - 1) - cx))]; color[0] = color[0] * 120 / 255; color[1] = color[1] * 120 / 255; color[2] = color[2] * 120 / 255; color[3] = color[3] * 120 / 255; if (gylph[cy] & mask[cx]) - display[(y + cy) * width + (x + (7 - cx))] = fg; + display[(y + cy) * width + (x + ((CHAR_WIDTH - 1) - cx))] = fg; } } static void overlay_draw_text(int *display, int width, char *text, int x, int y, unsigned int fg) { char* c = text; - for (int i = x; *c; i += 8) + for (int i = x; *c; i += CHAR_WIDTH) overlay_draw_char( display, width, @@ -1113,9 +87,9 @@ void overlay_stage2(struct overlay_context *ctx, int *frame, int width, size_t m sprintf(str, "FPS: %ld", ctx->fps); sprintf(mem, "MEM: %.2f %s", usage, is_mb ? "MB" : "KB"); - overlay_draw_text(frame, width, overlay_string, 0, 0, 0xffffff); - overlay_draw_text(frame, width, mem, 0, 16, 0xffffff); - overlay_draw_text(frame, width, str, 0, 32, 0xffffff); + overlay_draw_text(frame, width, overlay_string, 0, CHAR_HEIGHT * 0, 0xffffff); + overlay_draw_text(frame, width, mem, 0, CHAR_HEIGHT * 1, 0xffffff); + overlay_draw_text(frame, width, str, 0, CHAR_HEIGHT * 2, 0xffffff); } ctx->current_ticks = clock(); diff --git a/src/server/processor.c b/src/server/processor.c index 023535e..437ce50 100644 --- a/src/server/processor.c +++ b/src/server/processor.c @@ -11,10 +11,11 @@ #include #include -/* - * this is for detecting packet losses - */ -#define RECOVER_AFTER_N_MISSES 3 +#include + +#if !(defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86)) +#define _mm_pause() asm volatile("yield"); +#endif #define ADVANCE_PAST_STRING() \ while (!(((*pb) & 0xFF) == 0 || ((*pb >> 8) & 0xFF) == 0 || ((*pb >> 16) & 0xFF) == 0 || ((*pb >> 24) & 0xFF) == 0)) \ @@ -114,29 +115,211 @@ static void scramble(int *arr, int n) } } -void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) +static FORCEINLINE void wait_shm(void *p, int *client_id) { - int width, height; - sgl_get_max_resolution(&width, &height); + /* + * not only wait for a submit from a specific client, + * but also ensure that the client we are waiting for + * still exists, in case it didn't notify the server + * of its exit + */ + while (!wait_for_submit(p)) { + int creg = *(int*)(p + SGL_OFFSET_REGISTER_CONNECT); - size_t framebuffer_size = width * height * 4; - size_t fifo_size = args.memory_size - SGL_OFFSET_COMMAND_START - framebuffer_size; + /* + * a client has notified the server of its attempt + * to connect + */ + if (creg != 0) { + /* + * add connection to the dynamic array + */ + connection_add(creg, 0); - void *p = args.base_address; + PRINT_LOG("client %d connected\n", creg); - struct sgl_host_context *ctx; - bool begun = false; + /* + * prevent the same client from connecting more + * than once and break from the loop + */ + *(int*)(p + SGL_OFFSET_REGISTER_CONNECT) = 0; + continue; + } - void *uploaded = NULL; - int cmd; + /* + * some sort of "sync" + */ + _mm_pause(); + } + + *client_id = *(int*)(p + SGL_OFFSET_REGISTER_READY_HINT); + *(int*)(p + SGL_OFFSET_REGISTER_READY_HINT) = 0; +} + +static void sgl_net_accept_connection(void *p, struct net_context *net_ctx, struct sgl_cmd_processor_args args, + size_t framebuffer_size, size_t fifo_size, int width, int height) +{ + net_socket socket = net_accept(net_ctx); + int id = *(int*)(p + SGL_OFFSET_REGISTER_CLAIM_ID); + + connection_add(id, socket); + struct sgl_packet_connect packet = { + /* client_id = */ id, + /* framebuffer_size = */ framebuffer_size, + /* fifo_size = */ fifo_size, + /* gl_major = */ args.gl_major, + /* gl_minor = */ args.gl_minor, + /* max_width= */ width, + /* max_height= */ height + }; + + net_send_tcp(net_ctx, socket, &packet, sizeof(packet)); + + *((int*)(p + SGL_OFFSET_REGISTER_CLAIM_ID)) += 1; + + PRINT_LOG("client %d connected\n", id); +} + +static void sgl_net_send_framebuffer(void *p, struct net_context *net_ctx, size_t fifo_size) +{ + struct sgl_packet_swapbuffers_request packet; + struct sgl_packet_sync sync = { 0 }; + size_t left_over; + int expected; + int last_index; + size_t left_over_size; + + net_recv_udp(net_ctx, &packet, sizeof(packet), 0); + + left_over = packet.width * packet.height * 4; + expected = left_over / SGL_SWAPBUFFERS_RESULT_SIZE + (left_over % SGL_SWAPBUFFERS_RESULT_SIZE != 0); + + connection_current(packet.client_id); + sgl_read_pixels(packet.width, packet.height, p + SGL_OFFSET_COMMAND_START + fifo_size, packet.vflip, packet.format, 0); // to-do: show memory for overlay + + /* + * send sync packet, otherwise most frames are lost + */ + net_send_tcp(net_ctx, get_fd_from_id(packet.client_id), &sync, sizeof(sync)); + + /* + * generate an out-of-sequence order of frames. this way, we update as much of the window + * as possible, tackling packet loss from UDP + */ + scramble(scramble_arr, expected); + last_index = expected - 1; + left_over_size = left_over % SGL_SWAPBUFFERS_RESULT_SIZE; + + if (left_over_size == 0) + left_over_size = SGL_SWAPBUFFERS_RESULT_SIZE; + + for (int i = 0; i < expected; i++) { + int index = scramble_arr[i]; + size_t size = index != last_index ? SGL_SWAPBUFFERS_RESULT_SIZE : left_over_size; + + struct sgl_packet_swapbuffers_result result = { + /* client_id = */ packet.client_id, + /* index = */ index, + /* size = */ size, + /* result = */ { 0 } + }; + + memcpy(result.result, p + SGL_OFFSET_COMMAND_START + fifo_size + (index * SGL_SWAPBUFFERS_RESULT_SIZE), size); + + net_send_udp(net_ctx, &result, sizeof(result), 0); + } +} + +static void sgl_net_get_fifo_upload(void *p, int *client_id, bool *ready_to_render, struct net_context *net_ctx, size_t fifo_size) +{ + for (int i = NET_SOCKET_FIRST_FD; i < net_fd_count(net_ctx); i++) { + if (!net_did_event_happen_here(net_ctx, i)) + continue; + + struct sgl_packet_fifo_upload initial_upload_packet, *the_rest_of_the_packets = NULL; + if (!net_recv_tcp_timeout(net_ctx, i, &initial_upload_packet, sizeof(initial_upload_packet), 500)) { + int id = get_id_from_fd(i); + PRINT_LOG("client %d timed out, disconnected\n", id); + connection_rem(id, net_ctx); + memset(p + SGL_OFFSET_COMMAND_START, 0, fifo_size); + break; + } + + if (initial_upload_packet.expected_chunks > 1) { + the_rest_of_the_packets = malloc(sizeof(struct sgl_packet_fifo_upload) * (initial_upload_packet.expected_chunks - 1)); + for (int j = 0; j < initial_upload_packet.expected_chunks - 1; j++) + net_recv_tcp(net_ctx, i, &the_rest_of_the_packets[j], sizeof(initial_upload_packet)); + } + + size_t offset = 0; + for (int i = 0; i < initial_upload_packet.expected_chunks; i++) { + struct sgl_packet_fifo_upload *packet = i == 0 ? &initial_upload_packet : &the_rest_of_the_packets[i - 1]; + size_t size = sizeof(uint32_t) * packet->count; + + memcpy(p + SGL_OFFSET_COMMAND_START + offset, packet->commands, size); + offset += size; + } + + if (the_rest_of_the_packets != NULL) + free(the_rest_of_the_packets); + + *ready_to_render = true; + *client_id = initial_upload_packet.client_id; + + // break here so we can handle other clients after + break; + } +} + +static FORCEINLINE void wait_net(void *p, int *client_id, struct net_context *net_ctx, struct sgl_cmd_processor_args args, + size_t framebuffer_size, size_t fifo_size, int width, int height) +{ + bool ready_to_render = false; + while (!ready_to_render) { + enum net_poll_reason reason = net_poll(net_ctx); // to-do: check failure + + if (reason & NET_POLL_INCOMING_CONNECTION) + sgl_net_accept_connection(p, net_ctx, args, framebuffer_size, fifo_size, width, height); + + /* + * incoming udp packets to the server could only mean that + * a client has requested a framebuffer update + */ + if (reason & NET_POLL_INCOMING_UDP) + sgl_net_send_framebuffer(p, net_ctx, fifo_size); + + /* + * incoming tcp packets to the server could only mean that + * a client is uploading its fifo buffer + */ + if (reason & NET_POLL_INCOMING_TCP) + sgl_net_get_fifo_upload(p, client_id, &ready_to_render, net_ctx, fifo_size); + } +} + +void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) +{ + int width, height; + int cmd; struct net_context *net_ctx = NULL; + bool network_expecting_retval = true; + bool begun = false; + void *uploaded = NULL; + void *map_buffer; + void *download_target = NULL; + size_t download_offset = 0; + + sgl_get_max_resolution(&width, &height); + size_t framebuffer_size = width * height * 4; + size_t fifo_size = args.memory_size - SGL_OFFSET_COMMAND_START - framebuffer_size; if ((intptr_t)fifo_size < 0) { PRINT_LOG("framebuffer too big, try increasing memory!\n"); return; } + void *p = args.base_address; memset(p + SGL_OFFSET_COMMAND_START, 0, fifo_size); *(uint64_t*)(p + SGL_OFFSET_REGISTER_FBSTART) = SGL_OFFSET_COMMAND_START + fifo_size; @@ -147,6 +330,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) *(int*)(p + SGL_OFFSET_REGISTER_CLAIM_ID) = 1; *(int*)(p + SGL_OFFSET_REGISTER_READY_HINT) = 0; *(int*)(p + SGL_OFFSET_REGISTER_LOCK) = 0; + *(int*)(p + SGL_OFFSET_REGISTER_SWAP_BUFFERS_SYNC) = 0; if (args.internal_cmd_ptr) *args.internal_cmd_ptr = &cmd; @@ -165,183 +349,14 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) PRINT_LOG("--------------------------------------------------------\n"); - bool network_expecting_retval = true; - - void *map_buffer; - size_t map_buffer_offset = 0; - int vp_upload_count; - while (1) { int client_id = 0; - int timeout = 0; - /* - * shared memory connection handler - */ - if (!args.network_over_shared) { - /* - * not only wait for a submit from a specific client, - * but also ensure that the client we are waiting for - * still exists, in case it didn't notify the server - * of its exit - */ - while (!wait_for_submit(p)) { - int creg = *(int*)(p + SGL_OFFSET_REGISTER_CONNECT); - - /* - * a client has notified the server of its attempt - * to connect - */ - if (creg != 0) { - /* - * add connection to the dynamic array - */ - connection_add(creg, 0); - - PRINT_LOG("client %d connected\n", creg); - - /* - * prevent the same client from connecting more - * than once and break from the loop - */ - *(int*)(p + SGL_OFFSET_REGISTER_CONNECT) = 0; - continue; - } - - /* - * some sort of "sync" - */ - usleep(1); - // _mm_pause(); - } - - client_id = *(int*)(p + SGL_OFFSET_REGISTER_READY_HINT); - *(int*)(p + SGL_OFFSET_REGISTER_READY_HINT) = 0; - } - /* - * network-based connection handler and packet translation - */ - else { - bool ready_to_render = false; - while (!ready_to_render) { - enum net_poll_reason reason = net_poll(net_ctx); // to-do: check failure - - if (reason & NET_POLL_INCOMING_CONNECTION) { - net_socket socket = net_accept(net_ctx); - int id = *(int*)(p + SGL_OFFSET_REGISTER_CLAIM_ID); - - connection_add(id, socket); - - struct sgl_packet_connect packet = { - /* client_id = */ id, - /* framebuffer_size = */ framebuffer_size, - /* fifo_size = */ fifo_size, - /* gl_major = */ args.gl_major, - /* gl_minor = */ args.gl_minor, - /* max_width= */ width, - /* max_height= */ height - }; - - net_send_tcp(net_ctx, socket, &packet, sizeof(packet)); - - *((int*)(p + SGL_OFFSET_REGISTER_CLAIM_ID)) += 1; - - PRINT_LOG("client %d connected\n", id); - } - - /* - * incoming udp packets to the server could only mean that - * a client has requested a framebuffer update - */ - if (reason & NET_POLL_INCOMING_UDP) { - struct sgl_packet_swapbuffers_request packet; - net_recv_udp(net_ctx, &packet, sizeof(packet), 0); - - connection_current(packet.client_id); - sgl_read_pixels(packet.width, packet.height, p + SGL_OFFSET_COMMAND_START + fifo_size, packet.vflip, packet.format, 0); // to-do: show memory for overlay - - /* - * send sync packet, otherwise most frames are lost - */ - struct sgl_packet_sync sync = { 0 }; - net_send_tcp(net_ctx, get_fd_from_id(packet.client_id), &sync, sizeof(sync)); - - size_t left_over = packet.width * packet.height * 4; - int expected = left_over / SGL_SWAPBUFFERS_RESULT_SIZE + (left_over % SGL_SWAPBUFFERS_RESULT_SIZE != 0); - - /* - * generate an out-of-sequence order of frames. this way, we update as much of the window - * as possible, tackling packet loss from UDP - */ - scramble(scramble_arr, expected); - int last_index = expected - 1; - size_t left_over_size = left_over % SGL_SWAPBUFFERS_RESULT_SIZE; - - if (left_over_size == 0) - left_over_size = SGL_SWAPBUFFERS_RESULT_SIZE; - - for (int i = 0; i < expected; i++) { - int index = scramble_arr[i]; - size_t size = index != last_index ? SGL_SWAPBUFFERS_RESULT_SIZE : left_over_size; - - struct sgl_packet_swapbuffers_result result = { - /* client_id = */ packet.client_id, - /* index = */ index, - /* size = */ size, - /* result = */ { 0 } - }; - - memcpy(result.result, p + SGL_OFFSET_COMMAND_START + fifo_size + (index * SGL_SWAPBUFFERS_RESULT_SIZE), size); - - net_send_udp(net_ctx, &result, sizeof(result), 0); - } - } - - /* - * incoming tcp packets to the server could only mean that - * a client is uploading its fifo buffer - */ - if (reason & NET_POLL_INCOMING_TCP) { - for (int i = NET_SOCKET_FIRST_FD; i < net_fd_count(net_ctx); i++) { - if (!net_did_event_happen_here(net_ctx, i)) - continue; - - struct sgl_packet_fifo_upload initial_upload_packet, *the_rest_of_the_packets = NULL; - if (!net_recv_tcp_timeout(net_ctx, i, &initial_upload_packet, sizeof(initial_upload_packet), 500)) { - int id = get_id_from_fd(i); - PRINT_LOG("client %d timed out, disconnected\n", id); - connection_rem(id, net_ctx); - memset(p + SGL_OFFSET_COMMAND_START, 0, fifo_size); - break; - } - - if (initial_upload_packet.expected_chunks > 1) { - the_rest_of_the_packets = malloc(sizeof(struct sgl_packet_fifo_upload) * (initial_upload_packet.expected_chunks - 1)); - for (int j = 0; j < initial_upload_packet.expected_chunks - 1; j++) - net_recv_tcp(net_ctx, i, &the_rest_of_the_packets[j], sizeof(initial_upload_packet)); - } - - size_t offset = 0; - for (int i = 0; i < initial_upload_packet.expected_chunks; i++) { - struct sgl_packet_fifo_upload *packet = i == 0 ? &initial_upload_packet : &the_rest_of_the_packets[i - 1]; - size_t size = sizeof(uint32_t) * packet->count; - - memcpy(p + SGL_OFFSET_COMMAND_START + offset, packet->commands, size); - offset += size; - } - - if (the_rest_of_the_packets != NULL) - free(the_rest_of_the_packets); - - ready_to_render = true; - client_id = initial_upload_packet.client_id; - - // break here so we can handle other clients after - break; - } - } - } - } + if (!args.network_over_shared) + wait_shm(p, &client_id); + else + wait_net(p, &client_id, + net_ctx, args, framebuffer_size, fifo_size, width, height); /* * set the current opengl context to the current client @@ -378,7 +393,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) glScissor(0, 0, w, h); break; } - case SGL_CMD_REQUEST_FRAMEBUFFER: { + case SGL_CMD_SWAP_BUFFERS: { int w = *pb++, h = *pb++, vflip = *pb++, @@ -388,7 +403,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) break; } case SGL_CMD_VP_UPLOAD: { - vp_upload_count = *pb++; + int vp_upload_count = *pb++; uploaded = pb; for (int i = 0; i < vp_upload_count; i++) pb++; @@ -410,8 +425,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) } case SGL_CMD_VP_DOWNLOAD: { int length = *pb++; - memcpy(p + SGL_OFFSET_REGISTER_RETVAL_V, map_buffer + map_buffer_offset, length); - map_buffer_offset += length; + memcpy(p + SGL_OFFSET_REGISTER_RETVAL_V, download_target + download_offset, length); + download_offset += length; break; } @@ -497,12 +512,12 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) } case SGL_CMD_CLIPPLANE: { int plane = *pb++; - float eq[4]; + double eq[4]; eq[0] = *((float*)pb++); eq[1] = *((float*)pb++); eq[2] = *((float*)pb++); eq[3] = *((float*)pb++); - glClipPlanef(plane, eq); + glClipPlane(plane, eq); break; } case SGL_CMD_COLOR3F: { @@ -658,6 +673,12 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) glGetShaderiv(shader, pname, (int*)((char*)p + SGL_OFFSET_REGISTER_RETVAL)); break; } + case SGL_CMD_GETOBJECTPARAMETERIVARB: { + int obj = *pb++, + pname = *pb++; + glGetObjectParameterivARB(obj, pname, (int*)((char*)p + SGL_OFFSET_REGISTER_RETVAL)); + break; + } case SGL_CMD_GETUNIFORMLOCATION: { int program = *pb++; char *name = (char*)pb; @@ -696,6 +717,17 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) memcpy(p + SGL_OFFSET_REGISTER_RETVAL_V, v, sizeof(double) * 16); break; } + case SGL_CMD_GETTEXIMAGE: { + int target = *pb++, + level = *pb++, + format = *pb++, + type = *pb++, + total_size = *pb++; + glGetTexImage(target, level, format, type, scratch_buffer_get(total_size)); + download_offset = 0; + download_target = scratch_buffer_get(total_size); + break; + } case SGL_CMD_LIGHTMODELFV: { int pname = *pb++; float v[4]; @@ -768,10 +800,14 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) glShadeModel(*pb++); break; case SGL_CMD_SHADERSOURCE: { - int shader = *pb++; - char *string = (char*)pb; - glShaderSource(shader, 1, (const char* const*)&string, NULL); - ADVANCE_PAST_STRING(); + int shader = *pb++, + count = *pb++; + const char *strings[count]; + for (int i = 0; i < count; i++) { + strings[i] = (char*)pb; + ADVANCE_PAST_STRING(); + } + glShaderSource(shader, count, strings, NULL); break; } case SGL_CMD_TEXIMAGE1D: { @@ -1016,7 +1052,6 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) case SGL_CMD_CLEARDEPTH: { float depth = *((float*)pb++); glClearDepth(depth); - //// printf("glClearDepth(%f);\n", depth); break; } case SGL_CMD_STENCILMASK: { @@ -2798,6 +2833,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) int target = *pb++; int offset = *pb++; int length = *pb++; + // memcpy(map_buffer + offset, uploaded, length); glFlushMappedBufferRange(target, offset, length); break; } @@ -3660,6 +3696,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) } case SGL_CMD_UNMAPNAMEDBUFFER: { int buffer = *pb++; + int length = *pb++; + memcpy(map_buffer, uploaded, length); *(int*)(p + SGL_OFFSET_REGISTER_RETVAL) = glUnmapNamedBuffer(buffer); break; } @@ -3667,6 +3705,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) int buffer = *pb++; int offset = *pb++; int length = *pb++; + memcpy(map_buffer + offset, uploaded, length); glFlushMappedNamedBufferRange(buffer, offset, length); break; } @@ -4206,6 +4245,13 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) glBufferSubData(target, offset, size, uploaded); break; } + case SGL_CMD_BUFFERSUBDATAARB: { + int target = *pb++, + offset = *pb++, + size = *pb++; + glBufferSubDataARB(target, offset, size, uploaded); + break; + } case SGL_CMD_GETBUFFERPARAMETERIV: { int target = *pb++, pname = *pb++; @@ -4785,7 +4831,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) int target = *pb++, access = *pb++; map_buffer = glMapBuffer(target, access); - map_buffer_offset = 0; + download_offset = 0; + download_target = map_buffer; break; } case SGL_CMD_MAPBUFFERRANGE: { @@ -4794,7 +4841,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) length = *pb++, access = *pb++; map_buffer = glMapBufferRange(target, offset, length, access); - map_buffer_offset = 0; + download_offset = 0; + download_target = map_buffer; break; } case SGL_CMD_FENCESYNC: { @@ -4820,7 +4868,7 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) } case SGL_CMD_DRAWBUFFERS: { int n = *pb++; - unsigned int bufs[16]; + unsigned int bufs[n]; for (int i = 0; i < n; i++) bufs[i] = *pb++; glDrawBuffers(n, bufs); @@ -5514,7 +5562,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) int target = *pb++, access = *pb++; map_buffer = glMapNamedBuffer(target, access); - map_buffer_offset = 0; + download_offset = 0; + download_target = map_buffer; break; } case SGL_CMD_MAPNAMEDBUFFERRANGE: { @@ -5523,7 +5572,8 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) length = *pb++, access = *pb++; map_buffer = glMapNamedBufferRange(target, offset, length, access); - map_buffer_offset = 0; + download_offset = 0; + download_target = map_buffer; break; } case SGL_CMD_GETNAMEDBUFFERPARAMETERIV: { @@ -5915,8 +5965,197 @@ void sgl_cmd_processor_start(struct sgl_cmd_processor_args args) memcpy(p + SGL_OFFSET_REGISTER_RETVAL, &length, sizeof(int)); break; } + case SGL_CMD_ATTACHOBJECTARB: { + int v0 = *pb++; + int v1 = *pb++; + glAttachObjectARB(v0, v1); + break; + } + case SGL_CMD_BINDATTRIBLOCATIONARB: { + int program = *pb++, + index = *pb++; + char *name = (char*)pb; + glBindAttribLocationARB(program, index, name); + ADVANCE_PAST_STRING(); + break; + } + case SGL_CMD_BINDBUFFERARB: { + int target = *pb++, + buffer = *pb++; + glBindBufferARB(target, buffer); + break; + } + case SGL_CMD_BINDPROGRAMARB: { + int target = *pb++, + program = *pb++; + glBindProgramARB(target, program); + break; + } + case SGL_CMD_BUFFERDATAARB: { + int target = *pb++, + size = *pb++, + use_uploaded = *pb++, + usage = *pb++; + glBufferDataARB(target, size, use_uploaded ? uploaded : NULL, usage); + break; + } + case SGL_CMD_COMPILESHADERARB: { + glCompileShaderARB(*pb++); + break; + } + case SGL_CMD_CREATEPROGRAMOBJECTARB: { + *(int*)(p + SGL_OFFSET_REGISTER_RETVAL) = glCreateProgramObjectARB(); + break; + } + case SGL_CMD_CREATESHADEROBJECTARB: { + *(int*)(p + SGL_OFFSET_REGISTER_RETVAL) = glCreateShaderObjectARB(*pb++); + break; + } + case SGL_CMD_DELETEBUFFERSARB: { + const unsigned int *x = (unsigned*)pb++; + glDeleteBuffersARB(1, x); + break; + } + case SGL_CMD_DELETEOBJECTARB: { + glDeleteObjectARB(*pb++); + break; + } + case SGL_CMD_DELETEPROGRAMSARB: { + const unsigned int *x = (unsigned*)pb++; + glDeleteProgramsARB(1, x); + break; + } + case SGL_CMD_DELETEQUERIESARB: { + const unsigned int *x = (unsigned*)pb++; + glDeleteQueriesARB(1, x); + break; + } + case SGL_CMD_DETACHOBJECTARB: { + int containerObj = *pb++, + attachedObj = *pb++; + glDetachObjectARB(containerObj, attachedObj); + break; + } + case SGL_CMD_GENBUFFERSARB: { + glGenBuffersARB(1, p + SGL_OFFSET_REGISTER_RETVAL); + break; + } + case SGL_CMD_GENPROGRAMSARB: { + glGenProgramsARB(1, p + SGL_OFFSET_REGISTER_RETVAL); + break; + } + case SGL_CMD_GENQUERIESARB: { + glGenQueriesARB(1, p + SGL_OFFSET_REGISTER_RETVAL); + break; + } + case SGL_CMD_GETINFOLOGARB: { + int obj = *pb++; + int maxLength = *pb++; + glGetInfoLogARB(obj, maxLength, + p + SGL_OFFSET_REGISTER_RETVAL_V, + p + SGL_OFFSET_REGISTER_RETVAL_V + sizeof(GLsizei) + ); + break; + } + case SGL_CMD_GETPROGRAMIVARB: { + int program = *pb++, + pname = *pb++; + glGetProgramivARB(program, pname, (int*)((char*)p + SGL_OFFSET_REGISTER_RETVAL)); + break; + } + case SGL_CMD_GETUNIFORMLOCATIONARB: { + int programObj = *pb++; + char *string = (char*)pb; + ADVANCE_PAST_STRING(); + *(int*)(p + SGL_OFFSET_REGISTER_RETVAL) = glGetUniformLocationARB(programObj, string); + break; + } + case SGL_CMD_LINKPROGRAMARB: { + glLinkProgramARB(*pb++); + break; + } + case SGL_CMD_MAPBUFFERARB: { + int target = *pb++, + access = *pb++; + map_buffer = glMapBufferARB(target, access); + download_offset = 0; + download_target = map_buffer; + break; + } + case SGL_CMD_PROGRAMSTRINGARB: { + int target = *pb++, + format = *pb++, + len = *pb++; + char *string = (char*)pb; + ADVANCE_PAST_STRING(); + glProgramStringARB(target, format, len, string); + break; + } + case SGL_CMD_SHADERSOURCEARB: { + int shader = *pb++, + count = *pb++; + const char *strings[count]; + for (int i = 0; i < count; i++) { + strings[i] = (char*)pb; + ADVANCE_PAST_STRING(); + } + glShaderSourceARB(shader, count, strings, NULL); + break; + } + case SGL_CMD_UNIFORM1IARB: { + int location = *pb++, + v0 = *pb++; + glUniform1iARB(location, v0); + break; + } + case SGL_CMD_PROGRAMENVPARAMETERS4FVEXT: { + int target = *pb++, + index = *pb++, + count = *pb++; + float *params = (float*)pb; + pb += count * 4; + glProgramEnvParameters4fvEXT(target, index, count, params); + break; + } + case SGL_CMD_COLORMASKINDEXEDEXT: { + int index = *pb++, + r = *pb++, + g = *pb++, + b = *pb++, + a = *pb++; + glColorMaskIndexedEXT(index, r, g, b, a); + break; + } + case SGL_CMD_ENABLEINDEXEDEXT: { + int target = *pb++, + index = *pb++; + glEnableIndexedEXT(target, index); + break; + } + case SGL_CMD_DISABLEINDEXEDEXT: { + int target = *pb++, + index = *pb++; + glDisableIndexedEXT(target, index); + break; + } + case SGL_CMD_GETBOOLEANINDEXEDVEXT: { + int target = *pb++, + index = *pb++; + glGetBooleanIndexedvEXT(target, index, p + SGL_OFFSET_REGISTER_RETVAL); + break; + } + case SGL_CMD_ACTIVETEXTUREARB: { + glActiveTextureARB(*pb++); + break; + } + case SGL_CMD_MULTITEXCOORD2FARB: { + int target = *pb++; + float s = *((float*)pb++), + t = *((float*)pb++); + glMultiTexCoord2fARB(target, s, t); + break; + } } - if (!begun) { int error; while ((error = glGetError()) != GL_NO_ERROR) diff --git a/src/server/sgldebug.c b/src/server/sgldebug.c index eca97fa..0506e69 100644 --- a/src/server/sgldebug.c +++ b/src/server/sgldebug.c @@ -19,7 +19,7 @@ const char *sgl_cmd2str(int c) STRING(SGL_CMD_REPORT_DIMS), STRING(SGL_CMD_HELLO_WORLD), STRING(SGL_CMD_GOODBYE_WORLD), - STRING(SGL_CMD_REQUEST_FRAMEBUFFER), + STRING(SGL_CMD_SWAP_BUFFERS), STRING(SGL_CMD_CULLFACE), STRING(SGL_CMD_FRONTFACE), STRING(SGL_CMD_HINT), @@ -1067,7 +1067,39 @@ const char *sgl_cmd2str(int c) STRING(SGL_CMD_SPECIALIZESHADER), STRING(SGL_CMD_MULTIDRAWARRAYSINDIRECTCOUNT), STRING(SGL_CMD_MULTIDRAWELEMENTSINDIRECTCOUNT), - STRING(SGL_CMD_POLYGONOFFSETCLAMP) + STRING(SGL_CMD_POLYGONOFFSETCLAMP), + STRING(SGL_CMD_GETOBJECTPARAMETERIVARB), + STRING(SGL_CMD_ATTACHOBJECTARB), + STRING(SGL_CMD_BINDATTRIBLOCATIONARB), + STRING(SGL_CMD_BINDBUFFERARB), + STRING(SGL_CMD_BINDPROGRAMARB), + STRING(SGL_CMD_BUFFERDATAARB), + STRING(SGL_CMD_COMPILESHADERARB), + STRING(SGL_CMD_CREATEPROGRAMOBJECTARB), + STRING(SGL_CMD_CREATESHADEROBJECTARB), + STRING(SGL_CMD_DELETEBUFFERSARB), + STRING(SGL_CMD_DELETEOBJECTARB), + STRING(SGL_CMD_DELETEPROGRAMSARB), + STRING(SGL_CMD_DELETEQUERIESARB), + STRING(SGL_CMD_DETACHOBJECTARB), + STRING(SGL_CMD_GENBUFFERSARB), + STRING(SGL_CMD_GENPROGRAMSARB), + STRING(SGL_CMD_GENQUERIESARB), + STRING(SGL_CMD_GETINFOLOGARB), + STRING(SGL_CMD_GETPROGRAMIVARB), + STRING(SGL_CMD_GETUNIFORMLOCATIONARB), + STRING(SGL_CMD_LINKPROGRAMARB), + STRING(SGL_CMD_MAPBUFFERARB), + STRING(SGL_CMD_PROGRAMSTRINGARB), + STRING(SGL_CMD_SHADERSOURCEARB), + STRING(SGL_CMD_UNIFORM1IARB), + STRING(SGL_CMD_PROGRAMENVPARAMETERS4FVEXT), + STRING(SGL_CMD_COLORMASKINDEXEDEXT), + STRING(SGL_CMD_ENABLEINDEXEDEXT), + STRING(SGL_CMD_DISABLEINDEXEDEXT), + STRING(SGL_CMD_GETBOOLEANINDEXEDVEXT), + STRING(SGL_CMD_ACTIVETEXTUREARB), + STRING(SGL_CMD_MULTITEXCOORD2FARB) }; #undef STRING