mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-09 09:38:41 +00:00
doors
This commit is contained in:
parent
183523a5c7
commit
dbeb45737e
5 changed files with 14 additions and 8 deletions
|
@ -238,10 +238,15 @@ struct Image {
|
||||||
return pitch + 1;
|
return pitch + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 NumLayers() const {
|
u32 NumLayers(bool is_array) const {
|
||||||
u32 slices = GetType() == ImageType::Color3D ? 1 : depth + 1;
|
u32 slices = GetType() == ImageType::Color3D ? 1 : depth + 1;
|
||||||
if (GetType() == ImageType::Cube) {
|
if (GetType() == ImageType::Cube) {
|
||||||
slices = std::max(last_array + 1, 6);
|
if (is_array) {
|
||||||
|
slices = last_array + 1;
|
||||||
|
ASSERT(slices % 6 == 0);
|
||||||
|
} else {
|
||||||
|
slices = 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pow2pad) {
|
if (pow2pad) {
|
||||||
slices = std::bit_ceil(slices);
|
slices = std::bit_ceil(slices);
|
||||||
|
|
|
@ -28,7 +28,7 @@ void Pipeline::BindTextures(VideoCore::TextureCache& texture_cache, const Shader
|
||||||
for (const auto& image_desc : stage.images) {
|
for (const auto& image_desc : stage.images) {
|
||||||
const auto tsharp = image_desc.GetSharp(stage);
|
const auto tsharp = image_desc.GetSharp(stage);
|
||||||
if (tsharp.GetDataFmt() != AmdGpu::DataFormat::FormatInvalid) {
|
if (tsharp.GetDataFmt() != AmdGpu::DataFormat::FormatInvalid) {
|
||||||
VideoCore::ImageInfo image_info{tsharp, image_desc.is_depth};
|
VideoCore::ImageInfo image_info{tsharp, image_desc};
|
||||||
const auto image_id = texture_cache.FindImage(image_info);
|
const auto image_id = texture_cache.FindImage(image_info);
|
||||||
auto& image = texture_cache.GetImage(image_id);
|
auto& image = texture_cache.GetImage(image_id);
|
||||||
image.flags |= VideoCore::ImageFlagBits::Bound;
|
image.flags |= VideoCore::ImageFlagBits::Bound;
|
||||||
|
|
|
@ -125,7 +125,7 @@ Image::Image(const Vulkan::Instance& instance_, Vulkan::Scheduler& scheduler_,
|
||||||
// the texture cache should re-create the resource with the usage requested
|
// the texture cache should re-create the resource with the usage requested
|
||||||
vk::ImageCreateFlags flags{vk::ImageCreateFlagBits::eMutableFormat |
|
vk::ImageCreateFlags flags{vk::ImageCreateFlagBits::eMutableFormat |
|
||||||
vk::ImageCreateFlagBits::eExtendedUsage};
|
vk::ImageCreateFlagBits::eExtendedUsage};
|
||||||
if (info.props.is_cube) {
|
if (info.props.is_cube || (info.type == vk::ImageType::e2D && info.resources.layers >= 6)) {
|
||||||
flags |= vk::ImageCreateFlagBits::eCubeCompatible;
|
flags |= vk::ImageCreateFlagBits::eCubeCompatible;
|
||||||
} else if (info.props.is_volume) {
|
} else if (info.props.is_volume) {
|
||||||
flags |= vk::ImageCreateFlagBits::e2DArrayCompatible;
|
flags |= vk::ImageCreateFlagBits::e2DArrayCompatible;
|
||||||
|
|
|
@ -200,11 +200,11 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::DepthBuffer& buffer, u32 num_slice
|
||||||
mips_layout.emplace_back(depth_slice_sz, pitch, 0);
|
mips_layout.emplace_back(depth_slice_sz, pitch, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageInfo::ImageInfo(const AmdGpu::Image& image, bool force_depth /*= false*/) noexcept {
|
ImageInfo::ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& desc) noexcept {
|
||||||
tiling_mode = image.GetTilingMode();
|
tiling_mode = image.GetTilingMode();
|
||||||
pixel_format = LiverpoolToVK::SurfaceFormat(image.GetDataFmt(), image.GetNumberFmt());
|
pixel_format = LiverpoolToVK::SurfaceFormat(image.GetDataFmt(), image.GetNumberFmt());
|
||||||
// Override format if image is forced to be a depth target
|
// Override format if image is forced to be a depth target
|
||||||
if (force_depth) {
|
if (desc.is_depth) {
|
||||||
pixel_format = LiverpoolToVK::PromoteFormatToDepth(pixel_format);
|
pixel_format = LiverpoolToVK::PromoteFormatToDepth(pixel_format);
|
||||||
}
|
}
|
||||||
type = ConvertImageType(image.GetType());
|
type = ConvertImageType(image.GetType());
|
||||||
|
@ -218,7 +218,7 @@ ImageInfo::ImageInfo(const AmdGpu::Image& image, bool force_depth /*= false*/) n
|
||||||
size.depth = props.is_volume ? image.depth + 1 : 1;
|
size.depth = props.is_volume ? image.depth + 1 : 1;
|
||||||
pitch = image.Pitch();
|
pitch = image.Pitch();
|
||||||
resources.levels = image.NumLevels();
|
resources.levels = image.NumLevels();
|
||||||
resources.layers = image.NumLayers();
|
resources.layers = image.NumLayers(desc.is_array);
|
||||||
num_bits = NumBits(image.GetDataFmt());
|
num_bits = NumBits(image.GetDataFmt());
|
||||||
usage.texture = true;
|
usage.texture = true;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/libraries/videoout/buffer.h"
|
#include "core/libraries/videoout/buffer.h"
|
||||||
|
#include "shader_recompiler/info.h"
|
||||||
#include "video_core/amdgpu/liverpool.h"
|
#include "video_core/amdgpu/liverpool.h"
|
||||||
#include "video_core/texture_cache/types.h"
|
#include "video_core/texture_cache/types.h"
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ struct ImageInfo {
|
||||||
const AmdGpu::Liverpool::CbDbExtent& hint = {}) noexcept;
|
const AmdGpu::Liverpool::CbDbExtent& hint = {}) noexcept;
|
||||||
ImageInfo(const AmdGpu::Liverpool::DepthBuffer& buffer, u32 num_slices, VAddr htile_address,
|
ImageInfo(const AmdGpu::Liverpool::DepthBuffer& buffer, u32 num_slices, VAddr htile_address,
|
||||||
const AmdGpu::Liverpool::CbDbExtent& hint = {}) noexcept;
|
const AmdGpu::Liverpool::CbDbExtent& hint = {}) noexcept;
|
||||||
ImageInfo(const AmdGpu::Image& image, bool force_depth = false) noexcept;
|
ImageInfo(const AmdGpu::Image& image, const Shader::ImageResource& desc) noexcept;
|
||||||
|
|
||||||
bool IsTiled() const {
|
bool IsTiled() const {
|
||||||
return tiling_mode != AmdGpu::TilingMode::Display_Linear;
|
return tiling_mode != AmdGpu::TilingMode::Display_Linear;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue