mirror of
https://github.com/AxioDL/boo.git
synced 2025-05-17 12:51:25 +00:00
refactor of graphic system; initial HECL
This commit is contained in:
parent
35f2156de1
commit
6ce2472b27
20
include/graphicsys/CGFXVertexLayoutBase.hpp
Normal file
20
include/graphicsys/CGFXVertexLayoutBase.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef CGFXVERTEXLAYOUTBASE_HPP
|
||||||
|
#define CGFXVERTEXLAYOUTBASE_HPP
|
||||||
|
|
||||||
|
class CGFXVertexLayoutBase
|
||||||
|
{
|
||||||
|
unsigned m_uvCount;
|
||||||
|
unsigned m_weightCount;
|
||||||
|
public:
|
||||||
|
CGFXVertexLayoutBase(unsigned uvCount=0, unsigned weightCount=0)
|
||||||
|
: m_uvCount(uvCount),
|
||||||
|
m_weightCount(weightCount) {}
|
||||||
|
virtual ~CGFXVertexLayoutBase() {}
|
||||||
|
|
||||||
|
inline unsigned uvCount() {return m_uvCount;}
|
||||||
|
inline unsigned weightCount() {return m_weightCount;}
|
||||||
|
inline bool isSkinned() {return m_weightCount > 0;}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CGFXVERTEXLAYOUTBASE_HPP
|
5
include/graphicsys/IGFXCommandBuffer.hpp
Normal file
5
include/graphicsys/IGFXCommandBuffer.hpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#ifndef IGFXCOMMANDBUFFER_HPP
|
||||||
|
#define IGFXCOMMANDBUFFER_HPP
|
||||||
|
|
||||||
|
#endif // IGFXCOMMANDBUFFER_HPP
|
||||||
|
|
@ -1,13 +1,14 @@
|
|||||||
#ifndef IGRAPHICSCONTEXT_HPP
|
#ifndef IGFXCONTEXT_HPP
|
||||||
#define IGRAPHICSCONTEXT_HPP
|
#define IGFXCONTEXT_HPP
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
class IGraphicsContext
|
class IGFXContext
|
||||||
{
|
{
|
||||||
friend class CWindowCocoa;
|
friend class CWindowCocoa;
|
||||||
virtual void _setCallback(class IWindowCallback* cb) {(void)cb;};
|
friend class CWindowXCB;
|
||||||
|
virtual void _setCallback(class IWindowCallback* cb) {(void)cb;}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -33,22 +34,15 @@ public:
|
|||||||
PF_RGBAF32_Z24 = 4
|
PF_RGBAF32_Z24 = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~IGraphicsContext() {}
|
virtual ~IGFXContext() {}
|
||||||
|
|
||||||
virtual EGraphicsAPI getAPI() const=0;
|
virtual EGraphicsAPI getAPI() const=0;
|
||||||
virtual EPixelFormat getPixelFormat() const=0;
|
virtual EPixelFormat getPixelFormat() const=0;
|
||||||
virtual void setPixelFormat(EPixelFormat pf)=0;
|
virtual void setPixelFormat(EPixelFormat pf)=0;
|
||||||
virtual void initializeContext()=0;
|
virtual void initializeContext()=0;
|
||||||
virtual IGraphicsContext* makeShareContext() const=0;
|
|
||||||
virtual void makeCurrent()=0;
|
|
||||||
virtual void clearCurrent()=0;
|
|
||||||
|
|
||||||
/* Note: *all* contexts are double-buffered with
|
|
||||||
* v-sync interval; please call this */
|
|
||||||
virtual void swapBuffer()=0;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IGRAPHICSCONTEXT_HPP
|
#endif // IGFXCONTEXT_HPP
|
5
include/graphicsys/IGFXPipelineState.hpp
Normal file
5
include/graphicsys/IGFXPipelineState.hpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#ifndef IGFXPIPELINESTATE_HPP
|
||||||
|
#define IGFXPIPELINESTATE_HPP
|
||||||
|
|
||||||
|
#endif // IGFXPIPELINESTATE_HPP
|
||||||
|
|
5
include/graphicsys/IGFXTransformSet.hpp
Normal file
5
include/graphicsys/IGFXTransformSet.hpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#ifndef IGFXTRANSFORMSET_HPP
|
||||||
|
#define IGFXTRANSFORMSET_HPP
|
||||||
|
|
||||||
|
#endif // IGFXTRANSFORMSET_HPP
|
||||||
|
|
20
include/graphicsys/hecl/CHECLLexer.hpp
Normal file
20
include/graphicsys/hecl/CHECLLexer.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef CHECLLEXER_HPP
|
||||||
|
#define CHECLLEXER_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "graphicsys/CGFXVertexLayoutBase.hpp"
|
||||||
|
|
||||||
|
class CHECLLexer
|
||||||
|
{
|
||||||
|
const CGFXVertexLayoutBase& m_vertLayout;
|
||||||
|
public:
|
||||||
|
CHECLLexer(const CGFXVertexLayoutBase& vertLayout,
|
||||||
|
const std::string& colorHECL);
|
||||||
|
CHECLLexer(const CGFXVertexLayoutBase& vertLayout,
|
||||||
|
const std::string& colorHECL,
|
||||||
|
const std::string& alphaHECL);
|
||||||
|
|
||||||
|
inline const CGFXVertexLayoutBase& getVertLayout() const {return m_vertLayout;}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CHECLLEXER_HPP
|
46
include/graphicsys/hecl/HECLExpressions.hpp
Normal file
46
include/graphicsys/hecl/HECLExpressions.hpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef HECLEXPRESSIONS_HPP
|
||||||
|
#define HECLEXPRESSIONS_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class IHECLExpression
|
||||||
|
{
|
||||||
|
/* Traverse expression tree and assemble
|
||||||
|
* backend-specific stage objects */
|
||||||
|
virtual IHECLBackendStage* recursiveStages(IHECLBackend& backend) const=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLNumberLiteral final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLVector final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLTextureSample final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLTextureGatherSample final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLMulOperation final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLAddOperation final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLSubOperation final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
class CHECLRoot final : IHECLExpression
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HECLEXPRESSIONS_HPP
|
76
include/graphicsys/hecl/IHECLBackend.hpp
Normal file
76
include/graphicsys/hecl/IHECLBackend.hpp
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#ifndef IHECLBACKEND_HPP
|
||||||
|
#define IHECLBACKEND_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "CHECLLexer.hpp"
|
||||||
|
|
||||||
|
class IHECLBackend;
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendOutline(const CHECLLexer& lexer);
|
||||||
|
IHECLBackend* NewHECLBackendGLSL(const CHECLLexer& lexer);
|
||||||
|
IHECLBackend* NewHECLBackendHLSL(const CHECLLexer& lexer);
|
||||||
|
IHECLBackend* NewHECLBackendMetal(const CHECLLexer& lexer);
|
||||||
|
IHECLBackend* NewHECLBackendTEV(const CHECLLexer& lexer);
|
||||||
|
IHECLBackend* NewHECLBackendGLSLCafe(const CHECLLexer& lexer);
|
||||||
|
|
||||||
|
class IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
AUTO = 0,
|
||||||
|
OUTLINE = 1,
|
||||||
|
GLSL = 2,
|
||||||
|
HLSL = 3,
|
||||||
|
METAL = 4,
|
||||||
|
TEV = 5,
|
||||||
|
GLSL_CAFE = 6
|
||||||
|
};
|
||||||
|
virtual Type getType() const=0;
|
||||||
|
|
||||||
|
virtual bool hasVertexSourceForm() const {return false;}
|
||||||
|
virtual bool hasFragmentSourceForm() const {return false;}
|
||||||
|
virtual bool hasVertexBinaryForm() const {return false;}
|
||||||
|
virtual bool hasFragmentBinaryForm() const {return false;}
|
||||||
|
virtual bool hasBinaryForm() const {return false;}
|
||||||
|
|
||||||
|
virtual std::string* emitNewVertexSource() {return NULL;}
|
||||||
|
virtual std::string* emitNewFragmentSource() {return NULL;}
|
||||||
|
virtual void* emitNewVertexBinary(size_t& szOut) {szOut = 0;return NULL;}
|
||||||
|
virtual void* emitNewFragmentBinary(size_t& szOut) {szOut = 0;return NULL;}
|
||||||
|
virtual void* emitNewBinary(size_t& szOut) {szOut = 0;return NULL;}
|
||||||
|
|
||||||
|
static inline IHECLBackend* NewHECLBackend(Type backendType, const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
switch (backendType)
|
||||||
|
{
|
||||||
|
case AUTO:
|
||||||
|
#if HW_RVL
|
||||||
|
return NewHECLBackendTEV(lexer);
|
||||||
|
#elif HW_CAFE
|
||||||
|
return NewHECLBackendGLSLCafe(lexer);
|
||||||
|
#elif _WIN32
|
||||||
|
return NewHECLBackendHLSL(lexer);
|
||||||
|
#else
|
||||||
|
return NewHECLBackendGLSL(lexer);
|
||||||
|
#endif
|
||||||
|
case OUTLINE:
|
||||||
|
return NewHECLBackendOutline(lexer);
|
||||||
|
case GLSL:
|
||||||
|
return NewHECLBackendGLSL(lexer);
|
||||||
|
case HLSL:
|
||||||
|
return NewHECLBackendHLSL(lexer);
|
||||||
|
case METAL:
|
||||||
|
return NewHECLBackendMetal(lexer);
|
||||||
|
case TEV:
|
||||||
|
return NewHECLBackendTEV(lexer);
|
||||||
|
case GLSL_CAFE:
|
||||||
|
return NewHECLBackendGLSLCafe(lexer);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // IHECLBACKEND_HPP
|
28
libBoo.pri
28
libBoo.pri
@ -2,7 +2,6 @@ HEADERS += \
|
|||||||
$$PWD/include/boo.hpp \
|
$$PWD/include/boo.hpp \
|
||||||
$$PWD/include/IApplication.hpp \
|
$$PWD/include/IApplication.hpp \
|
||||||
$$PWD/include/windowsys/IWindow.hpp \
|
$$PWD/include/windowsys/IWindow.hpp \
|
||||||
$$PWD/include/windowsys/IGraphicsContext.hpp \
|
|
||||||
$$PWD/include/inputdev/CDolphinSmashAdapter.hpp \
|
$$PWD/include/inputdev/CDolphinSmashAdapter.hpp \
|
||||||
$$PWD/include/inputdev/CRevolutionPad.hpp \
|
$$PWD/include/inputdev/CRevolutionPad.hpp \
|
||||||
$$PWD/include/inputdev/CCafeProPad.hpp \
|
$$PWD/include/inputdev/CCafeProPad.hpp \
|
||||||
@ -13,7 +12,18 @@ HEADERS += \
|
|||||||
$$PWD/include/inputdev/CDeviceBase.hpp \
|
$$PWD/include/inputdev/CDeviceBase.hpp \
|
||||||
$$PWD/include/inputdev/IHIDListener.hpp \
|
$$PWD/include/inputdev/IHIDListener.hpp \
|
||||||
$$PWD/src/inputdev/IHIDDevice.hpp \
|
$$PWD/src/inputdev/IHIDDevice.hpp \
|
||||||
$$PWD/include/inputdev/SDeviceSignature.hpp
|
$$PWD/include/inputdev/SDeviceSignature.hpp \
|
||||||
|
$$PWD/include/windowsys/IGFXCommandBuffer.hpp \
|
||||||
|
$$PWD/include/graphicsys/IGFXCommandBuffer.hpp \
|
||||||
|
$$PWD/include/graphicsys/IGFXContext.hpp \
|
||||||
|
$$PWD/include/graphicsys/IGFXPipelineState.hpp \
|
||||||
|
$$PWD/include/graphicsys/IGFXTransformSet.hpp \
|
||||||
|
$$PWD/include/graphicsys/hecl/CHECLLexer.hpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/IHECLBackend.hpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/HECLExpressions.hpp \
|
||||||
|
$$PWD/include/graphicsys/CGFXVertexLayoutBase.hpp \
|
||||||
|
$$PWD/include/graphicsys/hecl/HECLExpressions.hpp \
|
||||||
|
$$PWD/include/graphicsys/hecl/IHECLBackend.hpp
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/InputDeviceClasses.cpp \
|
$$PWD/InputDeviceClasses.cpp \
|
||||||
@ -23,7 +33,13 @@ SOURCES += \
|
|||||||
$$PWD/src/inputdev/CDualshockPad.cpp \
|
$$PWD/src/inputdev/CDualshockPad.cpp \
|
||||||
$$PWD/src/inputdev/CGenericPad.cpp \
|
$$PWD/src/inputdev/CGenericPad.cpp \
|
||||||
$$PWD/src/inputdev/CDeviceBase.cpp \
|
$$PWD/src/inputdev/CDeviceBase.cpp \
|
||||||
$$PWD/src/inputdev/SDeviceSignature.cpp
|
$$PWD/src/inputdev/SDeviceSignature.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLBackendGLSL.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLBackendHLSL.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLBackendMetal.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLLexer.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLBackendOutline.cpp \
|
||||||
|
$$PWD/src/graphicsys/hecl/CHECLBackendTEV.cpp
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
@ -33,8 +49,8 @@ unix:!macx {
|
|||||||
$$PWD/src/CApplicationUnix.cpp \
|
$$PWD/src/CApplicationUnix.cpp \
|
||||||
$$PWD/src/windowsys/CWindowXCB.cpp \
|
$$PWD/src/windowsys/CWindowXCB.cpp \
|
||||||
$$PWD/src/windowsys/CWindowWayland.cpp \
|
$$PWD/src/windowsys/CWindowWayland.cpp \
|
||||||
$$PWD/src/windowsys/CGraphicsContextXCB.cpp \
|
$$PWD/src/graphicsys/CGraphicsContextXCB.cpp \
|
||||||
$$PWD/src/windowsys/CGraphicsContextWayland.cpp
|
$$PWD/src/graphicsys/CGraphicsContextWayland.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
linux {
|
linux {
|
||||||
@ -61,7 +77,7 @@ win32 {
|
|||||||
$$PWD/src/inputdev/CHIDListenerWinUSB.cpp \
|
$$PWD/src/inputdev/CHIDListenerWinUSB.cpp \
|
||||||
$$PWD/src/inputdev/CHIDDeviceWinUSB.cpp \
|
$$PWD/src/inputdev/CHIDDeviceWinUSB.cpp \
|
||||||
$$PWD/src/windowsys/CWindowWin32.cpp \
|
$$PWD/src/windowsys/CWindowWin32.cpp \
|
||||||
$$PWD/src/windowsys/CGraphicsContextWin32.cpp
|
$$PWD/src/graphicsys/CGraphicsContextWin32.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/include
|
INCLUDEPATH += $$PWD/include
|
||||||
|
@ -274,7 +274,6 @@ public:
|
|||||||
dbus_connection_read_write(m_dbus, 0);
|
dbus_connection_read_write(m_dbus, 0);
|
||||||
while ((msg = dbus_connection_pop_message(m_dbus)))
|
while ((msg = dbus_connection_pop_message(m_dbus)))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* check if the message is a signal from the correct interface and with the correct name */
|
/* check if the message is a signal from the correct interface and with the correct name */
|
||||||
if (dbus_message_is_signal(msg, "boo.signal.FileHandling", "Open"))
|
if (dbus_message_is_signal(msg, "boo.signal.FileHandling", "Open"))
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "windowsys/IGraphicsContext.hpp"
|
#include "graphicsys/IGFXContext.hpp"
|
||||||
#include "windowsys/IWindow.hpp"
|
#include "windowsys/IWindow.hpp"
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
class CGraphicsContextWayland final : public IGraphicsContext
|
class CGraphicsContextWayland final : public IGFXContext
|
||||||
{
|
{
|
||||||
|
|
||||||
EGraphicsAPI m_api;
|
EGraphicsAPI m_api;
|
||||||
@ -52,30 +52,10 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphicsContext* makeShareContext() const
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void makeCurrent()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearCurrent()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void swapBuffer()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IGraphicsContext* _CGraphicsContextWaylandNew(IGraphicsContext::EGraphicsAPI api,
|
IGFXContext* _CGraphicsContextWaylandNew(IGFXContext::EGraphicsAPI api,
|
||||||
IWindow* parentWindow)
|
IWindow* parentWindow)
|
||||||
{
|
{
|
||||||
return new CGraphicsContextWayland(api, parentWindow);
|
return new CGraphicsContextWayland(api, parentWindow);
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
#include "windowsys/IGraphicsContext.hpp"
|
#include "graphicsys/IGFXContext.hpp"
|
||||||
#include "windowsys/IWindow.hpp"
|
#include "windowsys/IWindow.hpp"
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
@ -7,11 +7,12 @@
|
|||||||
#include <GL/glcorearb.h>
|
#include <GL/glcorearb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace boo
|
namespace boo
|
||||||
{
|
{
|
||||||
|
|
||||||
class CGraphicsContextXCB final : public IGraphicsContext
|
class CGraphicsContextXCB final : public IGFXContext
|
||||||
{
|
{
|
||||||
|
|
||||||
EGraphicsAPI m_api;
|
EGraphicsAPI m_api;
|
||||||
@ -24,6 +25,8 @@ class CGraphicsContextXCB final : public IGraphicsContext
|
|||||||
xcb_glx_window_t m_glxWindow = 0;
|
xcb_glx_window_t m_glxWindow = 0;
|
||||||
xcb_glx_context_t m_glxCtx = 0;
|
xcb_glx_context_t m_glxCtx = 0;
|
||||||
xcb_glx_context_tag_t m_glxCtxTag = 0;
|
xcb_glx_context_tag_t m_glxCtxTag = 0;
|
||||||
|
|
||||||
|
std::thread* m_commandThread = NULL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IWindowCallback* m_callback;
|
IWindowCallback* m_callback;
|
||||||
@ -34,6 +37,7 @@ public:
|
|||||||
m_parentWindow(parentWindow),
|
m_parentWindow(parentWindow),
|
||||||
m_xcbConn(conn)
|
m_xcbConn(conn)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* WTF freedesktop?? Fix this awful API and your nonexistant docs */
|
/* WTF freedesktop?? Fix this awful API and your nonexistant docs */
|
||||||
xcb_glx_get_fb_configs_reply_t* fbconfigs =
|
xcb_glx_get_fb_configs_reply_t* fbconfigs =
|
||||||
xcb_glx_get_fb_configs_reply(m_xcbConn, xcb_glx_get_fb_configs(m_xcbConn, 0), NULL);
|
xcb_glx_get_fb_configs_reply(m_xcbConn, xcb_glx_get_fb_configs(m_xcbConn, 0), NULL);
|
||||||
@ -137,36 +141,11 @@ public:
|
|||||||
m_glxWindow, 0, NULL);
|
m_glxWindow, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphicsContext* makeShareContext() const
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void makeCurrent()
|
|
||||||
{
|
|
||||||
xcb_glx_make_context_current_reply_t* reply =
|
|
||||||
xcb_glx_make_context_current_reply(m_xcbConn,
|
|
||||||
xcb_glx_make_context_current(m_xcbConn, 0, m_glxWindow, m_glxWindow, m_glxCtx), NULL);
|
|
||||||
m_glxCtxTag = reply->context_tag;
|
|
||||||
free(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearCurrent()
|
|
||||||
{
|
|
||||||
xcb_glx_make_context_current(m_xcbConn, m_glxCtxTag, m_glxWindow, m_glxWindow, 0);
|
|
||||||
m_glxCtxTag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void swapBuffer()
|
|
||||||
{
|
|
||||||
xcb_glx_swap_buffers(m_xcbConn, m_glxCtxTag, m_glxWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IGraphicsContext* _CGraphicsContextXCBNew(IGraphicsContext::EGraphicsAPI api,
|
IGFXContext* _CGraphicsContextXCBNew(IGFXContext::EGraphicsAPI api,
|
||||||
IWindow* parentWindow, xcb_connection_t* conn,
|
IWindow* parentWindow, xcb_connection_t* conn,
|
||||||
uint32_t& visualIdOut)
|
uint32_t& visualIdOut)
|
||||||
{
|
{
|
||||||
return new CGraphicsContextXCB(api, parentWindow, conn, visualIdOut);
|
return new CGraphicsContextXCB(api, parentWindow, conn, visualIdOut);
|
||||||
}
|
}
|
32
src/graphicsys/hecl/CHECLBackendGLSL.cpp
Normal file
32
src/graphicsys/hecl/CHECLBackendGLSL.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "graphicsys/hecl/IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class CHECLBackendGLSL : public IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendGLSL(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return GLSL;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendGLSL(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendGLSL(lexer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CHECLBackendGLSLCafe final : public CHECLBackendGLSL
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendGLSLCafe(const CHECLLexer& lexer)
|
||||||
|
: CHECLBackendGLSL(lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return GLSL_CAFE;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendGLSLCafe(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendGLSLCafe(lexer);
|
||||||
|
}
|
||||||
|
|
15
src/graphicsys/hecl/CHECLBackendHLSL.cpp
Normal file
15
src/graphicsys/hecl/CHECLBackendHLSL.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "graphicsys/hecl/IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class CHECLBackendHLSL final : public IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendHLSL(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return HLSL;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendHLSL(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendHLSL(lexer);
|
||||||
|
}
|
15
src/graphicsys/hecl/CHECLBackendMetal.cpp
Normal file
15
src/graphicsys/hecl/CHECLBackendMetal.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "graphicsys/hecl/IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class CHECLBackendMetal final : public IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendMetal(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return METAL;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendMetal(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendMetal(lexer);
|
||||||
|
}
|
16
src/graphicsys/hecl/CHECLBackendOutline.cpp
Normal file
16
src/graphicsys/hecl/CHECLBackendOutline.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "graphicsys/hecl/IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class CHECLBackendOutline final : public IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendOutline(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return OUTLINE;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendOutline(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendOutline(lexer);
|
||||||
|
}
|
||||||
|
|
15
src/graphicsys/hecl/CHECLBackendTEV.cpp
Normal file
15
src/graphicsys/hecl/CHECLBackendTEV.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "graphicsys/hecl/IHECLBackend.hpp"
|
||||||
|
|
||||||
|
class CHECLBackendTEV final : public IHECLBackend
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHECLBackendTEV(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Type getType() const {return TEV;}
|
||||||
|
};
|
||||||
|
|
||||||
|
IHECLBackend* NewHECLBackendTEV(const CHECLLexer& lexer)
|
||||||
|
{
|
||||||
|
return new CHECLBackendTEV(lexer);
|
||||||
|
}
|
14
src/graphicsys/hecl/CHECLLexer.cpp
Normal file
14
src/graphicsys/hecl/CHECLLexer.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "graphicsys/hecl/CHECLLexer.hpp"
|
||||||
|
|
||||||
|
CHECLLexer::CHECLLexer(const CGFXVertexLayoutBase& vertLayout,
|
||||||
|
const std::string& colorHECL)
|
||||||
|
: m_vertLayout(vertLayout)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECLLexer::CHECLLexer(const CGFXVertexLayoutBase& vertLayout,
|
||||||
|
const std::string& colorHECL,
|
||||||
|
const std::string& alphaHECL)
|
||||||
|
: m_vertLayout(vertLayout)
|
||||||
|
{
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#include "windowsys/IWindow.hpp"
|
#include "windowsys/IWindow.hpp"
|
||||||
#include "windowsys/IGraphicsContext.hpp"
|
#include "graphicsys/IGFXContext.hpp"
|
||||||
#include "IApplication.hpp"
|
#include "IApplication.hpp"
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
@ -145,15 +145,15 @@ static void genFrameDefault(xcb_screen_t* screen, int* xOut, int* yOut, int* wOu
|
|||||||
*hOut = height;
|
*hOut = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGraphicsContext* _CGraphicsContextXCBNew(IGraphicsContext::EGraphicsAPI api,
|
IGFXContext* _CGraphicsContextXCBNew(IGFXContext::EGraphicsAPI api,
|
||||||
IWindow* parentWindow, xcb_connection_t* conn,
|
IWindow* parentWindow, xcb_connection_t* conn,
|
||||||
uint32_t& visualIdOut);
|
uint32_t& visualIdOut);
|
||||||
|
|
||||||
class CWindowXCB final : public IWindow
|
class CWindowXCB final : public IWindow
|
||||||
{
|
{
|
||||||
xcb_connection_t* m_xcbConn;
|
xcb_connection_t* m_xcbConn;
|
||||||
xcb_window_t m_windowId;
|
xcb_window_t m_windowId;
|
||||||
IGraphicsContext* m_gfxCtx;
|
IGFXContext* m_gfxCtx;
|
||||||
IWindowCallback* m_callback;
|
IWindowCallback* m_callback;
|
||||||
|
|
||||||
/* Last known input device id (0xffff if not yet set) */
|
/* Last known input device id (0xffff if not yet set) */
|
||||||
@ -184,7 +184,7 @@ public:
|
|||||||
|
|
||||||
/* Construct graphics context */
|
/* Construct graphics context */
|
||||||
uint32_t visualId;
|
uint32_t visualId;
|
||||||
m_gfxCtx = _CGraphicsContextXCBNew(IGraphicsContext::API_OPENGL_3_3, this, m_xcbConn, visualId);
|
m_gfxCtx = _CGraphicsContextXCBNew(IGFXContext::API_OPENGL_3_3, this, m_xcbConn, visualId);
|
||||||
|
|
||||||
/* Create colormap */
|
/* Create colormap */
|
||||||
xcb_colormap_t colormap = xcb_generate_id(m_xcbConn);
|
xcb_colormap_t colormap = xcb_generate_id(m_xcbConn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user