mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-16 08:27:10 +00:00
refactor of graphic system; initial HECL
This commit is contained in:
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
|
||||
#define IGRAPHICSCONTEXT_HPP
|
||||
#ifndef IGFXCONTEXT_HPP
|
||||
#define IGFXCONTEXT_HPP
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
class IGraphicsContext
|
||||
class IGFXContext
|
||||
{
|
||||
friend class CWindowCocoa;
|
||||
virtual void _setCallback(class IWindowCallback* cb) {(void)cb;};
|
||||
friend class CWindowXCB;
|
||||
virtual void _setCallback(class IWindowCallback* cb) {(void)cb;}
|
||||
|
||||
public:
|
||||
|
||||
@@ -33,22 +34,15 @@ public:
|
||||
PF_RGBAF32_Z24 = 4
|
||||
};
|
||||
|
||||
virtual ~IGraphicsContext() {}
|
||||
virtual ~IGFXContext() {}
|
||||
|
||||
virtual EGraphicsAPI getAPI() const=0;
|
||||
virtual EPixelFormat getPixelFormat() const=0;
|
||||
virtual void setPixelFormat(EPixelFormat pf)=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
|
||||
Reference in New Issue
Block a user