Finish implementing gamma correction in DX9.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6697 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8a711eadac
commit
41c40bcd50
|
@ -38,6 +38,14 @@ u32 mapTexAddress;
|
||||||
bool mapTexFound;
|
bool mapTexFound;
|
||||||
int numWrites;
|
int numWrites;
|
||||||
|
|
||||||
|
static const float s_gammaLUT[] =
|
||||||
|
{
|
||||||
|
1.0f,
|
||||||
|
1.7f,
|
||||||
|
2.2f,
|
||||||
|
1.0f
|
||||||
|
};
|
||||||
|
|
||||||
void BPInit()
|
void BPInit()
|
||||||
{
|
{
|
||||||
memset(&bpmem, 0, sizeof(bpmem));
|
memset(&bpmem, 0, sizeof(bpmem));
|
||||||
|
@ -48,9 +56,9 @@ void BPInit()
|
||||||
mapTexFound = false;
|
mapTexFound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight)
|
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight, float gamma)
|
||||||
{
|
{
|
||||||
Renderer::RenderToXFB(xfbAddr, dstWidth, dstHeight, rc);
|
Renderer::RenderToXFB(xfbAddr, dstWidth, dstHeight, rc, gamma);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPWritten(const BPCmd& bp)
|
void BPWritten(const BPCmd& bp)
|
||||||
|
@ -272,7 +280,8 @@ void BPWritten(const BPCmd& bp)
|
||||||
RenderToXFB(bp, rc, yScale, xfbLines,
|
RenderToXFB(bp, rc, yScale, xfbLines,
|
||||||
bpmem.copyTexDest << 5,
|
bpmem.copyTexDest << 5,
|
||||||
bpmem.copyMipMapStrideChannels << 4,
|
bpmem.copyMipMapStrideChannels << 4,
|
||||||
(u32)xfbLines);
|
(u32)xfbLines,
|
||||||
|
s_gammaLUT[PE_copy.gamma]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the rectangular region after copying it.
|
// Clear the rectangular region after copying it.
|
||||||
|
|
|
@ -90,7 +90,7 @@ Renderer::~Renderer()
|
||||||
prev_efb_format = (unsigned int)-1;
|
prev_efb_format = (unsigned int)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma)
|
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma)
|
||||||
{
|
{
|
||||||
if (!fbWidth || !fbHeight)
|
if (!fbWidth || !fbHeight)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -282,7 +282,7 @@ void EncodeToRamUsingShader(LPDIRECT3DPIXELSHADER9 shader, LPDIRECT3DTEXTURE9 sr
|
||||||
|
|
||||||
|
|
||||||
// Draw...
|
// Draw...
|
||||||
D3D::drawShadedTexQuad(srcTexture,&SrcRect,1,1,dstWidth,dstHeight,shader,VertexShaderCache::GetSimpleVertexShader(0));
|
D3D::drawShadedTexQuad(srcTexture,&SrcRect,1,1,dstWidth,dstHeight,shader,VertexShaderCache::GetSimpleVertexShader(0), Gamma);
|
||||||
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
|
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
|
||||||
// .. and then read back the results.
|
// .. and then read back the results.
|
||||||
// TODO: make this less slow.
|
// TODO: make this less slow.
|
||||||
|
|
Loading…
Reference in New Issue