mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 02:26:07 +00:00
video_core: multiple color attachments support
This commit is contained in:
parent
3741f013a3
commit
9227a2b868
|
@ -631,6 +631,10 @@ struct Liverpool {
|
|||
u32 clear_word1;
|
||||
INSERT_PADDING_WORDS(2);
|
||||
|
||||
operator bool() const {
|
||||
return info.format != DataFormat::FormatInvalid;
|
||||
}
|
||||
|
||||
u32 Pitch() const {
|
||||
return (pitch.tile_max + 1) << 3;
|
||||
}
|
||||
|
|
|
@ -101,9 +101,8 @@ void PipelineCache::RefreshGraphicsKey() {
|
|||
: vk::Format::eUndefined;
|
||||
for (u32 i = 0; i < Liverpool::NumColorBuffers; i++) {
|
||||
const auto& cb = regs.color_buffers[i];
|
||||
key.color_formats[i] = cb.base_address
|
||||
? LiverpoolToVK::SurfaceFormat(cb.info.format, cb.NumFormat())
|
||||
: vk::Format::eUndefined;
|
||||
key.color_formats[i] = cb ? LiverpoolToVK::SurfaceFormat(cb.info.format, cb.NumFormat())
|
||||
: vk::Format::eUndefined;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < MaxShaderStages; i++) {
|
||||
|
|
|
@ -39,14 +39,21 @@ void Rasterizer::Draw(bool is_indexed) {
|
|||
const GraphicsPipeline* pipeline = pipeline_cache.GetGraphicsPipeline();
|
||||
pipeline->BindResources(memory, vertex_index_buffer, texture_cache);
|
||||
|
||||
const auto& image_view = texture_cache.RenderTarget(regs.color_buffers[0]);
|
||||
boost::container::static_vector<vk::RenderingAttachmentInfo, Liverpool::NumColorBuffers>
|
||||
color_attachments{};
|
||||
for (const auto& col_buf : regs.color_buffers) {
|
||||
if (!col_buf) {
|
||||
continue;
|
||||
}
|
||||
const auto& image_view = texture_cache.RenderTarget(col_buf);
|
||||
|
||||
const vk::RenderingAttachmentInfo color_info = {
|
||||
.imageView = *image_view.image_view,
|
||||
.imageLayout = vk::ImageLayout::eGeneral,
|
||||
.loadOp = vk::AttachmentLoadOp::eLoad,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
};
|
||||
color_attachments.push_back({
|
||||
.imageView = *image_view.image_view,
|
||||
.imageLayout = vk::ImageLayout::eGeneral,
|
||||
.loadOp = vk::AttachmentLoadOp::eLoad,
|
||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Don't restart renderpass every draw
|
||||
const auto& scissor = regs.screen_scissor;
|
||||
|
@ -57,8 +64,8 @@ void Rasterizer::Draw(bool is_indexed) {
|
|||
.extent = {scissor.GetWidth(), scissor.GetHeight()},
|
||||
},
|
||||
.layerCount = 1,
|
||||
.colorAttachmentCount = 1,
|
||||
.pColorAttachments = &color_info,
|
||||
.colorAttachmentCount = static_cast<u32>(color_attachments.size()),
|
||||
.pColorAttachments = color_attachments.data(),
|
||||
};
|
||||
|
||||
UpdateDynamicState();
|
||||
|
|
Loading…
Reference in a new issue