D3D-TextureEncoder: Remove TCache::Entry usage

This commit is contained in:
degasus 2015-10-29 08:55:50 +01:00
parent 71b22702a1
commit d7d8704353
3 changed files with 13 additions and 13 deletions

View File

@ -87,7 +87,7 @@ void PSTextureEncoder::Shutdown()
SAFE_RELEASE(m_out); SAFE_RELEASE(m_out);
} }
void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *texture_entry, void PSTextureEncoder::Encode(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf) bool isIntensity, bool scaleByHalf)
{ {
@ -101,9 +101,9 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
// Set up all the state for EFB encoding // Set up all the state for EFB encoding
{ {
const u32 words_per_row = texture_entry->BytesPerRow() / sizeof(u32); const u32 words_per_row = bytes_per_row / sizeof(u32);
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(words_per_row), FLOAT(texture_entry->NumBlocksY())); D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(words_per_row), FLOAT(num_blocks_y));
D3D::context->RSSetViewports(1, &vp); D3D::context->RSSetViewports(1, &vp);
EFBRectangle fullSrcRect; EFBRectangle fullSrcRect;
@ -125,7 +125,7 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
EFBEncodeParams params; EFBEncodeParams params;
params.SrcLeft = srcRect.left; params.SrcLeft = srcRect.left;
params.SrcTop = srcRect.top; params.SrcTop = srcRect.top;
params.DestWidth = texture_entry->native_width; params.DestWidth = native_width;
params.ScaleFactor = scaleByHalf ? 2 : 1; params.ScaleFactor = scaleByHalf ? 2 : 1;
D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, &params, 0, 0); D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, &params, 0, 0);
D3D::stateman->SetPixelConstants(m_encodeParams); D3D::stateman->SetPixelConstants(m_encodeParams);
@ -140,12 +140,12 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
targetRect.AsRECT(), targetRect.AsRECT(),
Renderer::GetTargetWidth(), Renderer::GetTargetWidth(),
Renderer::GetTargetHeight(), Renderer::GetTargetHeight(),
SetStaticShader(texture_entry->format, srcFormat, isIntensity, scaleByHalf), SetStaticShader(format, srcFormat, isIntensity, scaleByHalf),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout()); VertexShaderCache::GetSimpleInputLayout());
// Copy to staging buffer // Copy to staging buffer
D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, words_per_row, texture_entry->NumBlocksY(), 1); D3D11_BOX srcBox = CD3D11_BOX(0, 0, 0, words_per_row, num_blocks_y, 1);
D3D::context->CopySubresourceRegion(m_outStage, 0, 0, 0, 0, m_out, 0, &srcBox); D3D::context->CopySubresourceRegion(m_outStage, 0, 0, 0, 0, m_out, 0, &srcBox);
// Transfer staging buffer to GameCube/Wii RAM // Transfer staging buffer to GameCube/Wii RAM
@ -154,11 +154,11 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
CHECK(SUCCEEDED(hr), "map staging buffer (0x%x)", hr); CHECK(SUCCEEDED(hr), "map staging buffer (0x%x)", hr);
u8* src = (u8*)map.pData; u8* src = (u8*)map.pData;
u32 readStride = std::min(texture_entry->BytesPerRow(), map.RowPitch); u32 readStride = std::min(bytes_per_row, map.RowPitch);
for (unsigned int y = 0; y < texture_entry->NumBlocksY(); ++y) for (unsigned int y = 0; y < num_blocks_y; ++y)
{ {
memcpy(dst, src, readStride); memcpy(dst, src, readStride);
dst += texture_entry->memory_stride; dst += memory_stride;
src += map.RowPitch; src += map.RowPitch;
} }

View File

@ -31,7 +31,7 @@ public:
void Init(); void Init();
void Shutdown(); void Shutdown();
void Encode(u8* dst, const TextureCacheBase::TCacheEntryBase* texture_entry, void Encode(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf); bool isIntensity, bool scaleByHalf);

View File

@ -240,7 +240,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, unsigned int dstFormat
if (g_ActiveConfig.bSkipEFBCopyToRam) if (g_ActiveConfig.bSkipEFBCopyToRam)
this->Zero(dst); this->Zero(dst);
else else
g_encoder->Encode(dst, this, srcFormat, srcRect, isIntensity, scaleByHalf); g_encoder->Encode(dst, format, native_width, BytesPerRow(), NumBlocksY(), memory_stride, srcFormat, srcRect, isIntensity, scaleByHalf);
} }
const char palette_shader[] = const char palette_shader[] =