- fixed compilation of Linux target

Base and OpenGL framebuffer classes still require proper splitting
This commit is contained in:
alexey.lysiuk 2019-03-04 12:47:00 +02:00
parent 7efa231e4e
commit 802d37f377
4 changed files with 33 additions and 18 deletions

View file

@ -5,14 +5,14 @@
#include "v_video.h" #include "v_video.h"
class SystemGLFrameBuffer : public DFrameBuffer class SystemBaseFrameBuffer : public DFrameBuffer
{ {
typedef DFrameBuffer Super; typedef DFrameBuffer Super;
public: public:
// this must have the same parameters as the Windows version, even if they are not used! // this must have the same parameters as the Windows version, even if they are not used!
SystemGLFrameBuffer (void *hMonitor, bool fullscreen); SystemBaseFrameBuffer (void *hMonitor, bool fullscreen);
~SystemGLFrameBuffer (); ~SystemBaseFrameBuffer ();
void ForceBuffering (bool force); void ForceBuffering (bool force);
@ -37,7 +37,7 @@ protected:
void SetGammaTable(uint16_t *tbl); void SetGammaTable(uint16_t *tbl);
void ResetGammaTable(); void ResetGammaTable();
SystemGLFrameBuffer () {} SystemBaseFrameBuffer () {}
uint8_t GammaTable[3][256]; uint8_t GammaTable[3][256];
bool UpdatePending; bool UpdatePending;
@ -51,5 +51,18 @@ protected:
static const int MIN_HEIGHT = 200; static const int MIN_HEIGHT = 200;
}; };
class SystemGLFrameBuffer : public SystemBaseFrameBuffer
{
typedef SystemBaseFrameBuffer Super;
public:
SystemGLFrameBuffer(void *hMonitor, bool fullscreen)
: SystemBaseFrameBuffer(hMonitor, fullscreen)
{}
protected:
SystemGLFrameBuffer() {}
};
#endif // __POSIX_SDL_GL_SYSFB_H__ #endif // __POSIX_SDL_GL_SYSFB_H__

View file

