mirror of https://github.com/auygun/kaliber.git
Remove OpenGL threaded rendering
This commit is contained in:
parent
b07ce8514e
commit
ce440f2913
|
@ -1,7 +1,2 @@
|
||||||
BasedOnStyle: Chromium
|
BasedOnStyle: Chromium
|
||||||
Standard: Cpp11
|
Standard: Cpp11
|
||||||
|
|
||||||
MacroBlockBegin: "^\
|
|
||||||
RENDER_COMMAND_BEGIN$"
|
|
||||||
MacroBlockEnd: "^\
|
|
||||||
RENDER_COMMAND_END$"
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ add_library(kaliber SHARED
|
||||||
../../../src/engine/platform/asset_file.cc
|
../../../src/engine/platform/asset_file.cc
|
||||||
../../../src/engine/platform/platform_android.cc
|
../../../src/engine/platform/platform_android.cc
|
||||||
../../../src/engine/renderer/geometry.cc
|
../../../src/engine/renderer/geometry.cc
|
||||||
../../../src/engine/renderer/opengl/render_command.cc
|
|
||||||
../../../src/engine/renderer/opengl/renderer_opengl_android.cc
|
../../../src/engine/renderer/opengl/renderer_opengl_android.cc
|
||||||
../../../src/engine/renderer/opengl/renderer_opengl.cc
|
../../../src/engine/renderer/opengl/renderer_opengl.cc
|
||||||
../../../src/engine/renderer/renderer_types.cc
|
../../../src/engine/renderer/renderer_types.cc
|
||||||
|
|
|
@ -111,7 +111,6 @@ ENGINE_SRC := \
|
||||||
$(SRC_ROOT)/engine/platform/asset_file.cc \
|
$(SRC_ROOT)/engine/platform/asset_file.cc \
|
||||||
$(SRC_ROOT)/engine/platform/platform_linux.cc \
|
$(SRC_ROOT)/engine/platform/platform_linux.cc \
|
||||||
$(SRC_ROOT)/engine/renderer/geometry.cc \
|
$(SRC_ROOT)/engine/renderer/geometry.cc \
|
||||||
$(SRC_ROOT)/engine/renderer/opengl/render_command.cc \
|
|
||||||
$(SRC_ROOT)/engine/renderer/opengl/renderer_opengl_linux.cc \
|
$(SRC_ROOT)/engine/renderer/opengl/renderer_opengl_linux.cc \
|
||||||
$(SRC_ROOT)/engine/renderer/opengl/renderer_opengl.cc \
|
$(SRC_ROOT)/engine/renderer/opengl/renderer_opengl.cc \
|
||||||
$(SRC_ROOT)/engine/renderer/renderer_types.cc \
|
$(SRC_ROOT)/engine/renderer/renderer_types.cc \
|
||||||
|
|
|
@ -25,8 +25,6 @@ Platform::Platform() {
|
||||||
shared_data_path_ = "./";
|
shared_data_path_ = "./";
|
||||||
LOG << "Shared data path: " << shared_data_path_.c_str();
|
LOG << "Shared data path: " << shared_data_path_.c_str();
|
||||||
|
|
||||||
XInitThreads();
|
|
||||||
|
|
||||||
bool res = CreateWindow(800, 1205);
|
bool res = CreateWindow(800, 1205);
|
||||||
CHECK(res) << "Failed to create window.";
|
CHECK(res) << "Failed to create window.";
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
#include "engine/renderer/opengl/render_command.h"
|
|
||||||
|
|
||||||
#include "engine/asset/image.h"
|
|
||||||
#include "engine/asset/mesh.h"
|
|
||||||
#include "engine/asset/shader_source.h"
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define RENDER_COMMAND_IMPL(NAME, GLOBAL) \
|
|
||||||
NAME::NAME() : RenderCommand(CMD_ID, GLOBAL, #NAME) {}
|
|
||||||
#else
|
|
||||||
#define RENDER_COMMAND_IMPL(NAME, GLOBAL) \
|
|
||||||
NAME::NAME() : RenderCommand(CMD_ID, GLOBAL) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace eng {
|
|
||||||
|
|
||||||
RENDER_COMMAND_IMPL(CmdPresent, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdInvalidateAllResources, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdCreateTexture, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdUpdateTexture, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdDestoryTexture, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdActivateTexture, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdCreateGeometry, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdDestroyGeometry, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdDrawGeometry, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdCreateShader, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdDestroyShader, true);
|
|
||||||
RENDER_COMMAND_IMPL(CmdActivateShader, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformVec2, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformVec3, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformVec4, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformMat4, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformInt, false);
|
|
||||||
RENDER_COMMAND_IMPL(CmdSetUniformFloat, false);
|
|
||||||
|
|
||||||
} // namespace eng
|
|
|
@ -1,139 +0,0 @@
|
||||||
#ifndef ENGINE_RENDERER_OPENGL_RENDER_COMMAND_H
|
|
||||||
#define ENGINE_RENDERER_OPENGL_RENDER_COMMAND_H
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "base/hash.h"
|
|
||||||
#include "base/vecmath.h"
|
|
||||||
#include "engine/renderer/renderer_types.h"
|
|
||||||
|
|
||||||
namespace eng {
|
|
||||||
|
|
||||||
class Image;
|
|
||||||
class ShaderSource;
|
|
||||||
class Mesh;
|
|
||||||
|
|
||||||
#define RENDER_COMMAND_BEGIN(NAME) \
|
|
||||||
struct NAME : RenderCommand { \
|
|
||||||
static constexpr CommandId CMD_ID = base::Hash(#NAME); \
|
|
||||||
NAME();
|
|
||||||
#define RENDER_COMMAND_END \
|
|
||||||
} \
|
|
||||||
;
|
|
||||||
|
|
||||||
struct RenderCommand {
|
|
||||||
using CommandId = size_t;
|
|
||||||
static constexpr CommandId INVALID_CMD_ID = 0;
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
RenderCommand(CommandId id, bool g, const char* name)
|
|
||||||
: cmd_id(id), global(g), cmd_name(name) {}
|
|
||||||
#else
|
|
||||||
RenderCommand(CommandId id, bool g) : cmd_id(id), global(g) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual ~RenderCommand() = default;
|
|
||||||
|
|
||||||
const CommandId cmd_id = INVALID_CMD_ID;
|
|
||||||
|
|
||||||
// Global render commands are guaranteed to be processed. Others commands are
|
|
||||||
// frame specific and can be discared by the renderer if not throttled.
|
|
||||||
const bool global = false;
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
std::string cmd_name;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdPresent)
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdInvalidateAllResources)
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdCreateTexture)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdUpdateTexture)
|
|
||||||
std::unique_ptr<Image> image;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdDestoryTexture)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdActivateTexture)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdCreateGeometry)
|
|
||||||
std::unique_ptr<Mesh> mesh;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdDestroyGeometry)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdDrawGeometry)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdCreateShader)
|
|
||||||
std::unique_ptr<ShaderSource> source;
|
|
||||||
VertexDescription vertex_description;
|
|
||||||
uint64_t resource_id;
|
|
||||||
bool enable_depth_test;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdDestroyShader)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdActivateShader)
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformVec2)
|
|
||||||
std::string name;
|
|
||||||
base::Vector2f v;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformVec3)
|
|
||||||
std::string name;
|
|
||||||
base::Vector3f v;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformVec4)
|
|
||||||
std::string name;
|
|
||||||
base::Vector4f v;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformMat4)
|
|
||||||
std::string name;
|
|
||||||
base::Matrix4f m;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformInt)
|
|
||||||
std::string name;
|
|
||||||
int i;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
RENDER_COMMAND_BEGIN(CmdSetUniformFloat)
|
|
||||||
std::string name;
|
|
||||||
float f;
|
|
||||||
uint64_t resource_id;
|
|
||||||
RENDER_COMMAND_END
|
|
||||||
|
|
||||||
} // namespace eng
|
|
||||||
|
|
||||||
#endif // ENGINE_RENDERER_OPENGL_RENDER_COMMAND_H
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,35 +6,15 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define THREADED_RENDERING
|
|
||||||
|
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <deque>
|
|
||||||
#include <future>
|
|
||||||
#include <mutex>
|
|
||||||
#include <semaphore>
|
|
||||||
#include <thread>
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
|
|
||||||
#include "engine/renderer/opengl/opengl.h"
|
#include "engine/renderer/opengl/opengl.h"
|
||||||
|
|
||||||
#include "engine/renderer/renderer.h"
|
#include "engine/renderer/renderer.h"
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
struct ANativeWindow;
|
struct ANativeWindow;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
namespace base {
|
|
||||||
class TaskRunner;
|
|
||||||
}
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
|
|
||||||
namespace eng {
|
namespace eng {
|
||||||
|
|
||||||
struct RenderCommand;
|
|
||||||
|
|
||||||
class RendererOpenGL final : public Renderer {
|
class RendererOpenGL final : public Renderer {
|
||||||
public:
|
public:
|
||||||
RendererOpenGL(base::Closure context_lost_cb);
|
RendererOpenGL(base::Closure context_lost_cb);
|
||||||
|
@ -113,13 +93,9 @@ class RendererOpenGL final : public Renderer {
|
||||||
bool enable_depth_test = false;
|
bool enable_depth_test = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TextureOpenGL {
|
|
||||||
GLuint id = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::unordered_map<uint64_t, GeometryOpenGL> geometries_;
|
std::unordered_map<uint64_t, GeometryOpenGL> geometries_;
|
||||||
std::unordered_map<uint64_t, ShaderOpenGL> shaders_;
|
std::unordered_map<uint64_t, ShaderOpenGL> shaders_;
|
||||||
std::unordered_map<uint64_t, TextureOpenGL> textures_;
|
std::unordered_map<uint64_t, GLuint> textures_;
|
||||||
uint64_t last_resource_id_ = 0;
|
uint64_t last_resource_id_ = 0;
|
||||||
|
|
||||||
GLuint active_shader_id_ = 0;
|
GLuint active_shader_id_ = 0;
|
||||||
|
@ -130,23 +106,6 @@ class RendererOpenGL final : public Renderer {
|
||||||
|
|
||||||
bool is_initialized_ = false;
|
bool is_initialized_ = false;
|
||||||
|
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
// Global commands are independent from frames and guaranteed to be processed.
|
|
||||||
std::deque<std::unique_ptr<RenderCommand>> global_commands_;
|
|
||||||
// Draw commands are fame specific and can be discarded if the rendering is
|
|
||||||
// not throttled.
|
|
||||||
std::deque<std::unique_ptr<RenderCommand>> draw_commands_[2];
|
|
||||||
|
|
||||||
std::condition_variable cv_;
|
|
||||||
std::mutex mutex_;
|
|
||||||
std::thread render_thread_;
|
|
||||||
bool terminate_render_thread_ = false;
|
|
||||||
|
|
||||||
std::counting_semaphore<> draw_complete_semaphore_{0};
|
|
||||||
|
|
||||||
std::shared_ptr<base::TaskRunner> main_thread_task_runner_;
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
|
|
||||||
// Stats.
|
// Stats.
|
||||||
size_t fps_ = 0;
|
size_t fps_ = 0;
|
||||||
|
|
||||||
|
@ -158,43 +117,12 @@ class RendererOpenGL final : public Renderer {
|
||||||
GLXContext glx_context_ = NULL;
|
GLXContext glx_context_ = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool InitInternal();
|
|
||||||
bool InitCommon();
|
bool InitCommon();
|
||||||
void ShutdownInternal();
|
void ShutdownInternal();
|
||||||
|
|
||||||
void OnDestroy();
|
void OnDestroy();
|
||||||
|
|
||||||
void ContextLost();
|
void ContextLost();
|
||||||
|
|
||||||
void DestroyAllResources();
|
void DestroyAllResources();
|
||||||
|
|
||||||
bool StartRenderThread();
|
|
||||||
|
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
void RenderThreadMain(std::promise<bool> promise);
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
|
|
||||||
void EnqueueCommand(std::unique_ptr<RenderCommand> cmd);
|
|
||||||
void ProcessCommand(RenderCommand* cmd);
|
|
||||||
|
|
||||||
void HandleCmdPresent(RenderCommand* cmd);
|
|
||||||
void HandleCmdCreateTexture(RenderCommand* cmd);
|
|
||||||
void HandleCmdUpdateTexture(RenderCommand* cmd);
|
|
||||||
void HandleCmdDestoryTexture(RenderCommand* cmd);
|
|
||||||
void HandleCmdActivateTexture(RenderCommand* cmd);
|
|
||||||
void HandleCmdCreateGeometry(RenderCommand* cmd);
|
|
||||||
void HandleCmdDestroyGeometry(RenderCommand* cmd);
|
|
||||||
void HandleCmdDrawGeometry(RenderCommand* cmd);
|
|
||||||
void HandleCmdCreateShader(RenderCommand* cmd);
|
|
||||||
void HandleCmdDestroyShader(RenderCommand* cmd);
|
|
||||||
void HandleCmdActivateShader(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformVec2(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformVec3(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformVec4(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformMat4(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformFloat(RenderCommand* cmd);
|
|
||||||
void HandleCmdSetUniformInt(RenderCommand* cmd);
|
|
||||||
|
|
||||||
void BindTexture(GLuint id);
|
void BindTexture(GLuint id);
|
||||||
bool SetupVertexLayout(const VertexDescription& vd,
|
bool SetupVertexLayout(const VertexDescription& vd,
|
||||||
GLuint vertex_size,
|
GLuint vertex_size,
|
||||||
|
|
|
@ -12,14 +12,6 @@ bool RendererOpenGL::Initialize(Platform* platform) {
|
||||||
LOG << "Initializing renderer.";
|
LOG << "Initializing renderer.";
|
||||||
|
|
||||||
window_ = platform->GetWindow();
|
window_ = platform->GetWindow();
|
||||||
return StartRenderThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererOpenGL::OnDestroy() {
|
|
||||||
ndk_helper::GLContext::GetInstance()->Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RendererOpenGL::InitInternal() {
|
|
||||||
ndk_helper::GLContext* gl_context = ndk_helper::GLContext::GetInstance();
|
ndk_helper::GLContext* gl_context = ndk_helper::GLContext::GetInstance();
|
||||||
|
|
||||||
if (!gl_context->IsInitialzed()) {
|
if (!gl_context->IsInitialzed()) {
|
||||||
|
@ -48,21 +40,23 @@ bool RendererOpenGL::InitInternal() {
|
||||||
return InitCommon();
|
return InitCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RendererOpenGL::OnDestroy() {
|
||||||
|
ndk_helper::GLContext::GetInstance()->Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
void RendererOpenGL::ShutdownInternal() {
|
void RendererOpenGL::ShutdownInternal() {
|
||||||
ndk_helper::GLContext::GetInstance()->Suspend();
|
ndk_helper::GLContext::GetInstance()->Suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererOpenGL::HandleCmdPresent(RenderCommand* cmd) {
|
void RendererOpenGL::Present() {
|
||||||
if (EGL_SUCCESS != ndk_helper::GLContext::GetInstance()->Swap()) {
|
if (EGL_SUCCESS != ndk_helper::GLContext::GetInstance()->Swap()) {
|
||||||
ContextLost();
|
ContextLost();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
draw_complete_semaphore_.release();
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
active_shader_id_ = 0;
|
active_shader_id_ = 0;
|
||||||
active_texture_id_ = 0;
|
active_texture_id_ = 0;
|
||||||
|
fps_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace eng
|
} // namespace eng
|
||||||
|
|
|
@ -16,12 +16,6 @@ bool RendererOpenGL::Initialize(Platform* platform) {
|
||||||
screen_width_ = xwa.width;
|
screen_width_ = xwa.width;
|
||||||
screen_height_ = xwa.height;
|
screen_height_ = xwa.height;
|
||||||
|
|
||||||
return StartRenderThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererOpenGL::OnDestroy() {}
|
|
||||||
|
|
||||||
bool RendererOpenGL::InitInternal() {
|
|
||||||
GLint glx_attributes[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER,
|
GLint glx_attributes[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER,
|
||||||
None};
|
None};
|
||||||
XVisualInfo* visual_info = glXChooseVisual(display_, 0, glx_attributes);
|
XVisualInfo* visual_info = glXChooseVisual(display_, 0, glx_attributes);
|
||||||
|
@ -41,6 +35,8 @@ bool RendererOpenGL::InitInternal() {
|
||||||
return InitCommon();
|
return InitCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RendererOpenGL::OnDestroy() {}
|
||||||
|
|
||||||
void RendererOpenGL::ShutdownInternal() {
|
void RendererOpenGL::ShutdownInternal() {
|
||||||
if (display_ && glx_context_) {
|
if (display_ && glx_context_) {
|
||||||
glXMakeCurrent(display_, None, NULL);
|
glXMakeCurrent(display_, None, NULL);
|
||||||
|
@ -49,16 +45,12 @@ void RendererOpenGL::ShutdownInternal() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererOpenGL::HandleCmdPresent(RenderCommand* cmd) {
|
void RendererOpenGL::Present() {
|
||||||
if (display_) {
|
|
||||||
glXSwapBuffers(display_, window_);
|
glXSwapBuffers(display_, window_);
|
||||||
#ifdef THREADED_RENDERING
|
|
||||||
draw_complete_semaphore_.release();
|
|
||||||
#endif // THREADED_RENDERING
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
active_shader_id_ = 0;
|
active_shader_id_ = 0;
|
||||||
active_texture_id_ = 0;
|
active_texture_id_ = 0;
|
||||||
}
|
fps_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace eng
|
} // namespace eng
|
||||||
|
|
|
@ -14,7 +14,7 @@ const char kLayoutDelimiter[] = ";/ \t";
|
||||||
|
|
||||||
namespace eng {
|
namespace eng {
|
||||||
|
|
||||||
bool ParseVertexDescription(std::string vd_str, VertexDescription& out) {
|
bool ParseVertexDescription(const std::string& vd_str, VertexDescription& out) {
|
||||||
// Parse the description.
|
// Parse the description.
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
strcpy(buffer, vd_str.c_str());
|
strcpy(buffer, vd_str.c_str());
|
||||||
|
|
|
@ -41,7 +41,7 @@ using DataTypeSize = size_t;
|
||||||
using VertexDescription =
|
using VertexDescription =
|
||||||
std::vector<std::tuple<AttribType, DataType, ElementCount, DataTypeSize>>;
|
std::vector<std::tuple<AttribType, DataType, ElementCount, DataTypeSize>>;
|
||||||
|
|
||||||
bool ParseVertexDescription(std::string vd_str, VertexDescription& out);
|
bool ParseVertexDescription(const std::string& vd_str, VertexDescription& out);
|
||||||
|
|
||||||
} // namespace eng
|
} // namespace eng
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue