mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-13 02:29:10 -04:00
REVIEWED: Software renderer flag, renamed to GRAPHICS_API_OPENGL_SOFTWARE
Dropped the `11` relative to OpenGL 1.1 because latest `rlsw 1.5` also includes support for FBOs and could potentially implemented other higher level features in the feature, discerning from OpenGL 1.1 limitations
This commit is contained in:
@ -60,7 +60,7 @@
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// It seems it does not need to be included to work
|
||||
//#include "SDL_opengles2.h"
|
||||
@ -1259,7 +1259,7 @@ void DisableCursor(void)
|
||||
// Swap back buffer with front buffer (screen drawing)
|
||||
void SwapScreenBuffer(void)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// NOTE: Using a preprocessor condition here because rlCopyFramebuffer() is only declared for software rendering
|
||||
SDL_Surface *surface = SDL_GetWindowSurface(platform.window);
|
||||
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, surface->pixels);
|
||||
@ -1981,7 +1981,7 @@ int InitPlatform(void)
|
||||
|
||||
// NOTE: Some OpenGL context attributes must be set before window creation
|
||||
|
||||
if (rlGetVersion() != RL_OPENGL_11_SOFTWARE)
|
||||
if (rlGetVersion() != RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
// Add the flag telling the window to use an OpenGL context
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
@ -2044,12 +2044,12 @@ int InitPlatform(void)
|
||||
#endif
|
||||
|
||||
// Init OpenGL context
|
||||
if (rlGetVersion() != RL_OPENGL_11_SOFTWARE)
|
||||
if (rlGetVersion() != RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
platform.glContext = SDL_GL_CreateContext(platform.window);
|
||||
}
|
||||
|
||||
if ((platform.window != NULL) && ((rlGetVersion() == RL_OPENGL_11_SOFTWARE) || (platform.glContext != NULL)))
|
||||
if ((platform.window != NULL) && ((rlGetVersion() == RL_OPENGL_SOFTWARE) || (platform.glContext != NULL)))
|
||||
{
|
||||
CORE.Window.ready = true;
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
#include <malloc.h> // Required for alloca()
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
@ -1218,7 +1218,7 @@ void SwapScreenBuffer(void)
|
||||
{
|
||||
if (!platform.hdc) abort();
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Update framebuffer
|
||||
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.pixels);
|
||||
|
||||
@ -1603,7 +1603,7 @@ int InitPlatform(void)
|
||||
// NOTE: Windows GDI object that represents a drawing surface
|
||||
platform.hdc = GetDC(platform.hwnd);
|
||||
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
|
||||
{
|
||||
// Initialize software framebuffer
|
||||
BITMAPINFO bmi = { 0 };
|
||||
@ -1649,11 +1649,11 @@ int InitPlatform(void)
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
|
||||
{
|
||||
TRACELOG(LOG_INFO, "GL: OpenGL device information:");
|
||||
TRACELOG(LOG_INFO, " > Vendor: %s", "raylib");
|
||||
TRACELOG(LOG_INFO, " > Renderer: %s", "rlsw - OpenGL 1.1 Software Renderer");
|
||||
TRACELOG(LOG_INFO, " > Renderer: %s", "rlsw - OpenGL Software Renderer");
|
||||
TRACELOG(LOG_INFO, " > Version: %s", "1.0");
|
||||
TRACELOG(LOG_INFO, " > GLSL: %s", "NOT SUPPORTED");
|
||||
}
|
||||
@ -1719,7 +1719,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
case WM_DESTROY:
|
||||
{
|
||||
// Clean up for window destruction
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
|
||||
{
|
||||
if (platform.hdcmem)
|
||||
{
|
||||
@ -1935,7 +1935,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
} break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE) // Using software renderer
|
||||
{
|
||||
PAINTSTRUCT ps = { 0 };
|
||||
HDC hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
#include <xf86drm.h> // Direct Rendering Manager user-level library interface
|
||||
#include <xf86drmMode.h> // Direct Rendering Manager mode setting (KMS) interface
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
#include <gbm.h> // Generic Buffer Management (native platform for EGL on DRM)
|
||||
#include "EGL/egl.h" // Native platform windowing system interface
|
||||
#include "EGL/eglext.h" // EGL extensions
|
||||
@ -111,7 +111,7 @@ typedef struct {
|
||||
int modeIndex; // Index of the used mode of connector->modes
|
||||
uint32_t prevFB; // Previous DRM framebufer (during frame swapping)
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
struct gbm_device *gbmDevice; // GBM device
|
||||
struct gbm_surface *gbmSurface; // GBM surface
|
||||
struct gbm_bo *prevBO; // Previous GBM buffer object (during frame swapping)
|
||||
@ -796,7 +796,7 @@ void SwapScreenBuffer()
|
||||
// Swap back buffer with front buffer (screen drawing)
|
||||
void SwapScreenBuffer(void)
|
||||
{
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Hardware rendering buffer swap with EGL
|
||||
eglSwapBuffers(platform.device, platform.surface);
|
||||
|
||||
@ -1140,7 +1140,7 @@ int InitPlatform(void)
|
||||
platform.crtc = NULL;
|
||||
platform.prevFB = 0;
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
platform.gbmDevice = NULL;
|
||||
platform.gbmSurface = NULL;
|
||||
platform.prevBO = NULL;
|
||||
@ -1224,7 +1224,7 @@ int InitPlatform(void)
|
||||
// WARNING: Accept CONNECTED, UNKNOWN and even those without encoder_id connectors for software mode
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->count_modes > 0))
|
||||
{
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// For hardware rendering, an encoder_id is needed
|
||||
if (con->encoder_id)
|
||||
{
|
||||
@ -1256,7 +1256,7 @@ int InitPlatform(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
drmModeEncoder *enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||
if (!enc)
|
||||
{
|
||||
@ -1367,7 +1367,7 @@ int InitPlatform(void)
|
||||
drmModeFreeResources(res);
|
||||
res = NULL;
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Hardware rendering initialization with EGL
|
||||
platform.gbmDevice = gbm_create_device(platform.fd);
|
||||
if (!platform.gbmDevice)
|
||||
@ -1657,7 +1657,7 @@ void ClosePlatform(void)
|
||||
platform.prevFB = 0;
|
||||
}
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
if (platform.prevBO)
|
||||
{
|
||||
gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO);
|
||||
@ -1697,7 +1697,7 @@ void ClosePlatform(void)
|
||||
platform.fd = -1;
|
||||
}
|
||||
|
||||
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if !defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Close surface, context and display
|
||||
if (platform.device != EGL_NO_DISPLAY)
|
||||
{
|
||||
|
||||
@ -486,9 +486,9 @@ void PollInputEvents(void)
|
||||
int InitPlatform(void)
|
||||
{
|
||||
// Memory framebuffer can only work with software renderer
|
||||
if (rlGetVersion() != RL_OPENGL_11_SOFTWARE)
|
||||
if (rlGetVersion() != RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Memory platform requires software renderer (GRAPHICS_API_OPENGL_11_SOFTWARE)");
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Memory platform requires software renderer (GRAPHICS_API_OPENGL_SOFTWARE)");
|
||||
TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphics device");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ typedef struct {
|
||||
char canvasId[64]; // Keep current canvas id where wasm app is running
|
||||
// NOTE: Useful when trying to run multiple wasms in different canvases in same webpage
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
unsigned int *pixels; // Pointer to pixel data buffer (RGBA 32bit format)
|
||||
#endif
|
||||
} PlatformData;
|
||||
@ -949,7 +949,7 @@ void DisableCursor(void)
|
||||
// Swap back buffer with front buffer (screen drawing)
|
||||
void SwapScreenBuffer(void)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Update framebuffer
|
||||
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.pixels);
|
||||
|
||||
@ -1306,7 +1306,7 @@ int InitPlatform(void)
|
||||
// Init fullscreen toggle required var:
|
||||
platform.ourFullscreen = false;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Avoid creating a WebGL canvas, avoid calling glfwCreateWindow()
|
||||
emscripten_set_canvas_element_size(platform.canvasId, CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
EM_ASM({
|
||||
|
||||
@ -927,7 +927,7 @@ void DisableCursor(void)
|
||||
// Swap back buffer with front buffer (screen drawing)
|
||||
void SwapScreenBuffer(void)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||
// Update framebuffer
|
||||
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, platform.pixels);
|
||||
|
||||
@ -1188,7 +1188,7 @@ int InitPlatform(void)
|
||||
if (FLAG_IS_SET(CORE.Window.flags, FLAG_MSAA_4X_HINT)) attribs.antialias = EM_TRUE;
|
||||
|
||||
// Check selection OpenGL version
|
||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE)
|
||||
if (rlGetVersion() == RL_OPENGL_SOFTWARE)
|
||||
{
|
||||
// Avoid creating a WebGL canvas, create 2d canvas for software rendering
|
||||
emscripten_set_canvas_element_size(platform.canvasId, CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
|
||||
Reference in New Issue
Block a user