mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-18 18:11:28 +00:00
WIP: hwr2 renderer stuff
This commit is contained in:
parent
c61fef0e0d
commit
0baa2c2843
10 changed files with 157 additions and 0 deletions
|
@ -96,3 +96,5 @@ lua_polyobjlib.c
|
|||
lua_blockmaplib.c
|
||||
lua_hudlib.c
|
||||
lua_inputlib.c
|
||||
|
||||
hwr2/gles2/renderer.cpp
|
||||
|
|
|
@ -164,7 +164,11 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
|||
#define true TRUE
|
||||
#define boolean BOOL
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
typedef enum {false, true} boolean;
|
||||
#else
|
||||
typedef int32_t boolean;
|
||||
#endif
|
||||
#endif
|
||||
#endif // __BYTEBOOL__
|
||||
|
||||
|
|
32
src/hwr2/gles2/renderer.cpp
Normal file
32
src/hwr2/gles2/renderer.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "renderer.hpp"
|
||||
|
||||
Gles2Renderer::~Gles2Renderer()
|
||||
{
|
||||
}
|
||||
|
||||
IGraphicsContext* Gles2Renderer::BeginGraphics()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Gles2Renderer::EndGraphics(IGraphicsContext* context)
|
||||
{
|
||||
}
|
||||
|
||||
ITransferContext* Gles2Renderer::BeginTransfer()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Gles2Renderer::EndTransfer(ITransferContext* context)
|
||||
{
|
||||
}
|
||||
|
||||
GraphicsPipeline* Gles2Renderer::CreateGraphicsPipeline(const GraphicsPipelineInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Gles2Renderer::DestroyGraphicsPipeline(GraphicsPipeline* pipeline)
|
||||
{
|
||||
}
|
21
src/hwr2/gles2/renderer.hpp
Normal file
21
src/hwr2/gles2/renderer.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef __HWR2_GLES2_RENDERER_HPP__
|
||||
#define __HWR2_GLES2_RENDERER_HPP__
|
||||
|
||||
#include "../renderer.h"
|
||||
|
||||
class Gles2Renderer : public IRenderer {
|
||||
public:
|
||||
~Gles2Renderer();
|
||||
|
||||
virtual IGraphicsContext* BeginGraphics();
|
||||
virtual void EndGraphics(IGraphicsContext* context);
|
||||
virtual ITransferContext* BeginTransfer();
|
||||
virtual void EndTransfer(ITransferContext* context);
|
||||
|
||||
virtual GraphicsPipeline* CreateGraphicsPipeline(const GraphicsPipelineInfo& info);
|
||||
virtual void DestroyGraphicsPipeline(GraphicsPipeline* pipeline);
|
||||
|
||||
virtual void Present() = 0;
|
||||
};
|
||||
|
||||
#endif
|
13
src/hwr2/graphics_context.hpp
Normal file
13
src/hwr2/graphics_context.hpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef __HWR2_GRAPHICS_CONTEXT_HPP__
|
||||
#define __HWR2_GRAPHICS_CONTEXT_HPP__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class IGraphicsContext {
|
||||
protected:
|
||||
~IGraphicsContext() {}
|
||||
public:
|
||||
virtual void Draw(int32_t vertices) = 0;
|
||||
};
|
||||
|
||||
#endif // __HWR2_GRAPHICS_CONTEXT_HPP__
|
51
src/hwr2/renderer.h
Normal file
51
src/hwr2/renderer.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef __HWR2_RENDERER_H__
|
||||
#define __HWR2_RENDERER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "graphics_context.hpp"
|
||||
#include "transfer_context.hpp"
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// A C-side handle to a HWR2 rendere instance.
|
||||
typedef void* hwr2renderer_h;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
struct GraphicsPipeline {
|
||||
uint32_t foo;
|
||||
};
|
||||
|
||||
struct GraphicsPipelineInfo {
|
||||
uint32_t foo;
|
||||
};
|
||||
|
||||
/// A class which implements functionality for rendering.
|
||||
class IRenderer {
|
||||
protected:
|
||||
~IRenderer() {}
|
||||
public:
|
||||
virtual IGraphicsContext* BeginGraphics() = 0;
|
||||
virtual void EndGraphics(IGraphicsContext* context) = 0;
|
||||
virtual ITransferContext* BeginTransfer() = 0;
|
||||
virtual void EndTransfer(ITransferContext* context) = 0;
|
||||
|
||||
virtual GraphicsPipeline* CreateGraphicsPipeline(const GraphicsPipelineInfo& info) = 0;
|
||||
virtual void DestroyGraphicsPipeline(GraphicsPipeline* pipeline) = 0;
|
||||
|
||||
virtual void Present() = 0;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __HWR2_RENDERER_H__
|
9
src/hwr2/transfer_context.hpp
Normal file
9
src/hwr2/transfer_context.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef __HWR2_TRANSFER_CONTEXT_HPP__
|
||||
#define __HWR2_TRANSFER_CONTEXT_HPP__
|
||||
|
||||
class ITransferContext {
|
||||
protected:
|
||||
~ITransferContext() {}
|
||||
};
|
||||
|
||||
#endif // __HWR2_TRANSFER_CONTEXT_HPP__
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
|
||||
#include "hwr2/renderer.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
@ -154,4 +156,9 @@ void I_BeginRead(void);
|
|||
*/
|
||||
void I_EndRead(void);
|
||||
|
||||
/** \brief Get the current Hardware Renderer instance handle.
|
||||
* \return NULL if HWR2 is not active or failed to initialize.
|
||||
*/
|
||||
hwr2renderer_h I_GetHwr2Renderer(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,3 +5,4 @@ i_video.c
|
|||
dosstr.c
|
||||
endtxt.c
|
||||
hwsym_sdl.c
|
||||
i_video_hwr2.cpp
|
||||
|
|
17
src/sdl/i_video_hwr2.cpp
Normal file
17
src/sdl/i_video_hwr2.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
extern "C" {
|
||||
#include "../i_video.h"
|
||||
}
|
||||
|
||||
#include "../hwr2/gles2/renderer.hpp"
|
||||
|
||||
class Sdl2Gles2Renderer : public Gles2Renderer
|
||||
{
|
||||
public:
|
||||
virtual void Present()
|
||||
{}
|
||||
};
|
||||
|
||||
hwr2renderer_h I_GetHwr2Renderer()
|
||||
{
|
||||
return reinterpret_cast<hwr2renderer_h>(new Sdl2Gles2Renderer());
|
||||
}
|
Loading…
Reference in a new issue