D3D-TextureEncoder: Remove TCache::Entry usage
This commit is contained in:
parent
71b22702a1
commit
d7d8704353
|
@ -87,7 +87,7 @@ void PSTextureEncoder::Shutdown()
|
|||
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,
|
||||
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
|
||||
{
|
||||
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);
|
||||
|
||||
EFBRectangle fullSrcRect;
|
||||
|
@ -125,7 +125,7 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
|
|||
EFBEncodeParams params;
|
||||
params.SrcLeft = srcRect.left;
|
||||
params.SrcTop = srcRect.top;
|
||||
params.DestWidth = texture_entry->native_width;
|
||||
params.DestWidth = native_width;
|
||||
params.ScaleFactor = scaleByHalf ? 2 : 1;
|
||||
D3D::context->UpdateSubresource(m_encodeParams, 0, nullptr, ¶ms, 0, 0);
|
||||
D3D::stateman->SetPixelConstants(m_encodeParams);
|
||||
|
@ -140,12 +140,12 @@ void PSTextureEncoder::Encode(u8* dst, const TextureCache::TCacheEntryBase *text
|
|||
targetRect.AsRECT(),
|
||||
Renderer::GetTargetWidth(),
|
||||
Renderer::GetTargetHeight(),
|
||||
SetStaticShader(texture_entry->format, srcFormat, isIntensity, scaleByHalf),
|
||||
SetStaticShader(format, srcFormat, isIntensity, scaleByHalf),
|
||||
VertexShaderCache::GetSimpleVertexShader(),
|
||||
VertexShaderCache::GetSimpleInputLayout());
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
u8* src = (u8*)map.pData;
|
||||
u32 readStride = std::min(texture_entry->BytesPerRow(), map.RowPitch);
|
||||
for (unsigned int y = 0; y < texture_entry->NumBlocksY(); ++y)
|
||||
u32 readStride = std::min(bytes_per_row, map.RowPitch);
|
||||
for (unsigned int y = 0; y < num_blocks_y; ++y)
|
||||
{
|
||||
memcpy(dst, src, readStride);
|
||||
dst += texture_entry->memory_stride;
|
||||
dst += memory_stride;
|
||||
src += map.RowPitch;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ public:
|
|||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Encode(u8* dst, const TextureCacheBase::TCacheEntryBase* texture_entry,
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf);
|
||||
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,
|
||||
bool isIntensity, bool scaleByHalf);
|
||||
|
||||
private:
|
||||
bool m_ready;
|
||||
|
|
|
@ -240,7 +240,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dst, unsigned int dstFormat
|
|||
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
||||
this->Zero(dst);
|
||||
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[] =
|
||||
|
|
Loading…
Reference in New Issue