219 changes: 0 additions & 219 deletions Source/Core/VideoBackends/Software/DebugUtil.cpp

This file was deleted.

25 changes: 0 additions & 25 deletions Source/Core/VideoBackends/Software/DebugUtil.h

This file was deleted.

2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/Software/SWOGLWindow.cpp
Expand Up @@ -105,7 +105,7 @@ void SWOGLWindow::ShowImage(const AbstractTexture* image,

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(sw_image->GetConfig().width),
static_cast<GLsizei>(sw_image->GetConfig().height), 0, GL_RGBA, GL_UNSIGNED_BYTE,
sw_image->GetData());
sw_image->GetData(0, 0));

glUseProgram(m_image_program);

Expand Down
71 changes: 44 additions & 27 deletions Source/Core/VideoBackends/Software/SWTexture.cpp
Expand Up @@ -25,17 +25,17 @@ struct Pixel
#pragma pack(pop)

void CopyTextureData(const TextureConfig& src_config, const u8* src_ptr, u32 src_x, u32 src_y,
u32 width, u32 height, const TextureConfig& dst_config, u8* dst_ptr, u32 dst_x,
u32 dst_y)
u32 width, u32 height, u32 src_level, const TextureConfig& dst_config,
u8* dst_ptr, u32 dst_x, u32 dst_y, u32 dst_level)
{
size_t texel_size = AbstractTexture::GetTexelSizeForFormat(src_config.format);
size_t src_stride = src_config.GetStride();
size_t src_offset =
const size_t texel_size = AbstractTexture::GetTexelSizeForFormat(src_config.format);
const size_t src_stride = src_config.GetMipStride(src_level);
const size_t src_offset =
static_cast<size_t>(src_y) * src_stride + static_cast<size_t>(src_x) * texel_size;
size_t dst_stride = dst_config.GetStride();
size_t dst_offset =
const size_t dst_stride = dst_config.GetMipStride(dst_level);
const size_t dst_offset =
static_cast<size_t>(dst_y) * dst_stride + static_cast<size_t>(dst_x) * texel_size;
size_t copy_len = static_cast<size_t>(width) * texel_size;
const size_t copy_len = static_cast<size_t>(width) * texel_size;

src_ptr += src_offset;
dst_ptr += dst_offset;
Expand All @@ -56,26 +56,35 @@ void SWRenderer::ScaleTexture(AbstractFramebuffer* dst_framebuffer,
const SWTexture* software_source_texture = static_cast<const SWTexture*>(src_texture);
SWTexture* software_dest_texture = static_cast<SWTexture*>(dst_framebuffer->GetColorAttachment());

CopyRegion(reinterpret_cast<const Pixel*>(software_source_texture->GetData()), src_rect,
CopyRegion(reinterpret_cast<const Pixel*>(software_source_texture->GetData(0, 0)), src_rect,
src_texture->GetWidth(), src_texture->GetHeight(),
reinterpret_cast<Pixel*>(software_dest_texture->GetData()), dst_rect,
reinterpret_cast<Pixel*>(software_dest_texture->GetData(0, 0)), dst_rect,
dst_framebuffer->GetWidth(), dst_framebuffer->GetHeight());
}

SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
{
m_data.resize(tex_config.width * tex_config.height * 4);
m_data.resize(tex_config.layers);
for (u32 layer = 0; layer < tex_config.layers; layer++)
{
m_data[layer].resize(tex_config.levels);
for (u32 level = 0; level < tex_config.levels; level++)
{
m_data[layer][level].resize(std::max(tex_config.width >> level, 1u) *
std::max(tex_config.height >> level, 1u) * sizeof(Pixel));
}
}
}

void SWTexture::CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,
u32 dst_layer, u32 dst_level)
{
ASSERT(src_level == 0 && src_layer == 0 && dst_layer == 0 && dst_level == 0);
CopyTextureData(src->GetConfig(), static_cast<const SWTexture*>(src)->m_data.data(),
src_rect.left, src_rect.top, src_rect.GetWidth(), src_rect.GetHeight(), m_config,
m_data.data(), dst_rect.left, dst_rect.top);
CopyTextureData(src->GetConfig(),
static_cast<const SWTexture*>(src)->GetData(src_layer, src_level), src_rect.left,
src_rect.top, src_rect.GetWidth(), src_rect.GetHeight(), src_level, m_config,
GetData(dst_layer, dst_level), dst_rect.left, dst_rect.top, dst_level);
}
void SWTexture::ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect,
u32 layer, u32 level)
Expand All @@ -85,17 +94,25 @@ void SWTexture::ResolveFromTexture(const AbstractTexture* src, const MathUtil::R
void SWTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size)
{
m_data.assign(buffer, buffer + buffer_size);
for (u32 layer = 0; layer < m_config.layers; layer++)
{
u8* data = GetData(layer, level);
for (u32 y = 0; y < height; y++)
{
memcpy(&data[width * y * sizeof(Pixel)], &buffer[y * row_length * sizeof(Pixel)],
width * sizeof(Pixel));
}
}
}

