mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06: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;
|
u32 clear_word1;
|
||||||
INSERT_PADDING_WORDS(2);
|
INSERT_PADDING_WORDS(2);
|
||||||
|
|
||||||
|
operator bool() const {
|
||||||
|
return info.format != DataFormat::FormatInvalid;
|
||||||
|
}
|
||||||
|
|
||||||
u32 Pitch() const {
|
u32 Pitch() const {
|
||||||
return (pitch.tile_max + 1) << 3;
|
return (pitch.tile_max + 1) << 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,8 @@ void PipelineCache::RefreshGraphicsKey() {
|
||||||
: vk::Format::eUndefined;
|
: vk::Format::eUndefined;
|
||||||
for (u32 i = 0; i < Liverpool::NumColorBuffers; i++) {
|
for (u32 i = 0; i < Liverpool::NumColorBuffers; i++) {
|
||||||
const auto& cb = regs.color_buffers[i];
|
const auto& cb = regs.color_buffers[i];
|
||||||
key.color_formats[i] = cb.base_address
|
key.color_formats[i] = cb ? LiverpoolToVK::SurfaceFormat(cb.info.format, cb.NumFormat())
|
||||||
? LiverpoolToVK::SurfaceFormat(cb.info.format, cb.NumFormat())
|
: vk::Format::eUndefined;
|
||||||
: vk::Format::eUndefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < MaxShaderStages; i++) {
|
for (u32 i = 0; i < MaxShaderStages; i++) {
|
||||||
|
|
|
@ -39,14 +39,21 @@ void Rasterizer::Draw(bool is_indexed) {
|
||||||
const GraphicsPipeline* pipeline = pipeline_cache.GetGraphicsPipeline();
|
const GraphicsPipeline* pipeline = pipeline_cache.GetGraphicsPipeline();
|
||||||
pipeline->BindResources(memory, vertex_index_buffer, texture_cache);
|
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 = {
|
color_attachments.push_back({
|
||||||
.imageView = *image_view.image_view,
|
.imageView = *image_view.image_view,
|
||||||
.imageLayout = vk::ImageLayout::eGeneral,
|
.imageLayout = vk::ImageLayout::eGeneral,
|
||||||
.loadOp = vk::AttachmentLoadOp::eLoad,
|
.loadOp = vk::AttachmentLoadOp::eLoad,
|
||||||
.storeOp = vk::AttachmentStoreOp::eStore,
|
.storeOp = vk::AttachmentStoreOp::eStore,
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Don't restart renderpass every draw
|
// TODO: Don't restart renderpass every draw
|
||||||
const auto& scissor = regs.screen_scissor;
|
const auto& scissor = regs.screen_scissor;
|
||||||
|
@ -57,8 +64,8 @@ void Rasterizer::Draw(bool is_indexed) {
|
||||||
.extent = {scissor.GetWidth(), scissor.GetHeight()},
|
.extent = {scissor.GetWidth(), scissor.GetHeight()},
|
||||||
},
|
},
|
||||||
.layerCount = 1,
|
.layerCount = 1,
|
||||||
.colorAttachmentCount = 1,
|
.colorAttachmentCount = static_cast<u32>(color_attachments.size()),
|
||||||
.pColorAttachments = &color_info,
|
.pColorAttachments = color_attachments.data(),
|
||||||
};
|
};
|
||||||
|
|
||||||
UpdateDynamicState();
|
UpdateDynamicState();
|
||||||
|
|
Loading…
Reference in a new issue