Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
36c311b
graphics: SwapChain code review (checkpoint 1)
Demonese Feb 18, 2026
d08169e
graphics: SwapChain code review (checkpoint 2)
Demonese Feb 18, 2026
04ca6e6
graphics: SwapChain code review (checkpoint 3)
Demonese Feb 18, 2026
6679d5c
graphics: SwapChain code review (checkpoint 4)
Demonese Feb 18, 2026
606ac20
graphics: SwapChain code review (checkpoint 5)
Demonese Feb 18, 2026
de242ba
application: prevent reentrancy in update functions again
Demonese Feb 18, 2026
cf6e802
application: prevent reentrancy in update functions again again
Demonese Feb 18, 2026
911e0a5
application: default to enable update
Demonese Feb 18, 2026
27ba4a1
graphics: SwapChain setFullscreenState
Demonese Feb 18, 2026
b16f9f5
graphics: SwapChain fix exclusive fullscreen
Demonese Feb 18, 2026
152ec0f
application: fix prevent reentrancy in update functions
Demonese Feb 18, 2026
1c9f379
graphics: SwapChain exclusive fullscreen resize buffer
Demonese Feb 18, 2026
148af0a
graphics: remove SwapChain debug code
Demonese Feb 18, 2026
bdc97ca
graphics: fix GraphicsPipeline recreate
Demonese Feb 18, 2026
552eaad
graphics: SwapChain recreate enter exclusive fullscreen automatically
Demonese Feb 18, 2026
3b59d9d
graphics: fix PrimitiveBatchRenderer recreate
Demonese Feb 18, 2026
fb5361b
graphics: fix Renderer recreate
Demonese Feb 18, 2026
b347aa6
graphics: fix leave exclusive fullscreen
Demonese Feb 18, 2026
80d7ebb
graphics: fix SwapChain setCanvasSize on composition mode
Demonese Feb 18, 2026
a3a75e3
graphics: SwapChain TitleBarController create and destroy
Demonese Feb 18, 2026
de153c8
graphics: SwapChain setCanvasSize update exclusive fullscreen display…
Demonese Feb 18, 2026
077f1ab
graphics: SwapChain updateLetterBoxingTransform
Demonese Feb 18, 2026
c1aa279
graphics: SwapChain createSwapChain remove parameter create_rtv
Demonese Feb 18, 2026
bb06824
graphics: remove old SwapChain_D3D11
Demonese Feb 18, 2026
ae413dc
graphics: SwapChain code cleanup
Demonese Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion engine/graphics/common/PrimitiveBatchRenderer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
#include "common/PrimitiveBatchRenderer.hpp"

namespace core {
void PrimitiveBatchRenderer::onGraphicsDeviceCreate() {
// nothing
}
void PrimitiveBatchRenderer::onGraphicsDeviceDestroy() {
if (m_initialized && m_batch_scope) {
mapBuffers(false);
}
}

PrimitiveBatchRenderer::PrimitiveBatchRenderer() = default;
PrimitiveBatchRenderer::~PrimitiveBatchRenderer() = default;
PrimitiveBatchRenderer::~PrimitiveBatchRenderer() {
if (m_initialized) {
m_device->removeEventListener(this);
}
}

bool PrimitiveBatchRenderer::createResources(IGraphicsDevice* const device) {
if (m_initialized && m_device) {
m_device->removeEventListener(this);
}

if (device == nullptr) {
assert(false); return false;
}
Expand All @@ -20,10 +37,14 @@ namespace core {
return false;
}

m_device->addEventListener(this);
m_initialized = true;
return true;
}

bool PrimitiveBatchRenderer::isBatch() const noexcept {
return m_batch_scope;
}
bool PrimitiveBatchRenderer::beginBatch(const bool auto_draw) {
if (m_batch_scope) {
assert(false); return false;
Expand Down
7 changes: 6 additions & 1 deletion engine/graphics/common/PrimitiveBatchRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
#include "core/SmartReference.hpp"

namespace core {
class PrimitiveBatchRenderer {
class PrimitiveBatchRenderer : public IGraphicsDeviceEventListener {
public:
using DrawVertex = Graphics::IRenderer::DrawVertex;
using DrawIndex = Graphics::IRenderer::DrawIndex;

void onGraphicsDeviceCreate() override;
void onGraphicsDeviceDestroy() override;

PrimitiveBatchRenderer();
PrimitiveBatchRenderer(const PrimitiveBatchRenderer&) = delete;
PrimitiveBatchRenderer(PrimitiveBatchRenderer&&) = delete;
Expand All @@ -20,6 +23,8 @@ namespace core {
// [free]
bool createResources(IGraphicsDevice* device);

// [free]
bool isBatch() const noexcept;
// [free]
bool beginBatch(bool auto_draw);
// [batch]
Expand Down
4 changes: 3 additions & 1 deletion engine/graphics/core/Graphics/Renderer_D3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ namespace core::Graphics {

if (discard) {
m_primitive_batch_renderer.discard();
m_primitive_batch_renderer.endBatch();
if (m_primitive_batch_renderer.isBatch()) {
m_primitive_batch_renderer.endBatch();
}
m_primitive_batch_renderer.setCycleOnNextBatch();
setTexture(_state_texture.get());
return true;
Expand Down
9 changes: 6 additions & 3 deletions engine/graphics/d3d11/GraphicsPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ namespace core {
}
m_device = device;
m_graphics_pipeline_state_helper.save(create_info);
return createResources();
if (!createResources()) {
return false;
}
m_device->addEventListener(this);
m_initialized = true;
return true;
}
void GraphicsPipeline::apply() {
const auto ctx = static_cast<ID3D11DeviceContext*>(m_device->getCommandbuffer()->getNativeHandle());
Expand Down Expand Up @@ -403,8 +408,6 @@ namespace core {
return false;
}

m_device->addEventListener(this);
m_initialized = true;
return true;
}
}
Expand Down
Loading