vk_rasterizer: Set render area to max when no framebuffers are bound

This commit is contained in:
IndecisiveTurtle 2025-07-10 18:26:04 +03:00
parent 88abb93669
commit e2a79dabc3
4 changed files with 16 additions and 9 deletions

View File

@ -324,11 +324,21 @@ public:
return properties.limits.maxViewportDimensions[0]; return properties.limits.maxViewportDimensions[0];
} }
/// Returns the maximum viewport height. /// Returns the maximum viewport height.
u32 GetMaxViewportHeight() const { u32 GetMaxViewportHeight() const {
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;