Latest TB.
This commit is contained in:
parent
fcdd15d157
commit
f2ce11d268
|
@ -9,7 +9,7 @@
|
|||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)third_party\flatbuffers\include\;$(SolutionDir)third_party\gflags\src\;$(SolutionDir)src\;$(SolutionDir)third_party;$(SolutionDir)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)third_party\flatbuffers\include\;$(SolutionDir)third_party\turbobadger\src\;$(SolutionDir)third_party\gflags\src\;$(SolutionDir)src\;$(SolutionDir)third_party;$(SolutionDir)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GLEW_STATIC=1;GLEW_MX=1;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;WIN32;_WIN64=1;_AMD64=1;MICROPROFILE_MAX_THREADS=128;CAPSTONE_X86_ATT_DISABLE;CAPSTONE_DIET_NO;CAPSTONE_X86_REDUCE_NO;CAPSTONE_HAS_X86;CAPSTONE_USE_SYS_DYN_MEM;XBYAK_NO_OP_NAMES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
#include "xenia/debug/ui/main_window.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#include "third_party/turbobadger/src/tb/tb_msg.h"
|
||||
#include "third_party/turbobadger/src/tb/tb_system.h"
|
||||
#include "third_party/turbobadger/src/tb/message_handler.h"
|
||||
#include "third_party/turbobadger/src/tb/util/metrics.h"
|
||||
#include "third_party/turbobadger/src/tb/util/timer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace debug {
|
||||
|
@ -81,16 +82,16 @@ void Application::Quit() {
|
|||
|
||||
// This doesn't really belong here (it belongs in tb_system_[linux/windows].cpp.
|
||||
// This is here since the proper implementations has not yet been done.
|
||||
void tb::TBSystem::RescheduleTimer(uint64_t fire_time) {
|
||||
if (fire_time == tb::kNotSoon) {
|
||||
void tb::util::RescheduleTimer(uint64_t fire_time) {
|
||||
if (fire_time == tb::MessageHandler::kNotSoon) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t now = tb::TBSystem::GetTimeMS();
|
||||
uint64_t now = tb::util::GetTimeMS();
|
||||
uint64_t delay_millis = fire_time >= now ? fire_time - now : 0;
|
||||
xe::debug::ui::Application::current()->loop()->PostDelayed([]() {
|
||||
uint64_t next_fire_time = tb::MessageHandler::GetNextMessageFireTime();
|
||||
uint64_t now = tb::TBSystem::GetTimeMS();
|
||||
uint64_t now = tb::util::GetTimeMS();
|
||||
if (now < next_fire_time) {
|
||||
// We timed out *before* we were supposed to (the OS is not playing nice).
|
||||
// Calling ProcessMessages now won't achieve a thing so force a reschedule
|
||||
|
@ -104,6 +105,6 @@ void tb::TBSystem::RescheduleTimer(uint64_t fire_time) {
|
|||
// If we still have things to do (because we didn't process all messages,
|
||||
// or because there are new messages), we need to rescedule, so call
|
||||
// RescheduleTimer.
|
||||
tb::TBSystem::RescheduleTimer(tb::MessageHandler::GetNextMessageFireTime());
|
||||
tb::util::RescheduleTimer(tb::MessageHandler::GetNextMessageFireTime());
|
||||
}, delay_millis);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,8 +15,7 @@
|
|||
#include "xenia/ui/gl/wgl_control.h"
|
||||
#include "xenia/ui/loop.h"
|
||||
|
||||
#include "third_party/turbobadger/src/tb/tb_core.h"
|
||||
#include "third_party/turbobadger/src/tb/tb_widgets.h"
|
||||
#include "third_party/turbobadger/src/tb/element.h"
|
||||
|
||||
namespace xe {
|
||||
namespace debug {
|
||||
|
@ -27,11 +26,11 @@ class TurboBadgerControl : public xe::ui::gl::WGLControl {
|
|||
TurboBadgerControl(xe::ui::Loop* loop);
|
||||
~TurboBadgerControl() override;
|
||||
|
||||
static bool InitializeTurboBadger(tb::Renderer* renderer);
|
||||
static bool InitializeTurboBadger(tb::graphics::Renderer* renderer);
|
||||
static void ShutdownTurboBadger();
|
||||
|
||||
tb::Renderer* renderer() const { return renderer_.get(); }
|
||||
tb::Widget* root_widget() const { return root_widget_.get(); }
|
||||
tb::graphics::Renderer* renderer() const { return renderer_.get(); }
|
||||
tb::Element* root_element() const { return root_element_.get(); }
|
||||
|
||||
protected:
|
||||
using super = xe::ui::gl::WGLControl;
|
||||
|
@ -58,8 +57,8 @@ class TurboBadgerControl : public xe::ui::gl::WGLControl {
|
|||
void OnMouseUp(xe::ui::MouseEvent& e) override;
|
||||
void OnMouseWheel(xe::ui::MouseEvent& e) override;
|
||||
|
||||
std::unique_ptr<tb::Renderer> renderer_;
|
||||
std::unique_ptr<tb::Widget> root_widget_;
|
||||
std::unique_ptr<tb::graphics::Renderer> renderer_;
|
||||
std::unique_ptr<tb::Element> root_element_;
|
||||
|
||||
uint32_t frame_count_ = 0;
|
||||
uint32_t fps_ = 0;
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
||||
#include "third_party/turbobadger/src/tb/tb_types.h"
|
||||
#include "third_party/turbobadger/src/tb/tb_bitmap_fragment.h"
|
||||
#include "third_party/turbobadger/src/tb/tb_system.h"
|
||||
#include "third_party/turbobadger/src/tb/graphics/bitmap_fragment.h"
|
||||
#include "third_party/turbobadger/src/tb/util/math.h"
|
||||
|
||||
namespace xe {
|
||||
namespace debug {
|
||||
|
@ -22,9 +21,9 @@ namespace ui {
|
|||
|
||||
using namespace tb;
|
||||
|
||||
class TBRendererGL4::TBBitmapGL4 : public tb::Bitmap {
|
||||
class TBRendererGL4::TBBitmapGL4 : public tb::graphics::Bitmap {
|
||||
public:
|
||||
TBBitmapGL4(TBRendererGL4* renderer);
|
||||
TBBitmapGL4(xe::ui::gl::GLContext* context, TBRendererGL4* renderer);
|
||||
~TBBitmapGL4();
|
||||
|
||||
bool Init(int width, int height, uint32_t* data);
|
||||
|
@ -32,6 +31,7 @@ class TBRendererGL4::TBBitmapGL4 : public tb::Bitmap {
|
|||
int Height() override { return height_; }
|
||||
void SetData(uint32_t* data) override;
|
||||
|
||||
xe::ui::gl::GLContext* context_ = nullptr;
|
||||
TBRendererGL4* renderer_ = nullptr;
|
||||
int width_ = 0;
|
||||
int height_ = 0;
|
||||
|
@ -39,19 +39,22 @@ class TBRendererGL4::TBBitmapGL4 : public tb::Bitmap {
|
|||
GLuint64 gpu_handle_ = 0;
|
||||
};
|
||||
|
||||
TBRendererGL4::TBBitmapGL4::TBBitmapGL4(TBRendererGL4* renderer)
|
||||
: renderer_(renderer) {}
|
||||
TBRendererGL4::TBBitmapGL4::TBBitmapGL4(xe::ui::gl::GLContext* context,
|
||||
TBRendererGL4* renderer)
|
||||
: context_(context), renderer_(renderer) {}
|
||||
|
||||
TBRendererGL4::TBBitmapGL4::~TBBitmapGL4() {
|
||||
// Must flush and unbind before we delete the texture
|
||||
xe::ui::gl::GLContextLock lock(context_);
|
||||
|
||||
// Must flush and unbind before we delete the texture.
|
||||
renderer_->FlushBitmap(this);
|
||||
glMakeTextureHandleNonResidentARB(gpu_handle_);
|
||||
glDeleteTextures(1, &handle_);
|
||||
}
|
||||
|
||||
bool TBRendererGL4::TBBitmapGL4::Init(int width, int height, uint32_t* data) {
|
||||
assert(width == GetNearestPowerOfTwo(width));
|
||||
assert(height == GetNearestPowerOfTwo(height));
|
||||
assert(width == tb::util::GetNearestPowerOfTwo(width));
|
||||
assert(height == tb::util::GetNearestPowerOfTwo(height));
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
|
||||
|
@ -76,17 +79,21 @@ void TBRendererGL4::TBBitmapGL4::SetData(uint32_t* data) {
|
|||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
||||
TBRendererGL4::TBRendererGL4()
|
||||
: vertex_buffer_(VERTEX_BATCH_SIZE * sizeof(Vertex)) {}
|
||||
TBRendererGL4::TBRendererGL4(xe::ui::gl::GLContext* context)
|
||||
: context_(context),
|
||||
vertex_buffer_(graphics::BatchingRenderer::kVertexBatchSize *
|
||||
sizeof(Vertex)) {}
|
||||
|
||||
TBRendererGL4::~TBRendererGL4() {
|
||||
xe::ui::gl::GLContextLock lock(context_);
|
||||
vertex_buffer_.Shutdown();
|
||||
glDeleteVertexArrays(1, &vao_);
|
||||
glDeleteProgram(program_);
|
||||
}
|
||||
|
||||
std::unique_ptr<TBRendererGL4> TBRendererGL4::Create() {
|
||||
auto renderer = std::make_unique<TBRendererGL4>();
|
||||
std::unique_ptr<TBRendererGL4> TBRendererGL4::Create(
|
||||
xe::ui::gl::GLContext* context) {
|
||||
auto renderer = std::make_unique<TBRendererGL4>(context);
|
||||
if (!renderer->Initialize()) {
|
||||
XELOGE("Failed to initialize TurboBadger GL4 renderer");
|
||||
return nullptr;
|
||||
|
@ -181,8 +188,9 @@ void main() { \n\
|
|||
return true;
|
||||
}
|
||||
|
||||
Bitmap* TBRendererGL4::CreateBitmap(int width, int height, uint32_t* data) {
|
||||
auto bitmap = std::make_unique<TBBitmapGL4>(this);
|
||||
graphics::Bitmap* TBRendererGL4::CreateBitmap(int width, int height,
|
||||
uint32_t* data) {
|
||||
auto bitmap = std::make_unique<TBBitmapGL4>(context_, this);
|
||||
if (!bitmap->Init(width, height, data)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -191,12 +199,12 @@ Bitmap* TBRendererGL4::CreateBitmap(int width, int height, uint32_t* data) {
|
|||
|
||||
void TBRendererGL4::SetClipRect(const Rect& rect) {
|
||||
Flush();
|
||||
glScissor(m_clip_rect.x, m_screen_rect.h - (m_clip_rect.y + m_clip_rect.h),
|
||||
m_clip_rect.w, m_clip_rect.h);
|
||||
glScissor(clip_rect_.x, screen_rect_.h - (clip_rect_.y + clip_rect_.h),
|
||||
clip_rect_.w, clip_rect_.h);
|
||||
}
|
||||
|
||||
void TBRendererGL4::BeginPaint(int render_target_w, int render_target_h) {
|
||||
RendererBatcher::BeginPaint(render_target_w, render_target_h);
|
||||
tb::graphics::BatchingRenderer::BeginPaint(render_target_w, render_target_h);
|
||||
|
||||
glEnablei(GL_BLEND, 0);
|
||||
glBlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -230,7 +238,7 @@ void TBRendererGL4::BeginPaint(int render_target_w, int render_target_h) {
|
|||
}
|
||||
|
||||
void TBRendererGL4::EndPaint() {
|
||||
RendererBatcher::EndPaint();
|
||||
tb::graphics::BatchingRenderer::EndPaint();
|
||||
|
||||
Flush();
|
||||
|
||||
|
|
|
@ -10,29 +10,31 @@
|
|||
#ifndef XENIA_DEBUG_UI_TURBO_BADGER_RENDERER_H_
|
||||
#define XENIA_DEBUG_UI_TURBO_BADGER_RENDERER_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
#include "xenia/ui/gl/circular_buffer.h"
|
||||
#include "xenia/ui/gl/gl_context.h"
|
||||
#include "xenia/ui/gl/gl.h"
|
||||
|
||||
#include "third_party/turbobadger/src/tb/tb_renderer.h"
|
||||
#include "third_party/turbobadger/src/tb/tb_renderer_batcher.h"
|
||||
#include "third_party/turbobadger/src/tb/graphics/batching_renderer.h"
|
||||
|
||||
namespace xe {
|
||||
namespace debug {
|
||||
namespace ui {
|
||||
|
||||
class TBRendererGL4 : public tb::RendererBatcher {
|
||||
class TBRendererGL4 : public tb::graphics::BatchingRenderer {
|
||||
public:
|
||||
TBRendererGL4();
|
||||
TBRendererGL4(xe::ui::gl::GLContext* context);
|
||||
~TBRendererGL4() override;
|
||||
|
||||
static std::unique_ptr<TBRendererGL4> Create();
|
||||
static std::unique_ptr<TBRendererGL4> Create(xe::ui::gl::GLContext* context);
|
||||
|
||||
void BeginPaint(int render_target_w, int render_target_h) override;
|
||||
void EndPaint() override;
|
||||
|
||||
tb::Bitmap* CreateBitmap(int width, int height, uint32_t* data) override;
|
||||
tb::graphics::Bitmap* CreateBitmap(int width, int height,
|
||||
uint32_t* data) override;
|
||||
|
||||
void RenderBatch(Batch* batch) override;
|
||||
void SetClipRect(const tb::Rect& rect) override;
|
||||
|
@ -43,6 +45,8 @@ class TBRendererGL4 : public tb::RendererBatcher {
|
|||
bool Initialize();
|
||||
void Flush();
|
||||
|
||||
xe::ui::gl::GLContext* context_ = nullptr;
|
||||
|
||||
GLuint program_ = 0;
|
||||
GLuint vao_ = 0;
|
||||
xe::ui::gl::CircularBuffer vertex_buffer_;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 37c7b5d818a2e7a38a555e326ceb6cd4daf63a17
|
||||
Subproject commit 5075e6995e7946c6d14cd86a813281f19f5853a9
|
Loading…
Reference in New Issue