delete unused variables, rename some functions - minor stuff.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2339 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a1685984a0
commit
26f951d9d5
|
@ -774,6 +774,14 @@
|
||||||
RelativePath=".\Src\PixelShaderCache.h"
|
RelativePath=".\Src\PixelShaderCache.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\Render.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\Render.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\TextureMngr.cpp"
|
RelativePath=".\Src\TextureMngr.cpp"
|
||||||
>
|
>
|
||||||
|
@ -790,6 +798,14 @@
|
||||||
RelativePath=".\Src\VertexShaderCache.h"
|
RelativePath=".\Src\VertexShaderCache.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\XFB.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\XFB.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="GUI"
|
Name="GUI"
|
||||||
|
@ -899,6 +915,38 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="GLUtil"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\GLUtil.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\GLUtil.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\GLWindow.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\TextureConversionShader.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\TextureConversionShader.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\TextureConverter.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\TextureConverter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\Config.cpp"
|
RelativePath=".\Src\Config.cpp"
|
||||||
>
|
>
|
||||||
|
@ -915,18 +963,6 @@
|
||||||
RelativePath=".\Src\Globals.h"
|
RelativePath=".\Src\Globals.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\GLUtil.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\GLUtil.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\GLWindow.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\main.cpp"
|
RelativePath=".\Src\main.cpp"
|
||||||
>
|
>
|
||||||
|
@ -935,14 +971,6 @@
|
||||||
RelativePath=".\Src\main.h"
|
RelativePath=".\Src\main.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\Render.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\Render.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\SConscript"
|
RelativePath=".\Src\SConscript"
|
||||||
>
|
>
|
||||||
|
@ -1003,30 +1031,6 @@
|
||||||
RelativePath=".\Src\stdafx.h"
|
RelativePath=".\Src\stdafx.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\TextureConversionShader.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\TextureConversionShader.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\TextureConverter.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\TextureConverter.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\XFB.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Src\XFB.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
|
@ -37,6 +37,9 @@ struct Config
|
||||||
char iFSResolution[16];
|
char iFSResolution[16];
|
||||||
char iWindowedRes[16];
|
char iWindowedRes[16];
|
||||||
char iBackend[16];
|
char iBackend[16];
|
||||||
|
|
||||||
|
// stretch to fit should be split into two options, I think - one for low resolution backbuffer,
|
||||||
|
// one for ignore aspect ratio. I guess KeepAR sort of does that. Anyway, these should be rethought.
|
||||||
bool bStretchToFit;
|
bool bStretchToFit;
|
||||||
bool bKeepAR;
|
bool bKeepAR;
|
||||||
bool bHideCursor;
|
bool bHideCursor;
|
||||||
|
|
|
@ -37,11 +37,9 @@ struct RECT
|
||||||
// Handles OpenGL and the window
|
// Handles OpenGL and the window
|
||||||
|
|
||||||
// externals
|
// externals
|
||||||
int gleft, gright, gtop, gbottom;
|
|
||||||
int nBackbufferWidth, nBackbufferHeight; // screen width
|
int nBackbufferWidth, nBackbufferHeight; // screen width
|
||||||
int nXoff, nYoff; // screen offset
|
int nXoff, nYoff; // screen offset
|
||||||
float MValueX, MValueY;
|
float MValueX, MValueY;
|
||||||
float AR; // aspect ratio
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
GLWindow GLWin;
|
GLWindow GLWin;
|
||||||
|
@ -722,7 +720,6 @@ void OpenGL_Update()
|
||||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||||
AR = (float)nBackbufferWidth / (float)nBackbufferHeight;
|
|
||||||
|
|
||||||
if (g_Config.bStretchToFit)
|
if (g_Config.bStretchToFit)
|
||||||
{
|
{
|
||||||
|
@ -738,14 +735,9 @@ void OpenGL_Update()
|
||||||
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
|
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
|
||||||
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
|
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the debugger
|
|
||||||
gleft = rcWindow.left; gright = rcWindow.right;
|
|
||||||
gtop = rcWindow.top; gbottom = rcWindow.bottom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
// Close plugin
|
// Close plugin
|
||||||
// ----------------
|
// ----------------
|
||||||
|
|
|
@ -551,7 +551,7 @@ void WriteCC8Encoder(char* p, const char* comp)
|
||||||
WRITE(p, "}\n");
|
WRITE(p, "}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *GenerateEncodingShader(u32 format)
|
const char *GenerateEncodingShader(u32 format)
|
||||||
{
|
{
|
||||||
text[sizeof(text) - 1] = 0x7C; // canary
|
text[sizeof(text) - 1] = 0x7C; // canary
|
||||||
|
|
||||||
|
@ -653,8 +653,6 @@ void SetShaderParameters(u32 width, u32 height, u32 offsetX, u32 offsetY, float
|
||||||
|
|
||||||
SetPSConstant4f(C_COLORMATRIX, (float)blkW, (float)blkH, (float)samples, pixelStride);
|
SetPSConstant4f(C_COLORMATRIX, (float)blkW, (float)blkH, (float)samples, pixelStride);
|
||||||
SetPSConstant4f(C_COLORMATRIX + 1, (float)width, (float)(height - 1), (float)offsetX, (float)offsetY);
|
SetPSConstant4f(C_COLORMATRIX + 1, (float)width, (float)(height - 1), (float)offsetX, (float)offsetY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
}
|
|
||||||
|
|
|
@ -26,16 +26,13 @@ namespace TextureConversionShader
|
||||||
{
|
{
|
||||||
|
|
||||||
u16 GetBlockWidthInTexels(u32 format);
|
u16 GetBlockWidthInTexels(u32 format);
|
||||||
|
|
||||||
u16 GetBlockHeightInTexels(u32 format);
|
u16 GetBlockHeightInTexels(u32 format);
|
||||||
|
|
||||||
u16 GetEncodedSampleCount(u32 format);
|
u16 GetEncodedSampleCount(u32 format);
|
||||||
|
|
||||||
char *GenerateEncodingShader(u32 format);
|
const char *GenerateEncodingShader(u32 format);
|
||||||
|
|
||||||
void SetShaderParameters(u32 width, u32 height, u32 offsetX, u32 offsetY, float pixelStride, u32 format);
|
void SetShaderParameters(u32 width, u32 height, u32 offsetX, u32 offsetY, float pixelStride, u32 format);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -15,6 +15,9 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
// Fast image conversion using OpenGL shaders.
|
||||||
|
// This kind of stuff would be a LOT nicer with OpenCL.
|
||||||
|
|
||||||
#include "TextureConverter.h"
|
#include "TextureConverter.h"
|
||||||
#include "TextureConversionShader.h"
|
#include "TextureConversionShader.h"
|
||||||
#include "PixelShaderCache.h"
|
#include "PixelShaderCache.h"
|
||||||
|
@ -27,7 +30,7 @@
|
||||||
namespace TextureConverter
|
namespace TextureConverter
|
||||||
{
|
{
|
||||||
|
|
||||||
static GLuint s_frameBuffer = 0;
|
static GLuint s_texConvFrameBuffer = 0;
|
||||||
static GLuint s_srcTexture = 0; // for decoding from RAM
|
static GLuint s_srcTexture = 0; // for decoding from RAM
|
||||||
static GLuint s_dstRenderBuffer = 0; // for encoding to RAM
|
static GLuint s_dstRenderBuffer = 0; // for encoding to RAM
|
||||||
|
|
||||||
|
@ -41,11 +44,10 @@ static FRAGMENTSHADER s_yuyvToRgbProgram;
|
||||||
const u32 NUM_ENCODING_PROGRAMS = 64;
|
const u32 NUM_ENCODING_PROGRAMS = 64;
|
||||||
static FRAGMENTSHADER s_encodingPrograms[NUM_ENCODING_PROGRAMS];
|
static FRAGMENTSHADER s_encodingPrograms[NUM_ENCODING_PROGRAMS];
|
||||||
|
|
||||||
|
|
||||||
void CreateRgbToYuyvProgram()
|
void CreateRgbToYuyvProgram()
|
||||||
{
|
{
|
||||||
// output is BGRA because that is slightly faster than RGBA
|
// output is BGRA because that is slightly faster than RGBA
|
||||||
char *FProgram = (char *)
|
const char *FProgram =
|
||||||
"uniform samplerRECT samp0 : register(s0);\n"
|
"uniform samplerRECT samp0 : register(s0);\n"
|
||||||
"void main(\n"
|
"void main(\n"
|
||||||
" out float4 ocol0 : COLOR0,\n"
|
" out float4 ocol0 : COLOR0,\n"
|
||||||
|
@ -72,7 +74,7 @@ void CreateRgbToYuyvProgram()
|
||||||
|
|
||||||
void CreateYuyvToRgbProgram()
|
void CreateYuyvToRgbProgram()
|
||||||
{
|
{
|
||||||
char *FProgram = (char *)
|
const char *FProgram =
|
||||||
"uniform samplerRECT samp0 : register(s0);\n"
|
"uniform samplerRECT samp0 : register(s0);\n"
|
||||||
"void main(\n"
|
"void main(\n"
|
||||||
" out float4 ocol0 : COLOR0,\n"
|
" out float4 ocol0 : COLOR0,\n"
|
||||||
|
@ -99,7 +101,7 @@ void CreateYuyvToRgbProgram()
|
||||||
|
|
||||||
FRAGMENTSHADER& GetOrCreateEncodingShader(u32 format)
|
FRAGMENTSHADER& GetOrCreateEncodingShader(u32 format)
|
||||||
{
|
{
|
||||||
if(format > NUM_ENCODING_PROGRAMS)
|
if (format > NUM_ENCODING_PROGRAMS)
|
||||||
{
|
{
|
||||||
PanicAlert("Unknown texture copy format: 0x%x\n", format);
|
PanicAlert("Unknown texture copy format: 0x%x\n", format);
|
||||||
return s_encodingPrograms[0];
|
return s_encodingPrograms[0];
|
||||||
|
@ -107,9 +109,9 @@ FRAGMENTSHADER& GetOrCreateEncodingShader(u32 format)
|
||||||
|
|
||||||
// todo - this does not handle the case that an application is using RGB555/4443
|
// todo - this does not handle the case that an application is using RGB555/4443
|
||||||
// and switches EFB formats between a format that does and does not support alpha
|
// and switches EFB formats between a format that does and does not support alpha
|
||||||
if(s_encodingPrograms[format].glprogid == 0)
|
if (s_encodingPrograms[format].glprogid == 0)
|
||||||
{
|
{
|
||||||
char* shader = TextureConversionShader::GenerateEncodingShader(format);
|
const char* shader = TextureConversionShader::GenerateEncodingShader(format);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
if (g_Config.iLog & CONF_SAVESHADERS && shader) {
|
if (g_Config.iLog & CONF_SAVESHADERS && shader) {
|
||||||
|
@ -132,7 +134,7 @@ FRAGMENTSHADER& GetOrCreateEncodingShader(u32 format)
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
glGenFramebuffersEXT( 1, &s_frameBuffer);
|
glGenFramebuffersEXT( 1, &s_texConvFrameBuffer);
|
||||||
|
|
||||||
glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
|
glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||||
|
@ -150,13 +152,10 @@ void Init()
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &s_srcTexture);
|
glDeleteTextures(1, &s_srcTexture);
|
||||||
|
|
||||||
glDeleteRenderbuffersEXT(1, &s_dstRenderBuffer);
|
glDeleteRenderbuffersEXT(1, &s_dstRenderBuffer);
|
||||||
|
glDeleteFramebuffersEXT(1, &s_texConvFrameBuffer);
|
||||||
glDeleteFramebuffersEXT(1, &s_frameBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
u8* destAddr, int dstWidth, int dstHeight, bool linearFilter, FRAGMENTSHADER& shader)
|
u8* destAddr, int dstWidth, int dstHeight, bool linearFilter, FRAGMENTSHADER& shader)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +165,7 @@ void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
|
|
||||||
// switch to texture converter frame buffer
|
// switch to texture converter frame buffer
|
||||||
// attach render buffer as color destination
|
// attach render buffer as color destination
|
||||||
Renderer::SetFramebuffer(s_frameBuffer);
|
Renderer::SetFramebuffer(s_texConvFrameBuffer);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
@ -185,7 +184,6 @@ void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
|
|
||||||
TextureMngr::EnableTexRECT(0);
|
TextureMngr::EnableTexRECT(0);
|
||||||
for (int i = 1; i < 8; ++i)
|
for (int i = 1; i < 8; ++i)
|
||||||
|
@ -195,7 +193,7 @@ void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
glViewport(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight);
|
glViewport(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight);
|
||||||
|
|
||||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||||
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, shader.glprogid);
|
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader.glprogid);
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f((float)sourceRc.left, (float)sourceRc.top); glVertex2f(-1,-1);
|
glTexCoord2f((float)sourceRc.left, (float)sourceRc.top); glVertex2f(-1,-1);
|
||||||
|
@ -224,23 +222,22 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
|
||||||
{
|
{
|
||||||
u32 format = copyfmt;
|
u32 format = copyfmt;
|
||||||
|
|
||||||
if(bFromZBuffer)
|
if (bFromZBuffer)
|
||||||
{
|
{
|
||||||
format |= _GX_TF_ZTF;
|
format |= _GX_TF_ZTF;
|
||||||
if(copyfmt == 11)
|
if (copyfmt == 11)
|
||||||
format = GX_TF_Z16;
|
format = GX_TF_Z16;
|
||||||
else if(format < GX_TF_Z8 || format > GX_TF_Z24X8)
|
else if (format < GX_TF_Z8 || format > GX_TF_Z24X8)
|
||||||
format |= _GX_TF_CTF;
|
format |= _GX_TF_CTF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !bIsIntensityFmt))
|
if (copyfmt > GX_TF_RGBA8 || (copyfmt < GX_TF_RGB565 && !bIsIntensityFmt))
|
||||||
format |= _GX_TF_CTF;
|
format |= _GX_TF_CTF;
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAGMENTSHADER& fs = GetOrCreateEncodingShader(format);
|
FRAGMENTSHADER& fs = GetOrCreateEncodingShader(format);
|
||||||
|
if (fs.glprogid == 0)
|
||||||
if(fs.glprogid == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u8* ptr = Memory_GetPtr(address);
|
u8* ptr = Memory_GetPtr(address);
|
||||||
|
@ -249,8 +246,7 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
|
||||||
|
|
||||||
s32 width = source.right - source.left;
|
s32 width = source.right - source.left;
|
||||||
s32 height = source.bottom - source.top;
|
s32 height = source.bottom - source.top;
|
||||||
|
if (bScaleByHalf)
|
||||||
if(bScaleByHalf)
|
|
||||||
{
|
{
|
||||||
width /= 2;
|
width /= 2;
|
||||||
height /= 2;
|
height /= 2;
|
||||||
|
@ -277,11 +273,11 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
|
||||||
|
|
||||||
EncodeToRam(target, scaledSource, ptr, expandedWidth / samples, expandedHeight, bScaleByHalf, fs);
|
EncodeToRam(target, scaledSource, ptr, expandedWidth / samples, expandedHeight, bScaleByHalf, fs);
|
||||||
|
|
||||||
if (bFromZBuffer )
|
if (bFromZBuffer)
|
||||||
Renderer::SetZBufferRender(); // notify for future settings
|
Renderer::SetZBufferRender(); // notify for future settings
|
||||||
}
|
}
|
||||||
|
|
||||||
void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
void EncodeToRamYUYV(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
u8* destAddr, int dstWidth, int dstHeight)
|
u8* destAddr, int dstWidth, int dstHeight)
|
||||||
{
|
{
|
||||||
EncodeToRam(srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, false, s_rgbToYuyvProgram);
|
EncodeToRam(srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, false, s_rgbToYuyvProgram);
|
||||||
|
@ -291,7 +287,6 @@ void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture)
|
void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture)
|
||||||
{
|
{
|
||||||
Renderer::SetRenderMode(Renderer::RM_Normal);
|
Renderer::SetRenderMode(Renderer::RM_Normal);
|
||||||
|
|
||||||
Renderer::ResetGLState();
|
Renderer::ResetGLState();
|
||||||
|
|
||||||
float srcFormatFactor = 0.5f;
|
float srcFormatFactor = 0.5f;
|
||||||
|
@ -299,7 +294,7 @@ void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||||
|
|
||||||
// swich to texture converter frame buffer
|
// swich to texture converter frame buffer
|
||||||
// attach destTexture as color destination
|
// attach destTexture as color destination
|
||||||
Renderer::SetFramebuffer(s_frameBuffer);
|
Renderer::SetFramebuffer(s_texConvFrameBuffer);
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, destTexture);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, destTexture);
|
||||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, destTexture, 0);
|
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, destTexture, 0);
|
||||||
|
|
||||||
|
@ -308,7 +303,7 @@ void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture);
|
||||||
|
|
||||||
// TODO: make this less slow.
|
// TODO: make this less slow. (How?)
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, (GLsizei)srcFmtWidth, (GLsizei)srcHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, (GLsizei)srcFmtWidth, (GLsizei)srcHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr);
|
||||||
|
|
||||||
TextureMngr::EnableTexRECT(0);
|
TextureMngr::EnableTexRECT(0);
|
||||||
|
@ -339,4 +334,4 @@ void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
|
@ -32,7 +32,7 @@ void Shutdown();
|
||||||
void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt,
|
void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt,
|
||||||
u32 copyfmt, bool bScaleByHalf, const TRectangle& source);
|
u32 copyfmt, bool bScaleByHalf, const TRectangle& source);
|
||||||
|
|
||||||
void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc,
|
void EncodeToRamYUYV(GLuint srcTexture, const TRectangle& sourceRc,
|
||||||
u8* destAddr, int dstWidth, int dstHeight);
|
u8* destAddr, int dstWidth, int dstHeight);
|
||||||
|
|
||||||
void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture);
|
void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture);
|
||||||
|
|
|
@ -87,7 +87,7 @@ void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt)
|
||||||
renderSrcRc.right = sourceRc.right;
|
renderSrcRc.right = sourceRc.right;
|
||||||
renderSrcRc.top = nBackbufferHeight - sourceRc.top;
|
renderSrcRc.top = nBackbufferHeight - sourceRc.top;
|
||||||
renderSrcRc.bottom = nBackbufferHeight - sourceRc.bottom;
|
renderSrcRc.bottom = nBackbufferHeight - sourceRc.bottom;
|
||||||
TextureConverter::EncodeToRam(Renderer::GetRenderTarget(), renderSrcRc, xfb_in_ram, dstWd, dstHt);
|
TextureConverter::EncodeToRamYUYV(Renderer::GetRenderTarget(), renderSrcRc, xfb_in_ram, dstWd, dstHt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
|
void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
|
||||||
|
@ -223,7 +223,6 @@ void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt)
|
||||||
Renderer::RestoreGLState();
|
Renderer::RestoreGLState();
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
// TODO - use shader for conversion
|
|
||||||
ConvertToXFB((u32 *)xfb_in_ram, efb_buffer, dstWd, dstHt);
|
ConvertToXFB((u32 *)xfb_in_ram, efb_buffer, dstWd, dstHt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +238,6 @@ void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
|
||||||
|
|
||||||
Renderer::ResetGLState();
|
Renderer::ResetGLState();
|
||||||
|
|
||||||
// TODO - use shader for conversion
|
|
||||||
ConvertFromXFB((u32 *)xfb_buffer, xfb_in_ram, width, height);
|
ConvertFromXFB((u32 *)xfb_buffer, xfb_in_ram, width, height);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
Loading…
Reference in New Issue