mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-20 23:40:56 +01:00
Merge pull request #10818 from vonchenplus/render_target_samples
video_core: add samples check when find render target
This commit is contained in:
commit
f1e12e3b08
2 changed files with 14 additions and 18 deletions
|
@ -300,7 +300,7 @@ void TextureCache<P>::SynchronizeComputeDescriptors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
bool TextureCache<P>::RescaleRenderTargets(bool is_clear) {
|
bool TextureCache<P>::RescaleRenderTargets() {
|
||||||
auto& flags = maxwell3d->dirty.flags;
|
auto& flags = maxwell3d->dirty.flags;
|
||||||
u32 scale_rating = 0;
|
u32 scale_rating = 0;
|
||||||
bool rescaled = false;
|
bool rescaled = false;
|
||||||
|
@ -338,13 +338,13 @@ bool TextureCache<P>::RescaleRenderTargets(bool is_clear) {
|
||||||
ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index];
|
ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index];
|
||||||
if (flags[Dirty::ColorBuffer0 + index] || force) {
|
if (flags[Dirty::ColorBuffer0 + index] || force) {
|
||||||
flags[Dirty::ColorBuffer0 + index] = false;
|
flags[Dirty::ColorBuffer0 + index] = false;
|
||||||
BindRenderTarget(&color_buffer_id, FindColorBuffer(index, is_clear));
|
BindRenderTarget(&color_buffer_id, FindColorBuffer(index));
|
||||||
}
|
}
|
||||||
check_rescale(color_buffer_id, tmp_color_images[index]);
|
check_rescale(color_buffer_id, tmp_color_images[index]);
|
||||||
}
|
}
|
||||||
if (flags[Dirty::ZetaBuffer] || force) {
|
if (flags[Dirty::ZetaBuffer] || force) {
|
||||||
flags[Dirty::ZetaBuffer] = false;
|
flags[Dirty::ZetaBuffer] = false;
|
||||||
BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer(is_clear));
|
BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer());
|
||||||
}
|
}
|
||||||
check_rescale(render_targets.depth_buffer_id, tmp_depth_image);
|
check_rescale(render_targets.depth_buffer_id, tmp_depth_image);
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool rescaled = RescaleRenderTargets(is_clear);
|
const bool rescaled = RescaleRenderTargets();
|
||||||
if (is_rescaling != rescaled) {
|
if (is_rescaling != rescaled) {
|
||||||
flags[Dirty::RescaleViewports] = true;
|
flags[Dirty::RescaleViewports] = true;
|
||||||
flags[Dirty::RescaleScissors] = true;
|
flags[Dirty::RescaleScissors] = true;
|
||||||
|
@ -1678,7 +1678,7 @@ SamplerId TextureCache<P>::FindSampler(const TSCEntry& config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
ImageViewId TextureCache<P>::FindColorBuffer(size_t index, bool is_clear) {
|
ImageViewId TextureCache<P>::FindColorBuffer(size_t index) {
|
||||||
const auto& regs = maxwell3d->regs;
|
const auto& regs = maxwell3d->regs;
|
||||||
if (index >= regs.rt_control.count) {
|
if (index >= regs.rt_control.count) {
|
||||||
return ImageViewId{};
|
return ImageViewId{};
|
||||||
|
@ -1692,11 +1692,11 @@ ImageViewId TextureCache<P>::FindColorBuffer(size_t index, bool is_clear) {
|
||||||
return ImageViewId{};
|
return ImageViewId{};
|
||||||
}
|
}
|
||||||
const ImageInfo info(regs.rt[index], regs.anti_alias_samples_mode);
|
const ImageInfo info(regs.rt[index], regs.anti_alias_samples_mode);
|
||||||
return FindRenderTargetView(info, gpu_addr, is_clear);
|
return FindRenderTargetView(info, gpu_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
ImageViewId TextureCache<P>::FindDepthBuffer(bool is_clear) {
|
ImageViewId TextureCache<P>::FindDepthBuffer() {
|
||||||
const auto& regs = maxwell3d->regs;
|
const auto& regs = maxwell3d->regs;
|
||||||
if (!regs.zeta_enable) {
|
if (!regs.zeta_enable) {
|
||||||
return ImageViewId{};
|
return ImageViewId{};
|
||||||
|
@ -1706,18 +1706,16 @@ ImageViewId TextureCache<P>::FindDepthBuffer(bool is_clear) {
|
||||||
return ImageViewId{};
|
return ImageViewId{};
|
||||||
}
|
}
|
||||||
const ImageInfo info(regs.zeta, regs.zeta_size, regs.anti_alias_samples_mode);
|
const ImageInfo info(regs.zeta, regs.zeta_size, regs.anti_alias_samples_mode);
|
||||||
return FindRenderTargetView(info, gpu_addr, is_clear);
|
return FindRenderTargetView(info, gpu_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr,
|
ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr) {
|
||||||
bool is_clear) {
|
|
||||||
const auto options = is_clear ? RelaxedOptions::Samples : RelaxedOptions{};
|
|
||||||
ImageId image_id{};
|
ImageId image_id{};
|
||||||
bool delete_state = has_deleted_images;
|
bool delete_state = has_deleted_images;
|
||||||
do {
|
do {
|
||||||
has_deleted_images = false;
|
has_deleted_images = false;
|
||||||
image_id = FindOrInsertImage(info, gpu_addr, options);
|
image_id = FindOrInsertImage(info, gpu_addr);
|
||||||
delete_state |= has_deleted_images;
|
delete_state |= has_deleted_images;
|
||||||
} while (has_deleted_images);
|
} while (has_deleted_images);
|
||||||
has_deleted_images = delete_state;
|
has_deleted_images = delete_state;
|
||||||
|
|
|
@ -178,9 +178,8 @@ public:
|
||||||
void SynchronizeComputeDescriptors();
|
void SynchronizeComputeDescriptors();
|
||||||
|
|
||||||
/// Updates the Render Targets if they can be rescaled
|
/// Updates the Render Targets if they can be rescaled
|
||||||
/// @param is_clear True when the render targets are being used for clears
|
|
||||||
/// @retval True if the Render Targets have been rescaled.
|
/// @retval True if the Render Targets have been rescaled.
|
||||||
bool RescaleRenderTargets(bool is_clear);
|
bool RescaleRenderTargets();
|
||||||
|
|
||||||
/// Update bound render targets and upload memory if necessary
|
/// Update bound render targets and upload memory if necessary
|
||||||
/// @param is_clear True when the render targets are being used for clears
|
/// @param is_clear True when the render targets are being used for clears
|
||||||
|
@ -336,14 +335,13 @@ private:
|
||||||
[[nodiscard]] SamplerId FindSampler(const TSCEntry& config);
|
[[nodiscard]] SamplerId FindSampler(const TSCEntry& config);
|
||||||
|
|
||||||
/// Find or create an image view for the given color buffer index
|
/// Find or create an image view for the given color buffer index
|
||||||
[[nodiscard]] ImageViewId FindColorBuffer(size_t index, bool is_clear);
|
[[nodiscard]] ImageViewId FindColorBuffer(size_t index);
|
||||||
|
|
||||||
/// Find or create an image view for the depth buffer
|
/// Find or create an image view for the depth buffer
|
||||||
[[nodiscard]] ImageViewId FindDepthBuffer(bool is_clear);
|
[[nodiscard]] ImageViewId FindDepthBuffer();
|
||||||
|
|
||||||
/// Find or create a view for a render target with the given image parameters
|
/// Find or create a view for a render target with the given image parameters
|
||||||
[[nodiscard]] ImageViewId FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr,
|
[[nodiscard]] ImageViewId FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr);
|
||||||
bool is_clear);
|
|
||||||
|
|
||||||
/// Iterates over all the images in a region calling func
|
/// Iterates over all the images in a region calling func
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
|
|
Loading…
Reference in a new issue