Fix buffer alloc alignment and framebuffer comparison.
This commit is contained in:
parent
06ba273492
commit
d57f974e2e
|
@ -344,11 +344,12 @@ VkDeviceSize BufferCache::TryAllocateTransientData(VkDeviceSize alignment,
|
|||
if (transient_tail_offset_ >= transient_head_offset_) {
|
||||
// Tail follows head, so things are easy:
|
||||
// | H----T |
|
||||
if (transient_tail_offset_ + length <= transient_capacity_) {
|
||||
if (xe::round_up(transient_tail_offset_, alignment) + length <=
|
||||
transient_capacity_) {
|
||||
// Allocation fits from tail to end of buffer, so grow.
|
||||
// | H----**T |
|
||||
VkDeviceSize offset = transient_tail_offset_;
|
||||
transient_tail_offset_ += length;
|
||||
VkDeviceSize offset = xe::round_up(transient_tail_offset_, alignment);
|
||||
transient_tail_offset_ = offset + length;
|
||||
return offset;
|
||||
} else if (length + kDeadZone <= transient_head_offset_) {
|
||||
// Can't fit at the end, but can fit if we wrap around.
|
||||
|
@ -360,11 +361,12 @@ VkDeviceSize BufferCache::TryAllocateTransientData(VkDeviceSize alignment,
|
|||
} else {
|
||||
// Head follows tail, so we're reversed:
|
||||
// |----T H---|
|
||||
if (transient_tail_offset_ + length + kDeadZone <= transient_head_offset_) {
|
||||
if (xe::round_up(transient_tail_offset_, alignment) + length + kDeadZone <=
|
||||
transient_head_offset_) {
|
||||
// Fits from tail to head.
|
||||
// |----***T H---|
|
||||
VkDeviceSize offset = transient_tail_offset_;
|
||||
transient_tail_offset_ += length;
|
||||
VkDeviceSize offset = xe::round_up(transient_tail_offset_, alignment);
|
||||
transient_tail_offset_ = offset + length;
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -293,6 +293,10 @@ bool CachedFramebuffer::IsCompatible(
|
|||
const RenderConfiguration& desired_config) const {
|
||||
// We already know all render pass things line up, so let's verify dimensions,
|
||||
// edram offsets, etc. We need an exact match.
|
||||
if (desired_config.surface_pitch_px != width ||
|
||||
desired_config.surface_height_px != height) {
|
||||
return false;
|
||||
}
|
||||
// TODO(benvanik): separate image views from images in tiles and store in fb?
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
// Ensure the the attachment points to the same tile.
|
||||
|
|
|
@ -163,11 +163,6 @@ bool VulkanCommandProcessor::IssueDraw(PrimitiveType primitive_type,
|
|||
IndexBufferInfo* index_buffer_info) {
|
||||
auto& regs = *register_file_;
|
||||
|
||||
// TODO(benvanik): move to CP or to host (trace dump, etc).
|
||||
if (FLAGS_vulkan_renderdoc_capture_all && device_->is_renderdoc_attached()) {
|
||||
device_->BeginRenderDocFrameCapture();
|
||||
}
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
@ -182,6 +177,11 @@ bool VulkanCommandProcessor::IssueDraw(PrimitiveType primitive_type,
|
|||
return IssueCopy();
|
||||
}
|
||||
|
||||
// TODO(benvanik): move to CP or to host (trace dump, etc).
|
||||
if (FLAGS_vulkan_renderdoc_capture_all && device_->is_renderdoc_attached()) {
|
||||
device_->BeginRenderDocFrameCapture();
|
||||
}
|
||||
|
||||
// Shaders will have already been defined by previous loads.
|
||||
// We need the to do just about anything so validate here.
|
||||
auto vertex_shader = static_cast<VulkanShader*>(active_vertex_shader());
|
||||
|
|
Loading…
Reference in New Issue