const u8* SWTexture::GetData() const
const u8* SWTexture::GetData(u32 layer, u32 level) const
{
return m_data.data();
return m_data[layer][level].data();
}

u8* SWTexture::GetData()
u8* SWTexture::GetData(u32 layer, u32 level)
{
return m_data.data();
return m_data[layer][level].data();
}

SWStagingTexture::SWStagingTexture(StagingTextureType type, const TextureConfig& config)
Expand All @@ -112,21 +129,21 @@ void SWStagingTexture::CopyFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect)
{
ASSERT(src_level == 0 && src_layer == 0);
CopyTextureData(src->GetConfig(), static_cast<const SWTexture*>(src)->GetData(), src_rect.left,
src_rect.top, src_rect.GetWidth(), src_rect.GetHeight(), m_config, m_data.data(),
dst_rect.left, dst_rect.top);
CopyTextureData(src->GetConfig(),
static_cast<const SWTexture*>(src)->GetData(src_layer, src_level), src_rect.left,
src_rect.top, src_rect.GetWidth(), src_rect.GetHeight(), src_level, m_config,
m_data.data(), dst_rect.left, dst_rect.top, 0);
m_needs_flush = true;
}

void SWStagingTexture::CopyToTexture(const MathUtil::Rectangle<int>& src_rect, AbstractTexture* dst,
const MathUtil::Rectangle<int>& dst_rect, u32 dst_layer,
u32 dst_level)
{
ASSERT(dst_level == 0 && dst_layer == 0);
CopyTextureData(m_config, m_data.data(), src_rect.left, src_rect.top, src_rect.GetWidth(),
src_rect.GetHeight(), dst->GetConfig(), static_cast<SWTexture*>(dst)->GetData(),
dst_rect.left, dst_rect.top);
src_rect.GetHeight(), 0, dst->GetConfig(),
static_cast<SWTexture*>(dst)->GetData(dst_layer, dst_level), dst_rect.left,
dst_rect.top, dst_level);
m_needs_flush = true;
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoBackends/Software/SWTexture.h
Expand Up @@ -29,11 +29,11 @@ class SWTexture final : public AbstractTexture
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size) override;

const u8* GetData() const;
u8* GetData();
const u8* GetData(u32 layer, u32 level) const;
u8* GetData(u32 layer, u32 level);

private:
std::vector<u8> m_data;
std::vector<std::vector<std::vector<u8>>> m_data;
};

class SWStagingTexture final : public AbstractStagingTexture
Expand Down
7 changes: 2 additions & 5 deletions Source/Core/VideoBackends/Software/SWVertexLoader.cpp
Expand Up @@ -10,7 +10,6 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"

#include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/NativeVertexFormat.h"
#include "VideoBackends/Software/Rasterizer.h"
#include "VideoBackends/Software/SWRenderer.h"
Expand Down Expand Up @@ -42,8 +41,6 @@ DataReader SWVertexLoader::PrepareForAdditionalData(OpcodeDecoder::Primitive pri

void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_vertex)
{
DebugUtil::OnObjectBegin();

using OpcodeDecoder::Primitive;
Primitive primitive_type = Primitive::GX_DRAW_QUADS;
switch (m_current_primitive_type)
Expand Down Expand Up @@ -90,10 +87,10 @@ void SWVertexLoader::DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_
// assemble and rasterize the primitive
m_setup_unit.SetupVertex();

INCSTAT(g_stats.this_frame.num_vertices_loaded)
INCSTAT(g_stats.this_frame.num_vertices_loaded);
}

DebugUtil::OnObjectEnd();
INCSTAT(g_stats.this_frame.num_drawn_objects);
}

void SWVertexLoader::SetFormat()
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/VideoBackends/Software/SWmain.cpp
Expand Up @@ -14,7 +14,6 @@
#include "Common/MsgHandler.h"

#include "VideoBackends/Software/Clipper.h"
#include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/Rasterizer.h"
#include "VideoBackends/Software/SWOGLWindow.h"
Expand Down Expand Up @@ -105,7 +104,6 @@ bool VideoSoftware::Initialize(const WindowSystemInfo& wsi)

Clipper::Init();
Rasterizer::Init();
DebugUtil::Init();

g_renderer = std::make_unique<SWRenderer>(std::move(window));
g_vertex_manager = std::make_unique<SWVertexLoader>();
Expand Down Expand Up @@ -135,7 +133,6 @@ void VideoSoftware::Shutdown()
if (g_renderer)
g_renderer->Shutdown();

DebugUtil::Shutdown();
g_texture_cache.reset();
g_perf_query.reset();
g_framebuffer_manager.reset();
Expand Down
45 changes: 0 additions & 45 deletions Source/Core/VideoBackends/Software/Tev.cpp
Expand Up @@ -9,7 +9,6 @@

