mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
cleanup + some eolz
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5842 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -357,8 +357,8 @@ void BPWritten(const BPCmd& bp)
|
|||||||
// Bounding Box Control
|
// Bounding Box Control
|
||||||
// -------------------------
|
// -------------------------
|
||||||
case BPMEM_CLEARBBOX1:
|
case BPMEM_CLEARBBOX1:
|
||||||
case BPMEM_CLEARBBOX2: {
|
case BPMEM_CLEARBBOX2:
|
||||||
|
{
|
||||||
#ifdef BBOX_SUPPORT
|
#ifdef BBOX_SUPPORT
|
||||||
// which is which? these are GUESSES!
|
// which is which? these are GUESSES!
|
||||||
if (bp.address == BPMEM_CLEARBBOX1) {
|
if (bp.address == BPMEM_CLEARBBOX1) {
|
||||||
@ -381,8 +381,8 @@ void BPWritten(const BPCmd& bp)
|
|||||||
// WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom);
|
// WARN_LOG(VIDEO, "ClearBBox TB: %i, %08x - %i, %i", bp.address, bp.newvalue, top, bottom);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
|
case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow
|
||||||
DEBUG_LOG(VIDEO, "BP Texture Invalid: %08x", bp.newvalue);
|
DEBUG_LOG(VIDEO, "BP Texture Invalid: %08x", bp.newvalue);
|
||||||
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
|
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
|
||||||
|
@ -83,7 +83,8 @@ sDecoderParameter g_DecodeParametersRGBA[] = {
|
|||||||
bool g_Inited = false;
|
bool g_Inited = false;
|
||||||
cl_mem g_clsrc, g_cldst; // texture buffer memory objects
|
cl_mem g_clsrc, g_cldst; // texture buffer memory objects
|
||||||
|
|
||||||
void TexDecoder_OpenCL_Initialize() {
|
void TexDecoder_OpenCL_Initialize()
|
||||||
|
{
|
||||||
#if defined(HAVE_OPENCL) && HAVE_OPENCL
|
#if defined(HAVE_OPENCL) && HAVE_OPENCL
|
||||||
if(!g_Inited)
|
if(!g_Inited)
|
||||||
{
|
{
|
||||||
@ -124,7 +125,8 @@ void TexDecoder_OpenCL_Initialize() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TexDecoder_OpenCL_Shutdown() {
|
void TexDecoder_OpenCL_Shutdown()
|
||||||
|
{
|
||||||
#if defined(HAVE_OPENCL) && HAVE_OPENCL && !defined(DEBUG_OPENCL)
|
#if defined(HAVE_OPENCL) && HAVE_OPENCL && !defined(DEBUG_OPENCL)
|
||||||
|
|
||||||
clReleaseProgram(g_program);
|
clReleaseProgram(g_program);
|
||||||
|
@ -96,7 +96,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable)
|
|||||||
case 0: pcurvalue[0] = val0|(val1<<10); break;
|
case 0: pcurvalue[0] = val0|(val1<<10); break;
|
||||||
case 1: pcurvalue[0] |= val0<<20; pcurvalue[1] = val1; pcurvalue++; break;
|
case 1: pcurvalue[0] |= val0<<20; pcurvalue[1] = val1; pcurvalue++; break;
|
||||||
case 2: pcurvalue[1] |= (val0<<10)|(val1<<20); pcurvalue++; break;
|
case 2: pcurvalue[1] |= (val0<<10)|(val1<<20); pcurvalue++; break;
|
||||||
default: PanicAlert("Uknown case for Tev Stages / 2: %08x", (i % 3));
|
default: PanicAlert("Unknown case for Tev Stages / 2: %08x", (i % 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable)
|
|||||||
case 0: pcurvalue[0] = val0; break;
|
case 0: pcurvalue[0] = val0; break;
|
||||||
case 1: pcurvalue[0] |= val0 << 20; break;
|
case 1: pcurvalue[0] |= val0 << 20; break;
|
||||||
case 2: pcurvalue[1] |= val0 << 10; pcurvalue++; break;
|
case 2: pcurvalue[1] |= val0 << 10; pcurvalue++; break;
|
||||||
default: PanicAlert("Uknown case for Tev Stages: %08x", bpmem.genMode.numtevstages % 3);
|
default: PanicAlert("Unknown case for Tev Stages: %08x", bpmem.genMode.numtevstages % 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, u32 texturemask, u32 dstAlphaEnable)
|
|||||||
case 0: pcurvalue[0] = val; break;
|
case 0: pcurvalue[0] = val; break;
|
||||||
case 1: pcurvalue[0] |= val << 21; pcurvalue[1] = val >> 11; ++pcurvalue; break;
|
case 1: pcurvalue[0] |= val << 21; pcurvalue[1] = val >> 11; ++pcurvalue; break;
|
||||||
case 2: pcurvalue[0] |= val << 10; ++pcurvalue; break;
|
case 2: pcurvalue[0] |= val << 10; ++pcurvalue; break;
|
||||||
default: PanicAlert("Uknown case for Ind Stages: %08x", (i % 3));
|
default: PanicAlert("Unknown case for Ind Stages: %08x", (i % 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ static const char *tevCInputTable[] = // CC
|
|||||||
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
||||||
"(konsttemp.rgb)", //"konsttemp.rgb", // KONST
|
"(konsttemp.rgb)", //"konsttemp.rgb", // KONST
|
||||||
"float3(0.0f, 0.0f, 0.0f)", // ZERO
|
"float3(0.0f, 0.0f, 0.0f)", // ZERO
|
||||||
"PADERROR", "PADERROR", "PADERROR", "PADERROR",
|
"PADERROR", "PADERROR", "PADERROR", "PADERROR"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *tevAInputTable[] = // CA
|
static const char *tevAInputTable[] = // CA
|
||||||
@ -454,18 +454,9 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, API_
|
|||||||
|
|
||||||
WRITE(p, "void main(\n");
|
WRITE(p, "void main(\n");
|
||||||
if(ApiType != API_D3D11)
|
if(ApiType != API_D3D11)
|
||||||
WRITE(p, " out float4 ocol0 : COLOR0,\n");
|
WRITE(p, " out float4 ocol0 : COLOR0,\n out float depth : DEPTH,\n in float4 rawpos : POSITION,\n");
|
||||||
else
|
else
|
||||||
WRITE(p, " out float4 ocol0 : SV_Target,\n");
|
WRITE(p, " out float4 ocol0 : SV_Target,\n out float depth : SV_Depth,\n in float4 rawpos : SV_Position,\n");
|
||||||
|
|
||||||
if(ApiType != API_D3D11)
|
|
||||||
WRITE(p, " out float depth : DEPTH,\n");
|
|
||||||
else
|
|
||||||
WRITE(p, " out float depth : SV_Depth,\n");
|
|
||||||
if(ApiType != API_D3D11)
|
|
||||||
WRITE(p, " in float4 rawpos : POSITION,\n");
|
|
||||||
else
|
|
||||||
WRITE(p, " in float4 rawpos : SV_Position,\n");
|
|
||||||
|
|
||||||
WRITE(p, " in float4 colors_0 : COLOR0,\n");
|
WRITE(p, " in float4 colors_0 : COLOR0,\n");
|
||||||
WRITE(p, " in float4 colors_1 : COLOR1\n");
|
WRITE(p, " in float4 colors_1 : COLOR1\n");
|
||||||
@ -596,7 +587,6 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, API_
|
|||||||
WRITE(p, "zCoord = frac(zCoord);\n");
|
WRITE(p, "zCoord = frac(zCoord);\n");
|
||||||
WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n");
|
WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE(p, "depth = zCoord;\n");
|
WRITE(p, "depth = zCoord;\n");
|
||||||
|
|
||||||
if (dstAlphaEnable)
|
if (dstAlphaEnable)
|
||||||
@ -608,8 +598,6 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, API_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE(p, "}\n");
|
|
||||||
|
|
||||||
if (text[sizeof(text) - 1] != 0x7C)
|
if (text[sizeof(text) - 1] != 0x7C)
|
||||||
PanicAlert("PixelShader generator - buffer too small, canary has been eaten!");
|
PanicAlert("PixelShader generator - buffer too small, canary has been eaten!");
|
||||||
|
|
||||||
@ -821,7 +809,6 @@ static void WriteStage(char *&p, int n, u32 texture_mask, API_TYPE ApiType)
|
|||||||
RegisterStates[1].AuxStored = true;
|
RegisterStates[1].AuxStored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(cc.a == TEVCOLORARG_C1
|
if(cc.a == TEVCOLORARG_C1
|
||||||
|| cc.a == TEVCOLORARG_A1
|
|| cc.a == TEVCOLORARG_A1
|
||||||
|| cc.b == TEVCOLORARG_C1
|
|| cc.b == TEVCOLORARG_C1
|
||||||
@ -993,7 +980,8 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con
|
|||||||
else
|
else
|
||||||
WRITE(p, "%s=texRECT(samp%d,tempcoord.xy).%s;\n", destination, texmap, texswap);
|
WRITE(p, "%s=texRECT(samp%d,tempcoord.xy).%s;\n", destination, texmap, texswap);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (ApiType == API_D3D11)
|
if (ApiType == API_D3D11)
|
||||||
WRITE(p, "%s=Tex%d.Sample(samp%d,%s.xy).%s;\n", destination,texmap,texmap, texcoords, texswap);
|
WRITE(p, "%s=Tex%d.Sample(samp%d,%s.xy).%s;\n", destination,texmap,texmap, texcoords, texswap);
|
||||||
else if (ApiType == API_D3D9)
|
else if (ApiType == API_D3D9)
|
||||||
@ -1002,7 +990,8 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con
|
|||||||
WRITE(p, "%s=texRECT(samp%d,%s.xy).%s;\n", destination, texmap, texcoords, texswap);
|
WRITE(p, "%s=texRECT(samp%d,%s.xy).%s;\n", destination, texmap, texcoords, texswap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (ApiType == API_D3D11)
|
if (ApiType == API_D3D11)
|
||||||
WRITE(p, "%s=Tex%d.Sample(samp%d,%s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap,texmap, texcoords, texmap, texswap);
|
WRITE(p, "%s=Tex%d.Sample(samp%d,%s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap,texmap, texcoords, texmap, texswap);
|
||||||
else
|
else
|
||||||
@ -1035,7 +1024,7 @@ static bool WriteAlphaTest(char *&p, API_TYPE ApiType)
|
|||||||
u32 op = bpmem.alphaFunc.logic;
|
u32 op = bpmem.alphaFunc.logic;
|
||||||
u32 comp[2] = {bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1};
|
u32 comp[2] = {bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1};
|
||||||
|
|
||||||
//first kill all the simple cases
|
// First kill all the simple cases
|
||||||
switch(op)
|
switch(op)
|
||||||
{
|
{
|
||||||
case 0: // AND
|
case 0: // AND
|
||||||
|
@ -202,9 +202,9 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
WRITE(p, "float3 _norm1 = float3(dot(N0, rawnorm1), dot(N1, rawnorm1), dot(N2, rawnorm1));\n");
|
WRITE(p, "float3 _norm1 = float3(dot(N0, rawnorm1), dot(N1, rawnorm1), dot(N2, rawnorm1));\n");
|
||||||
if (components & VB_HAS_NRM2)
|
if (components & VB_HAS_NRM2)
|
||||||
WRITE(p, "float3 _norm2 = float3(dot(N0, rawnorm2), dot(N1, rawnorm2), dot(N2, rawnorm2));\n");
|
WRITE(p, "float3 _norm2 = float3(dot(N0, rawnorm2), dot(N1, rawnorm2), dot(N2, rawnorm2));\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
WRITE(p, "float4 pos = float4(dot("I_POSNORMALMATRIX".T0, rawpos), dot("I_POSNORMALMATRIX".T1, rawpos), dot("I_POSNORMALMATRIX".T2, rawpos), 1.0f);\n");
|
WRITE(p, "float4 pos = float4(dot("I_POSNORMALMATRIX".T0, rawpos), dot("I_POSNORMALMATRIX".T1, rawpos), dot("I_POSNORMALMATRIX".T2, rawpos), 1.0f);\n");
|
||||||
if (components & VB_HAS_NRM0)
|
if (components & VB_HAS_NRM0)
|
||||||
WRITE(p, "float3 _norm0 = normalize(float3(dot("I_POSNORMALMATRIX".N0.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N1.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N2.xyz, rawnorm0)));\n");
|
WRITE(p, "float3 _norm0 = normalize(float3(dot("I_POSNORMALMATRIX".N0.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N1.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N2.xyz, rawnorm0)));\n");
|
||||||
@ -224,7 +224,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
"float dist, dist2, attn;\n");
|
"float dist, dist2, attn;\n");
|
||||||
|
|
||||||
// lights/colors
|
// lights/colors
|
||||||
for (int j = 0; j < xfregs.nNumChans; j++) {
|
for (int j = 0; j < xfregs.nNumChans; j++)
|
||||||
|
{
|
||||||
|
|
||||||
// bool bColorAlphaSame = xfregs.colChans[j].color.hex == xfregs.colChans[j].alpha.hex; unused
|
// bool bColorAlphaSame = xfregs.colChans[j].color.hex == xfregs.colChans[j].alpha.hex; unused
|
||||||
const LitChannel& color = xfregs.colChans[j].color;
|
const LitChannel& color = xfregs.colChans[j].color;
|
||||||
@ -268,7 +269,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
if (alpha.ambsource) {// from vertex
|
if (alpha.ambsource) {// from vertex
|
||||||
if (components & (VB_HAS_COL0<<j) )
|
if (components & (VB_HAS_COL0<<j) )
|
||||||
WRITE(p, "lacc.w = color%d.w;\n", j);
|
WRITE(p, "lacc.w = color%d.w;\n", j);
|
||||||
else WRITE(p, "lacc.w = 0;\n");
|
else
|
||||||
|
WRITE(p, "lacc.w = 0;\n");
|
||||||
}
|
}
|
||||||
else // from color
|
else // from color
|
||||||
WRITE(p, "lacc.w = "I_MATERIALS".C%d.w;\n", j);
|
WRITE(p, "lacc.w = "I_MATERIALS".C%d.w;\n", j);
|
||||||
@ -290,6 +292,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no shared lights
|
// no shared lights
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
@ -301,14 +304,13 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
}
|
}
|
||||||
else if (color.enablelighting || alpha.enablelighting)
|
else if (color.enablelighting || alpha.enablelighting)
|
||||||
{
|
{
|
||||||
//ligths are disabled in one channel so proccess only te active
|
// lights are disabled on one channel so process only the active ones
|
||||||
LitChannel workingchannel = color.enablelighting ? color : alpha;
|
LitChannel workingchannel = color.enablelighting ? color : alpha;
|
||||||
int coloralpha = color.enablelighting ? 1 : 2;
|
int coloralpha = color.enablelighting ? 1 : 2;
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
if (workingchannel.GetFullLightMask() & (1<<i))
|
if (workingchannel.GetFullLightMask() & (1<<i))
|
||||||
p = GenerateLightShader(p, i, workingchannel, "lacc", coloralpha);
|
p = GenerateLightShader(p, i, workingchannel, "lacc", coloralpha);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +322,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
WRITE(p, "o.colors[%d].xyz = mat.xyz;\n"
|
WRITE(p, "o.colors[%d].xyz = mat.xyz;\n"
|
||||||
"o.colors[%d].w = mat.w * saturate(lacc.w);\n", j, j);
|
"o.colors[%d].w = mat.w * saturate(lacc.w);\n", j, j);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (alpha.enablelighting)
|
if (alpha.enablelighting)
|
||||||
WRITE(p, "o.colors[%d] = mat * saturate(lacc);\n", j);
|
WRITE(p, "o.colors[%d] = mat * saturate(lacc);\n", j);
|
||||||
else
|
else
|
||||||
@ -383,7 +386,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// firs transformation
|
// first transformation
|
||||||
switch (texinfo.texgentype) {
|
switch (texinfo.texgentype) {
|
||||||
case XF_TEXGEN_EMBOSS_MAP: // calculate tex coords into bump map
|
case XF_TEXGEN_EMBOSS_MAP: // calculate tex coords into bump map
|
||||||
|
|
||||||
@ -436,7 +439,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
|
|||||||
// multiply by postmatrix
|
// multiply by postmatrix
|
||||||
WRITE(p, "o.tex%d.xyz = float3(dot(P0.xy, o.tex%d.xy) + P0.z + P0.w, dot(P1.xy, o.tex%d.xy) + P1.z + P1.w, 0.0f);\n", i, i, i);
|
WRITE(p, "o.tex%d.xyz = float3(dot(P0.xy, o.tex%d.xy) + P0.z + P0.w, dot(P1.xy, o.tex%d.xy) + P1.z + P1.w, 0.0f);\n", i, i, i);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (xfregs.texcoords[i].postmtxinfo.normalize)
|
if (xfregs.texcoords[i].postmtxinfo.normalize)
|
||||||
WRITE(p, "o.tex%d.xyz = normalize(o.tex%d.xyz);\n", i, i);
|
WRITE(p, "o.tex%d.xyz = normalize(o.tex%d.xyz);\n", i, i);
|
||||||
|
|
||||||
@ -514,7 +518,8 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char
|
|||||||
WRITE(p, "attn = max(0.0f, dot("I_LIGHTS".lights[%d].cosatt.xyz, ldir)) / dot("I_LIGHTS".lights[%d].distatt.xyz, ldir);\n", index, index);
|
WRITE(p, "attn = max(0.0f, dot("I_LIGHTS".lights[%d].cosatt.xyz, ldir)) / dot("I_LIGHTS".lights[%d].distatt.xyz, ldir);\n", index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chan.diffusefunc) {
|
switch (chan.diffusefunc)
|
||||||
|
{
|
||||||
case LIGHTDIF_NONE:
|
case LIGHTDIF_NONE:
|
||||||
WRITE(p, "%s.%s += attn * "I_LIGHTS".lights[%d].col.%s;\n", dest, swizzle, index, swizzle);
|
WRITE(p, "%s.%s += attn * "I_LIGHTS".lights[%d].col.%s;\n", dest, swizzle, index, swizzle);
|
||||||
break;
|
break;
|
||||||
|
@ -244,7 +244,7 @@ inline void Draw(unsigned int stride, bool alphapass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINT bufoffset = 0;
|
UINT bufoffset = 0;
|
||||||
UINT bufstride = (UINT)stride;
|
UINT bufstride = stride;
|
||||||
|
|
||||||
if (!alphapass) gfxstate->ApplyState();
|
if (!alphapass) gfxstate->ApplyState();
|
||||||
else gfxstate->AlphaPass();
|
else gfxstate->AlphaPass();
|
||||||
|
@ -92,16 +92,6 @@ bool IsD3D()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsD3D9()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsD3D11()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is used for the functions right below here which use wxwidgets
|
// This is used for the functions right below here which use wxwidgets
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||||
@ -373,11 +363,6 @@ void Video_AddMessage(const char* pstr, u32 milliseconds)
|
|||||||
OSD::AddMessage(pstr, milliseconds);
|
OSD::AddMessage(pstr, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT ScreenShot(const char* filename)
|
|
||||||
{
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Video_Screenshot(const char* _szFilename)
|
void Video_Screenshot(const char* _szFilename)
|
||||||
{
|
{
|
||||||
Renderer::SetScreenshot(_szFilename);
|
Renderer::SetScreenshot(_szFilename);
|
||||||
|
@ -86,16 +86,19 @@ GFXConfigDialogDX::~GFXConfigDialogDX()
|
|||||||
{
|
{
|
||||||
INFO_LOG(CONSOLE, "GFXConfigDialogDX Closed");
|
INFO_LOG(CONSOLE, "GFXConfigDialogDX Closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXConfigDialogDX::OnClose(wxCloseEvent& event)
|
void GFXConfigDialogDX::OnClose(wxCloseEvent& event)
|
||||||
{
|
{
|
||||||
//INFO_LOG(CONSOLE, "OnClose");
|
//INFO_LOG(CONSOLE, "OnClose");
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXConfigDialogDX::CloseClick(wxCommandEvent& WXUNUSED (event))
|
void GFXConfigDialogDX::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
//INFO_LOG(CONSOLE, "CloseClick");
|
//INFO_LOG(CONSOLE, "CloseClick");
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXConfigDialogDX::InitializeGUIValues()
|
void GFXConfigDialogDX::InitializeGUIValues()
|
||||||
{
|
{
|
||||||
// General Display Settings
|
// General Display Settings
|
||||||
@ -151,6 +154,7 @@ void GFXConfigDialogDX::InitializeGUIValues()
|
|||||||
m_TexfmtCenter->SetValue(g_Config.bTexFmtOverlayCenter);
|
m_TexfmtCenter->SetValue(g_Config.bTexFmtOverlayCenter);
|
||||||
m_TexfmtCenter->Enable(m_TexfmtOverlay->IsChecked());
|
m_TexfmtCenter->Enable(m_TexfmtOverlay->IsChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXConfigDialogDX::CreateGUIControls()
|
void GFXConfigDialogDX::CreateGUIControls()
|
||||||
{
|
{
|
||||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||||
@ -380,6 +384,7 @@ void GFXConfigDialogDX::CreateGUIControls()
|
|||||||
Center();
|
Center();
|
||||||
UpdateGUI();
|
UpdateGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXConfigDialogDX::DirectXSettingsChanged(wxCommandEvent& event)
|
void GFXConfigDialogDX::DirectXSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
|
@ -162,8 +162,6 @@ class GFXConfigDialogDX : public wxDialog
|
|||||||
ID_SHADERERRORS,
|
ID_SHADERERRORS,
|
||||||
ID_TEXFMT_OVERLAY,
|
ID_TEXFMT_OVERLAY,
|
||||||
ID_TEXFMT_CENTER,
|
ID_TEXFMT_CENTER,
|
||||||
ID_CHECK1,
|
|
||||||
ID_LIST1,
|
|
||||||
ID_DEBUGSTEP,
|
ID_DEBUGSTEP,
|
||||||
ID_REGISTERS,
|
ID_REGISTERS,
|
||||||
ID_ENABLEDEBUGGING,
|
ID_ENABLEDEBUGGING,
|
||||||
|
@ -231,7 +231,6 @@ void SetupDeviceObjects()
|
|||||||
// To avoid shader compilation stutters, read back all shaders from cache.
|
// To avoid shader compilation stutters, read back all shaders from cache.
|
||||||
VertexShaderCache::Init();
|
VertexShaderCache::Init();
|
||||||
PixelShaderCache::Init();
|
PixelShaderCache::Init();
|
||||||
|
|
||||||
// Texture cache will recreate themselves over time.
|
// Texture cache will recreate themselves over time.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +515,7 @@ void CheckForResize()
|
|||||||
int width = rcParentWindow.right - rcParentWindow.left;
|
int width = rcParentWindow.right - rcParentWindow.left;
|
||||||
int height = rcParentWindow.bottom - rcParentWindow.top;
|
int height = rcParentWindow.bottom - rcParentWindow.top;
|
||||||
if (width != s_backbuffer_width || height != s_backbuffer_height)
|
if (width != s_backbuffer_width || height != s_backbuffer_height)
|
||||||
::MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE);
|
MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE);
|
||||||
}
|
}
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
GetClientRect(EmuWindow::GetWnd(), &rcWindow);
|
GetClientRect(EmuWindow::GetWnd(), &rcWindow);
|
||||||
@ -611,7 +610,6 @@ bool Renderer::SetScissorRect()
|
|||||||
rc.right = Xstride + s_target_width;
|
rc.right = Xstride + s_target_width;
|
||||||
rc.bottom = Ystride + s_target_height;
|
rc.bottom = Ystride + s_target_height;
|
||||||
D3D::dev->SetScissorRect(&rc);
|
D3D::dev->SetScissorRect(&rc);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -634,13 +632,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
// Get the working buffer
|
// Get the working buffer
|
||||||
LPDIRECT3DSURFACE9 pBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
LPDIRECT3DSURFACE9 pBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
||||||
FBManager.GetEFBDepthRTSurface() : FBManager.GetEFBColorRTSurface();
|
FBManager.GetEFBDepthRTSurface() : FBManager.GetEFBColorRTSurface();
|
||||||
//get the temporal buffer to move 1pixel data
|
// Get the temporal buffer to move 1pixel data
|
||||||
LPDIRECT3DSURFACE9 RBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
LPDIRECT3DSURFACE9 RBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
||||||
FBManager.GetEFBDepthReadSurface() : FBManager.GetEFBColorReadSurface();
|
FBManager.GetEFBDepthReadSurface() : FBManager.GetEFBColorReadSurface();
|
||||||
//get the memory buffer that can be locked
|
// Get the memory buffer that can be locked
|
||||||
LPDIRECT3DSURFACE9 pOffScreenBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
LPDIRECT3DSURFACE9 pOffScreenBuffer = (type == PEEK_Z || type == POKE_Z) ?
|
||||||
FBManager.GetEFBDepthOffScreenRTSurface() : FBManager.GetEFBColorOffScreenRTSurface();
|
FBManager.GetEFBDepthOffScreenRTSurface() : FBManager.GetEFBColorOffScreenRTSurface();
|
||||||
//get the buffer format
|
// Get the buffer format
|
||||||
D3DFORMAT BufferFormat = (type == PEEK_Z || type == POKE_Z) ?
|
D3DFORMAT BufferFormat = (type == PEEK_Z || type == POKE_Z) ?
|
||||||
FBManager.GetEFBDepthRTSurfaceFormat() : FBManager.GetEFBColorRTSurfaceFormat();
|
FBManager.GetEFBDepthRTSurfaceFormat() : FBManager.GetEFBColorRTSurfaceFormat();
|
||||||
D3DFORMAT ReadBufferFormat = (type == PEEK_Z || type == POKE_Z) ?
|
D3DFORMAT ReadBufferFormat = (type == PEEK_Z || type == POKE_Z) ?
|
||||||
@ -689,7 +687,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
RectToLock.bottom--;
|
RectToLock.bottom--;
|
||||||
if ((RectToLock.right - RectToLock.left) > 4)
|
if ((RectToLock.right - RectToLock.left) > 4)
|
||||||
RectToLock.left++;
|
RectToLock.left++;
|
||||||
ResetAPIState(); // reset any game specific settings
|
ResetAPIState(); // Reset any game specific settings
|
||||||
hr = D3D::dev->SetDepthStencilSurface(NULL);
|
hr = D3D::dev->SetDepthStencilSurface(NULL);
|
||||||
hr = D3D::dev->SetRenderTarget(0, RBuffer);
|
hr = D3D::dev->SetRenderTarget(0, RBuffer);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@ -738,7 +736,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
RectToLock.left = 0;
|
RectToLock.left = 0;
|
||||||
RectToLock.right = 4;
|
RectToLock.right = 4;
|
||||||
RectToLock.top = 0;
|
RectToLock.top = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -754,7 +751,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
PanicAlert("Unable to stretch data to buffer");
|
PanicAlert("Unable to stretch data to buffer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//retriebe the pixel data to the local memory buffer
|
// Retrieve the pixel data to the local memory buffer
|
||||||
D3D::dev->GetRenderTargetData(RBuffer, pOffScreenBuffer);
|
D3D::dev->GetRenderTargetData(RBuffer, pOffScreenBuffer);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
@ -764,12 +761,10 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// The surface is good.. lock it
|
||||||
//the surface is good.. lock it
|
|
||||||
if ((hr = pOffScreenBuffer->LockRect(&drect, &RectToLock, D3DLOCK_READONLY)) != D3D_OK)
|
if ((hr = pOffScreenBuffer->LockRect(&drect, &RectToLock, D3DLOCK_READONLY)) != D3D_OK)
|
||||||
{
|
{
|
||||||
PanicAlert("ERROR: %s", hr == D3DERR_WASSTILLDRAWING ? "Still drawing" :
|
PanicAlert("ERROR: %s", hr == D3DERR_WASSTILLDRAWING ? "Still drawing" : hr == D3DERR_INVALIDCALL ? "Invalid call" : "w00t");
|
||||||
hr == D3DERR_INVALIDCALL ? "Invalid call" : "w00t");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,11 +805,9 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pOffScreenBuffer->UnlockRect();
|
pOffScreenBuffer->UnlockRect();
|
||||||
// TODO: in RE0 this value is often off by one, which causes lighting to disappear
|
// TODO: in RE0 this value is often off by one, which causes lighting to disappear
|
||||||
return z;
|
return z;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from VertexShaderManager
|
// Called from VertexShaderManager
|
||||||
@ -893,7 +886,7 @@ void UpdateViewport()
|
|||||||
vp.Width = Width;
|
vp.Width = Width;
|
||||||
vp.Height = Height;
|
vp.Height = Height;
|
||||||
|
|
||||||
//some games set invalids values for z min and z max so fix them to the max an min alowed and let the shaders do this work
|
// Some games set invalids values for z min and z max so fix them to the max an min alowed and let the shaders do this work
|
||||||
vp.MinZ = 0.0f; // (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
|
vp.MinZ = 0.0f; // (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
|
||||||
vp.MaxZ =1.0f; // xfregs.rawViewport[5] / 16777216.0f;
|
vp.MaxZ =1.0f; // xfregs.rawViewport[5] / 16777216.0f;
|
||||||
D3D::dev->SetViewport(&vp);
|
D3D::dev->SetViewport(&vp);
|
||||||
@ -913,12 +906,12 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
|
|||||||
D3D::dev->SetViewport(&vp);
|
D3D::dev->SetViewport(&vp);
|
||||||
|
|
||||||
// Always set the scissor in case it was set by the game and has not been reset
|
// Always set the scissor in case it was set by the game and has not been reset
|
||||||
RECT sirc;
|
RECT sicr;
|
||||||
sirc.left = targetRc.left;
|
sicr.left = targetRc.left;
|
||||||
sirc.top = targetRc.top;
|
sicr.top = targetRc.top;
|
||||||
sirc.right = targetRc.right;
|
sicr.right = targetRc.right;
|
||||||
sirc.bottom = targetRc.bottom;
|
sicr.bottom = targetRc.bottom;
|
||||||
D3D::dev->SetScissorRect(&sirc);
|
D3D::dev->SetScissorRect(&sicr);
|
||||||
D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
|
D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
|
||||||
if (zEnable)
|
if (zEnable)
|
||||||
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
|
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
|
||||||
@ -1147,7 +1140,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
s_LastFrameDumped = false;
|
s_LastFrameDumped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Finish up the current frame, print some stats
|
// Finish up the current frame, print some stats
|
||||||
if (g_ActiveConfig.bShowFPS)
|
if (g_ActiveConfig.bShowFPS)
|
||||||
{
|
{
|
||||||
@ -1192,7 +1184,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
if (s_XFB_width > MAX_XFB_WIDTH) s_XFB_width = MAX_XFB_WIDTH;
|
if (s_XFB_width > MAX_XFB_WIDTH) s_XFB_width = MAX_XFB_WIDTH;
|
||||||
if (s_XFB_height < 1) s_XFB_height = MAX_XFB_HEIGHT;
|
if (s_XFB_height < 1) s_XFB_height = MAX_XFB_HEIGHT;
|
||||||
if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT;
|
if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 newAA = g_ActiveConfig.iMultisampleMode;
|
u32 newAA = g_ActiveConfig.iMultisampleMode;
|
||||||
@ -1248,7 +1239,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
}
|
}
|
||||||
D3D::dev->SetRenderTarget(0, FBManager.GetEFBColorRTSurface());
|
D3D::dev->SetRenderTarget(0, FBManager.GetEFBColorRTSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(FBManager.GetEFBDepthRTSurface());
|
D3D::dev->SetDepthStencilSurface(FBManager.GetEFBDepthRTSurface());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
@ -1298,8 +1288,10 @@ void Renderer::RestoreAPIState()
|
|||||||
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
|
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
|
||||||
UpdateViewport();
|
UpdateViewport();
|
||||||
SetScissorRect();
|
SetScissorRect();
|
||||||
if (bpmem.zmode.testenable) D3D::SetRenderState(D3DRS_ZENABLE, TRUE);
|
if (bpmem.zmode.testenable)
|
||||||
if (bpmem.zmode.updateenable) D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
|
D3D::SetRenderState(D3DRS_ZENABLE, TRUE);
|
||||||
|
if (bpmem.zmode.updateenable)
|
||||||
|
D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
|
||||||
SetColorMask();
|
SetColorMask();
|
||||||
SetLogicOpMode();
|
SetLogicOpMode();
|
||||||
}
|
}
|
||||||
@ -1368,13 +1360,13 @@ void Renderer::SetSamplerState(int stage, int texindex)
|
|||||||
min = (tm0.min_filter & 4) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
min = (tm0.min_filter & 4) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||||
mag = tm0.mag_filter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
mag = tm0.mag_filter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||||
mip = (tm0.min_filter == 8) ? D3DTEXF_NONE : d3dMipFilters[tm0.min_filter & 3];
|
mip = (tm0.min_filter == 8) ? D3DTEXF_NONE : d3dMipFilters[tm0.min_filter & 3];
|
||||||
if((tm0.min_filter & 3) && (tm0.min_filter != 8) && ((tm1.max_lod >> 4) == 0)) mip = D3DTEXF_NONE;
|
if((tm0.min_filter & 3) && (tm0.min_filter != 8) && ((tm1.max_lod >> 4) == 0))
|
||||||
|
mip = D3DTEXF_NONE;
|
||||||
}
|
}
|
||||||
if (texindex)
|
if (texindex)
|
||||||
stage += 4;
|
stage += 4;
|
||||||
|
|
||||||
if (mag == D3DTEXF_LINEAR && min == D3DTEXF_LINEAR &&
|
if (mag == D3DTEXF_LINEAR && min == D3DTEXF_LINEAR && g_ActiveConfig.iMaxAnisotropy > 1)
|
||||||
g_ActiveConfig.iMaxAnisotropy > 1)
|
|
||||||
{
|
{
|
||||||
min = D3DTEXF_ANISOTROPIC;
|
min = D3DTEXF_ANISOTROPIC;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user