Log object names with debug renderer, add a GPU address to ImageViews
This commit is contained in:
parent
bb2e407772
commit
ca6bf06ef7
|
@ -108,7 +108,8 @@ bool IsASTCSupported() {
|
|||
|
||||
[[nodiscard]] bool IsDebugToolAttached(std::span<const std::string_view> extensions) {
|
||||
const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED");
|
||||
return nsight || HasExtension(extensions, "GL_EXT_debug_tool");
|
||||
return nsight || HasExtension(extensions, "GL_EXT_debug_tool") ||
|
||||
Settings::values.renderer_debug.GetValue();
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
|
|
@ -1126,7 +1126,8 @@ bool Image::ScaleDown(bool ignore) {
|
|||
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
|
||||
ImageId image_id_, Image& image, const SlotVector<Image>&)
|
||||
: VideoCommon::ImageViewBase{info, image.info, image_id_}, views{runtime.null_image_views} {
|
||||
: VideoCommon::ImageViewBase{info, image.info, image_id_, image.gpu_addr},
|
||||
views{runtime.null_image_views} {
|
||||
const Device& device = runtime.device;
|
||||
if (True(image.flags & ImageFlagBits::Converted)) {
|
||||
internal_format = IsPixelFormatSRGB(info.format) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
|
||||
|
@ -1217,12 +1218,12 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
|
||||
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
|
||||
const VideoCommon::ImageViewInfo& view_info, GPUVAddr gpu_addr_)
|
||||
: VideoCommon::ImageViewBase{info, view_info}, gpu_addr{gpu_addr_},
|
||||
: VideoCommon::ImageViewBase{info, view_info, gpu_addr_},
|
||||
buffer_size{VideoCommon::CalculateGuestSizeInBytes(info)} {}
|
||||
|
||||
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
|
||||
const VideoCommon::ImageViewInfo& view_info)
|
||||
: VideoCommon::ImageViewBase{info, view_info} {}
|
||||
: VideoCommon::ImageViewBase{info, view_info, 0} {}
|
||||
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::NullImageViewParams& params)
|
||||
: VideoCommon::ImageViewBase{params}, views{runtime.null_image_views} {}
|
||||
|
@ -1282,7 +1283,7 @@ GLuint ImageView::MakeView(Shader::TextureType view_type, GLenum view_format) {
|
|||
ApplySwizzle(view.handle, format, casted_swizzle);
|
||||
}
|
||||
if (set_object_label) {
|
||||
const std::string name = VideoCommon::Name(*this);
|
||||
const std::string name = VideoCommon::Name(*this, gpu_addr);
|
||||
glObjectLabel(GL_TEXTURE, view.handle, static_cast<GLsizei>(name.size()), name.data());
|
||||
}
|
||||
return view.handle;
|
||||
|
|
|
@ -314,7 +314,6 @@ private:
|
|||
std::unique_ptr<StorageViews> storage_views;
|
||||
GLenum internal_format = GL_NONE;
|
||||
GLuint default_handle = 0;
|
||||
GPUVAddr gpu_addr = 0;
|
||||
u32 buffer_size = 0;
|
||||
GLuint original_texture = 0;
|
||||
int num_samples = 0;
|
||||
|
|
|
@ -1584,8 +1584,9 @@ bool Image::NeedsScaleHelper() const {
|
|||
|
||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
|
||||
ImageId image_id_, Image& image)
|
||||
: VideoCommon::ImageViewBase{info, image.info, image_id_}, device{&runtime.device},
|
||||
image_handle{image.Handle()}, samples(ConvertSampleCount(image.info.num_samples)) {
|
||||
: VideoCommon::ImageViewBase{info, image.info, image_id_, image.gpu_addr},
|
||||
device{&runtime.device}, image_handle{image.Handle()},
|
||||
samples(ConvertSampleCount(image.info.num_samples)) {
|
||||
using Shader::TextureType;
|
||||
|
||||
const VkImageAspectFlags aspect_mask = ImageViewAspectMask(info);
|
||||
|
@ -1631,7 +1632,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
}
|
||||
vk::ImageView handle = device->GetLogical().CreateImageView(ci);
|
||||
if (device->HasDebuggingToolAttached()) {
|
||||
handle.SetObjectNameEXT(VideoCommon::Name(*this).c_str());
|
||||
handle.SetObjectNameEXT(VideoCommon::Name(*this, gpu_addr).c_str());
|
||||
}
|
||||
image_views[static_cast<size_t>(tex_type)] = std::move(handle);
|
||||
};
|
||||
|
@ -1672,7 +1673,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
|
||||
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
|
||||
const VideoCommon::ImageViewInfo& view_info, GPUVAddr gpu_addr_)
|
||||
: VideoCommon::ImageViewBase{info, view_info}, gpu_addr{gpu_addr_},
|
||||
: VideoCommon::ImageViewBase{info, view_info, gpu_addr_},
|
||||
buffer_size{VideoCommon::CalculateGuestSizeInBytes(info)} {}
|
||||
|
||||
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParams& params)
|
||||
|
|
|
@ -265,7 +265,6 @@ private:
|
|||
VkImage image_handle = VK_NULL_HANDLE;
|
||||
VkImageView render_target = VK_NULL_HANDLE;
|
||||
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
GPUVAddr gpu_addr = 0;
|
||||
u32 buffer_size = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ std::string Name(const ImageBase& image) {
|
|||
return "Invalid";
|
||||
}
|
||||
|
||||
std::string Name(const ImageViewBase& image_view) {
|
||||
std::string Name(const ImageViewBase& image_view, GPUVAddr addr) {
|
||||
const u32 width = image_view.size.width;
|
||||
const u32 height = image_view.size.height;
|
||||
const u32 depth = image_view.size.depth;
|
||||
|
@ -56,23 +56,25 @@ std::string Name(const ImageViewBase& image_view) {
|
|||
const std::string level = num_levels > 1 ? fmt::format(":{}", num_levels) : "";
|
||||
switch (image_view.type) {
|
||||
case ImageViewType::e1D:
|
||||
return fmt::format("ImageView 1D {}{}", width, level);
|
||||
return fmt::format("ImageView 1D 0x{:X} {}{}", addr, width, level);
|
||||
case ImageViewType::e2D:
|
||||
return fmt::format("ImageView 2D {}x{}{}", width, height, level);
|
||||
return fmt::format("ImageView 2D 0x{:X} {}x{}{}", addr, width, height, level);
|
||||
case ImageViewType::Cube:
|
||||
return fmt::format("ImageView Cube {}x{}{}", width, height, level);
|
||||
return fmt::format("ImageView Cube 0x{:X} {}x{}{}", addr, width, height, level);
|
||||
case ImageViewType::e3D:
|
||||
return fmt::format("ImageView 3D {}x{}x{}{}", width, height, depth, level);
|
||||
return fmt::format("ImageView 3D 0x{:X} {}x{}x{}{}", addr, width, height, depth, level);
|
||||
case ImageViewType::e1DArray:
|
||||
return fmt::format("ImageView 1DArray {}{}|{}", width, level, num_layers);
|
||||
return fmt::format("ImageView 1DArray 0x{:X} {}{}|{}", addr, width, level, num_layers);
|
||||
case ImageViewType::e2DArray:
|
||||
return fmt::format("ImageView 2DArray {}x{}{}|{}", width, height, level, num_layers);
|
||||
return fmt::format("ImageView 2DArray 0x{:X} {}x{}{}|{}", addr, width, height, level,
|
||||
num_layers);
|
||||
case ImageViewType::CubeArray:
|
||||
return fmt::format("ImageView CubeArray {}x{}{}|{}", width, height, level, num_layers);
|
||||
return fmt::format("ImageView CubeArray 0x{:X} {}x{}{}|{}", addr, width, height, level,
|
||||
num_layers);
|
||||
case ImageViewType::Rect:
|
||||
return fmt::format("ImageView Rect {}x{}{}", width, height, level);
|
||||
return fmt::format("ImageView Rect 0x{:X} {}x{}{}", addr, width, height, level);
|
||||
case ImageViewType::Buffer:
|
||||
return fmt::format("BufferView {}", width);
|
||||
return fmt::format("BufferView 0x{:X} {}", addr, width);
|
||||
}
|
||||
return "Invalid";
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ struct RenderTargets;
|
|||
|
||||
[[nodiscard]] std::string Name(const ImageBase& image);
|
||||
|
||||
[[nodiscard]] std::string Name(const ImageViewBase& image_view);
|
||||
[[nodiscard]] std::string Name(const ImageViewBase& image_view, GPUVAddr addr);
|
||||
|
||||
[[nodiscard]] std::string Name(const RenderTargets& render_targets);
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
namespace VideoCommon {
|
||||
|
||||
ImageViewBase::ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_info,
|
||||
ImageId image_id_)
|
||||
: image_id{image_id_}, format{info.format}, type{info.type}, range{info.range},
|
||||
ImageId image_id_, GPUVAddr addr)
|
||||
: image_id{image_id_}, gpu_addr{addr}, format{info.format}, type{info.type}, range{info.range},
|
||||
size{
|
||||
.width = std::max(image_info.size.width >> range.base.level, 1u),
|
||||
.height = std::max(image_info.size.height >> range.base.level, 1u),
|
||||
|
@ -35,8 +35,8 @@ ImageViewBase::ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_i
|
|||
}
|
||||
}
|
||||
|
||||
ImageViewBase::ImageViewBase(const ImageInfo& info, const ImageViewInfo& view_info)
|
||||
: image_id{NULL_IMAGE_ID}, format{info.format}, type{ImageViewType::Buffer},
|
||||
ImageViewBase::ImageViewBase(const ImageInfo& info, const ImageViewInfo& view_info, GPUVAddr addr)
|
||||
: image_id{NULL_IMAGE_ID}, gpu_addr{addr}, format{info.format}, type{ImageViewType::Buffer},
|
||||
size{
|
||||
.width = info.size.width,
|
||||
.height = 1,
|
||||
|
|
|
@ -24,9 +24,9 @@ enum class ImageViewFlagBits : u16 {
|
|||
DECLARE_ENUM_FLAG_OPERATORS(ImageViewFlagBits)
|
||||
|
||||
struct ImageViewBase {
|
||||
explicit ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_info,
|
||||
ImageId image_id);
|
||||
explicit ImageViewBase(const ImageInfo& info, const ImageViewInfo& view_info);
|
||||
explicit ImageViewBase(const ImageViewInfo& info, const ImageInfo& image_info, ImageId image_id,
|
||||
GPUVAddr addr);
|
||||
explicit ImageViewBase(const ImageInfo& info, const ImageViewInfo& view_info, GPUVAddr addr);
|
||||
explicit ImageViewBase(const NullImageViewParams&);
|
||||
|
||||
[[nodiscard]] bool IsBuffer() const noexcept {
|
||||
|
@ -34,6 +34,7 @@ struct ImageViewBase {
|
|||
}
|
||||
|
||||
ImageId image_id{};
|
||||
GPUVAddr gpu_addr = 0;
|
||||
PixelFormat format{};
|
||||
ImageViewType type{};
|
||||
SubresourceRange range;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/settings.h"
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
|
||||
// Define all features which may be used by the implementation here.
|
||||
|
@ -510,7 +511,7 @@ public:
|
|||
|
||||
/// Returns true when a known debugging tool is attached.
|
||||
bool HasDebuggingToolAttached() const {
|
||||
return has_renderdoc || has_nsight_graphics;
|
||||
return has_renderdoc || has_nsight_graphics || Settings::values.renderer_debug.GetValue();
|
||||
}
|
||||
|
||||
/// Returns true when the device does not properly support cube compatibility.
|
||||
|
|
Reference in New Issue