#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/SWBoundingBox.h"
#include "VideoBackends/Software/TextureSampler.h"
Expand Down Expand Up @@ -428,16 +427,6 @@ void Tev::Draw()
TextureSampler::Sample(Uv[texcoordSel].s >> scaleS, Uv[texcoordSel].t >> scaleT,
IndirectLod[stageNum], IndirectLinear[stageNum], texmap,
IndirectTex[stageNum]);

#if ALLOW_TEV_DUMPS
if (g_ActiveConfig.bDumpTevStages)
{
u8 stage[4] = {IndirectTex[stageNum][TextureSampler::ALP_SMP],
IndirectTex[stageNum][TextureSampler::BLU_SMP],
IndirectTex[stageNum][TextureSampler::GRN_SMP], 255};
DebugUtil::DrawTempBuffer(stage, INDIRECT + stageNum);
}
#endif
}

for (unsigned int stageNum = 0; stageNum <= bpmem.genMode.numtevstages; stageNum++)
Expand Down Expand Up @@ -478,11 +467,6 @@ void Tev::Draw()
std::memset(texel, 0, 4);
}

#if ALLOW_TEV_DUMPS
if (g_ActiveConfig.bDumpTevTextureFetches)
DebugUtil::DrawTempBuffer(texel, DIRECT_TFETCH + stageNum);
#endif

const auto& swap = bpmem.tevksel.GetSwapTable(ac.tswap);
TexColor.r = texel[u32(swap[ColorChannel::Red])];
TexColor.g = texel[u32(swap[ColorChannel::Green])];
Expand Down Expand Up @@ -547,15 +531,6 @@ void Tev::Draw()
Reg[ac.dest].a = Clamp255(Reg[ac.dest].a);
else
Reg[ac.dest].a = Clamp1024(Reg[ac.dest].a);

#if ALLOW_TEV_DUMPS
if (g_ActiveConfig.bDumpTevStages)
{
u8 stage[4] = {(u8)Reg[cc.dest].r, (u8)Reg[cc.dest].g, (u8)Reg[cc.dest].b,
(u8)Reg[ac.dest].a};
DebugUtil::DrawTempBuffer(stage, DIRECT + stageNum);
}
#endif
}

// convert to 8 bits per component
Expand Down Expand Up @@ -711,26 +686,6 @@ void Tev::Draw()
BBoxManager::Update(static_cast<u16>(Position[0] & ~1), static_cast<u16>(Position[0] | 1),
static_cast<u16>(Position[1] & ~1), static_cast<u16>(Position[1] | 1));

#if ALLOW_TEV_DUMPS
if (g_ActiveConfig.bDumpTevStages)
{
for (u32 i = 0; i < bpmem.genMode.numindstages; ++i)
DebugUtil::CopyTempBuffer(Position[0], Position[1], INDIRECT, i, "Indirect");
for (u32 i = 0; i <= bpmem.genMode.numtevstages; ++i)
DebugUtil::CopyTempBuffer(Position[0], Position[1], DIRECT, i, "Stage");
}

if (g_ActiveConfig.bDumpTevTextureFetches)
{
for (u32 i = 0; i <= bpmem.genMode.numtevstages; ++i)
{
TwoTevStageOrders& order = bpmem.tevorders[i >> 1];
if (order.getEnable(i & 1))
DebugUtil::CopyTempBuffer(Position[0], Position[1], DIRECT_TFETCH, i, "TFetch");
}
}
#endif

INCSTAT(g_stats.this_frame.tev_pixels_out);
EfbInterface::IncPerfCounterQuadCount(PQ_BLEND_INPUT);

Expand Down
6 changes: 0 additions & 6 deletions Source/Core/VideoCommon/VideoConfig.cpp
Expand Up @@ -104,12 +104,6 @@ void VideoConfig::Refresh()
iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS);
iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS);

bDumpObjects = Config::Get(Config::GFX_SW_DUMP_OBJECTS);
bDumpTevStages = Config::Get(Config::GFX_SW_DUMP_TEV_STAGES);
bDumpTevTextureFetches = Config::Get(Config::GFX_SW_DUMP_TEV_TEX_FETCHES);
drawStart = Config::Get(Config::GFX_SW_DRAW_START);
drawEnd = Config::Get(Config::GFX_SW_DRAW_END);

bForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING);
iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
Expand Down
7 changes: 0 additions & 7 deletions Source/Core/VideoCommon/VideoConfig.h
Expand Up @@ -148,13 +148,6 @@ struct VideoConfig final
// D3D only config, mostly to be merged into the above
int iAdapter = 0;

// VideoSW Debugging
int drawStart = 0;
int drawEnd = 0;
bool bDumpObjects = false;
bool bDumpTevStages = false;
bool bDumpTevTextureFetches = false;

// Enable API validation layers, currently only supported with Vulkan.
bool bEnableValidationLayer = false;

Expand Down