vk_rasterizer: Set render area to max when no framebuffers are bound (#3227)
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / linux-qt-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled

This commit is contained in:
TheTurtle 2025-07-10 22:14:02 +03:00 committed by GitHub
parent 8bc30270c8
commit b403e1be33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 9 deletions

View file

@ -329,6 +329,16 @@ public:
return properties.limits.maxViewportDimensions[1]; return properties.limits.maxViewportDimensions[1];
} }
/// Returns the maximum render area width.
u32 GetMaxFramebufferWidth() const {
return properties.limits.maxFramebufferWidth;
}
/// Returns the maximum render area height.
u32 GetMaxFramebufferHeight() const {
return properties.limits.maxFramebufferHeight;
}
/// Returns the sample count flags supported by framebuffers. /// Returns the sample count flags supported by framebuffers.
vk::SampleCountFlags GetFramebufferSampleCounts() const { vk::SampleCountFlags GetFramebufferSampleCounts() const {
return properties.limits.framebufferColorSampleCounts & return properties.limits.framebufferColorSampleCounts &

View file

@ -113,6 +113,8 @@ RenderState Rasterizer::PrepareRenderState(u32 mrt_mask) {
// Prefetch color and depth buffers to let texture cache handle possible overlaps with bound // Prefetch color and depth buffers to let texture cache handle possible overlaps with bound
// textures (e.g. mipgen) // textures (e.g. mipgen)
RenderState state; RenderState state;
state.width = instance.GetMaxFramebufferWidth();
state.height = instance.GetMaxFramebufferHeight();
cb_descs.clear(); cb_descs.clear();
db_desc.reset(); db_desc.reset();

View file

@ -34,16 +34,11 @@ void Scheduler::BeginRendering(const RenderState& new_state) {
is_rendering = true; is_rendering = true;
render_state = new_state; render_state = new_state;
const auto width =
render_state.width != std::numeric_limits<u32>::max() ? render_state.width : 1;
const auto height =
render_state.height != std::numeric_limits<u32>::max() ? render_state.height : 1;
const vk::RenderingInfo rendering_info = { const vk::RenderingInfo rendering_info = {
.renderArea = .renderArea =
{ {
.offset = {0, 0}, .offset = {0, 0},
.extent = {width, height}, .extent = {render_state.width, render_state.height},
}, },
.layerCount = 1, .layerCount = 1,
.colorAttachmentCount = render_state.num_color_attachments, .colorAttachmentCount = render_state.num_color_attachments,

View file

@ -26,8 +26,8 @@ struct RenderState {
u32 num_color_attachments{}; u32 num_color_attachments{};
bool has_depth{}; bool has_depth{};
bool has_stencil{}; bool has_stencil{};
u32 width = std::numeric_limits<u32>::max(); u32 width{};
u32 height = std::numeric_limits<u32>::max(); u32 height{};
bool operator==(const RenderState& other) const noexcept { bool operator==(const RenderState& other) const noexcept {
return std::memcmp(this, &other, sizeof(RenderState)) == 0; return std::memcmp(this, &other, sizeof(RenderState)) == 0;