@ -116,7 +116,7 @@ SDLGLVideo::~SDLGLVideo ()
DFrameBuffer *SDLGLVideo::CreateFrameBuffer () DFrameBuffer *SDLGLVideo::CreateFrameBuffer ()
{ {
SystemGLFrameBuffer *fb = new OpenGLRenderer::OpenGLFrameBuffer(0, fullscreen); SystemBaseFrameBuffer *fb = new OpenGLRenderer::OpenGLFrameBuffer(0, fullscreen);
return fb; return fb;
} }
@ -177,7 +177,7 @@ FModule sdl_lib("SDL2");
typedef int (*SDL_GetWindowBordersSizePtr)(SDL_Window *, int *, int *, int *, int *); typedef int (*SDL_GetWindowBordersSizePtr)(SDL_Window *, int *, int *, int *, int *);
static TOptProc<sdl_lib, SDL_GetWindowBordersSizePtr> SDL_GetWindowBordersSize_("SDL_GetWindowBordersSize"); static TOptProc<sdl_lib, SDL_GetWindowBordersSizePtr> SDL_GetWindowBordersSize_("SDL_GetWindowBordersSize");
SystemGLFrameBuffer::SystemGLFrameBuffer (void *, bool fullscreen) SystemBaseFrameBuffer::SystemBaseFrameBuffer (void *, bool fullscreen)
: DFrameBuffer (vid_defwidth, vid_defheight) : DFrameBuffer (vid_defwidth, vid_defheight)
{ {
m_fsswitch = false; m_fsswitch = false;
@ -257,7 +257,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer (void *, bool fullscreen)
} }
} }
SystemGLFrameBuffer::~SystemGLFrameBuffer () SystemBaseFrameBuffer::~SystemBaseFrameBuffer ()
{ {
if (Screen) if (Screen)
{ {
@ -271,12 +271,12 @@ SystemGLFrameBuffer::~SystemGLFrameBuffer ()
} }
bool SystemGLFrameBuffer::IsFullscreen () bool SystemBaseFrameBuffer::IsFullscreen ()
{ {
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0; return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
} }
void SystemGLFrameBuffer::SetVSync( bool vsync ) void SystemBaseFrameBuffer::SetVSync( bool vsync )
{ {
#if defined (__APPLE__) #if defined (__APPLE__)
const GLint value = vsync ? 1 : 0; const GLint value = vsync ? 1 : 0;
@ -294,7 +294,7 @@ void SystemGLFrameBuffer::SetVSync( bool vsync )
#endif #endif
} }
void SystemGLFrameBuffer::SwapBuffers() void SystemBaseFrameBuffer::SwapBuffers()
{ {
#if !defined(__APPLE__) && !defined(__OpenBSD__) #if !defined(__APPLE__) && !defined(__OpenBSD__)
if (vid_maxfps && !cl_capfps) if (vid_maxfps && !cl_capfps)
@ -306,7 +306,7 @@ void SystemGLFrameBuffer::SwapBuffers()
SDL_GL_SwapWindow (Screen); SDL_GL_SwapWindow (Screen);
} }
void SystemGLFrameBuffer::ToggleFullscreen(bool yes) void SystemBaseFrameBuffer::ToggleFullscreen(bool yes)
{ {
SDL_SetWindowFullscreen(Screen, yes ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); SDL_SetWindowFullscreen(Screen, yes ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
if ( !yes ) if ( !yes )
@ -324,21 +324,21 @@ void SystemGLFrameBuffer::ToggleFullscreen(bool yes)
} }
} }
int SystemGLFrameBuffer::GetClientWidth() int SystemBaseFrameBuffer::GetClientWidth()
{ {
int width = 0; int width = 0;
SDL_GL_GetDrawableSize(Screen, &width, nullptr); SDL_GL_GetDrawableSize(Screen, &width, nullptr);
return width; return width;
} }
int SystemGLFrameBuffer::GetClientHeight() int SystemBaseFrameBuffer::GetClientHeight()
{ {
int height = 0; int height = 0;
SDL_GL_GetDrawableSize(Screen, nullptr, &height); SDL_GL_GetDrawableSize(Screen, nullptr, &height);
return height; return height;
} }
void SystemGLFrameBuffer::SetWindowSize(int w, int h) void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
{ {
if (w < MIN_WIDTH || h < MIN_HEIGHT) if (w < MIN_WIDTH || h < MIN_HEIGHT)
{ {
@ -364,7 +364,7 @@ void SystemGLFrameBuffer::SetWindowSize(int w, int h)
} }
} }
void SystemGLFrameBuffer::GetWindowBordersSize(int &top, int &left) void SystemBaseFrameBuffer::GetWindowBordersSize(int &top, int &left)
{ {
if (SDL_GetWindowBordersSize_) if (SDL_GetWindowBordersSize_)
{ {
@ -392,14 +392,14 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event)
if (!fullscreen) if (!fullscreen)
{ {
int top = 0, left = 0; int top = 0, left = 0;
static_cast<SystemGLFrameBuffer *>(screen)->GetWindowBordersSize(top,left); static_cast<SystemBaseFrameBuffer *>(screen)->GetWindowBordersSize(top,left);
win_x = event.data1-left; win_x = event.data1-left;
win_y = event.data2-top; win_y = event.data2-top;
} }
break; break;
case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_RESIZED:
if (!fullscreen && !(static_cast<SystemGLFrameBuffer *>(screen)->m_fsswitch)) if (!fullscreen && !(static_cast<SystemBaseFrameBuffer *>(screen)->m_fsswitch))
{ {
win_w = event.data1; win_w = event.data1;
win_h = event.data2; win_h = event.data2;
@ -420,7 +420,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event)
// each platform has its own specific version of this function. // each platform has its own specific version of this function.
void I_SetWindowTitle(const char* caption) void I_SetWindowTitle(const char* caption)
{ {
auto window = static_cast<SystemGLFrameBuffer *>(screen)->GetSDLWindow(); auto window = static_cast<SystemBaseFrameBuffer *>(screen)->GetSDLWindow();
if (caption) if (caption)
SDL_SetWindowTitle(window, caption); SDL_SetWindowTitle(window, caption);
else else

View file

@ -4,6 +4,7 @@
#include "vulkan/system/vk_objects.h" #include "vulkan/system/vk_objects.h"
#include "r_data/renderstyle.h" #include "r_data/renderstyle.h"
#include "hwrenderer/data/buffers.h" #include "hwrenderer/data/buffers.h"
#include <string.h>
#include <map> #include <map>
class VKDataBuffer; class VKDataBuffer;

View file

@ -5,6 +5,7 @@
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <memory>
class VulkanSwapChain; class VulkanSwapChain;
class VulkanSemaphore; class VulkanSemaphore;