msvc: resolve all warnings in VideoCommon.

This commit is contained in:
Shawn Hoffman 2014-08-19 20:16:50 -07:00
parent 043ea31f14
commit 4bf031c064
4 changed files with 31 additions and 23 deletions

View File

@ -219,7 +219,7 @@ static void BPWritten(const BPCmd& bp)
CopyEFB(destAddr, srcRect, CopyEFB(destAddr, srcRect,
PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format, PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format,
PE_copy.intensity_fmt, PE_copy.half_scale); !!PE_copy.intensity_fmt, !!PE_copy.half_scale);
} }
else else
{ {
@ -235,19 +235,19 @@ static void BPWritten(const BPCmd& bp)
else else
yScale = (float)bpmem.dispcopyyscale / 256.0f; yScale = (float)bpmem.dispcopyyscale / 256.0f;
float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale); float num_xfb_lines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale);
if ((u32)xfbLines > MAX_XFB_HEIGHT)
u32 height = static_cast<u32>(num_xfb_lines);
if (height > MAX_XFB_HEIGHT)
{ {
INFO_LOG(VIDEO, "Tried to scale EFB to too many XFB lines (%f)", xfbLines); INFO_LOG(VIDEO, "Tried to scale EFB to too many XFB lines: %d (%f)",
xfbLines = MAX_XFB_HEIGHT; height, num_xfb_lines);
height = MAX_XFB_HEIGHT;
} }
u32 width = bpmem.copyMipMapStrideChannels << 4; u32 width = bpmem.copyMipMapStrideChannels << 4;
u32 height = xfbLines;
Renderer::RenderToXFB(destAddr, srcRect, Renderer::RenderToXFB(destAddr, srcRect, width, height, s_gammaLUT[PE_copy.gamma]);
width, height,
s_gammaLUT[PE_copy.gamma]);
} }
// Clear the rectangular region after copying it. // Clear the rectangular region after copying it.
@ -565,9 +565,9 @@ static void BPWritten(const BPCmd& bp)
// don't compare with changes! // don't compare with changes!
int num = (bp.address >> 1) & 0x3; int num = (bp.address >> 1) & 0x3;
if ((bp.address & 1) == 0) if ((bp.address & 1) == 0)
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].type_ra, num); PixelShaderManager::SetColorChanged(static_cast<int>(bpmem.tevregs[num].type_ra), num);
else else
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].type_bg, num); PixelShaderManager::SetColorChanged(static_cast<int>(bpmem.tevregs[num].type_bg), num);
} }
return; return;
default: default:

View File

@ -107,13 +107,13 @@ PC_TexFormat GetHiresTex(const std::string& filename, unsigned int* pWidth, unsi
//int offset = 0; //int offset = 0;
PC_TexFormat returnTex = PC_TEX_FMT_NONE; PC_TexFormat returnTex = PC_TEX_FMT_NONE;
switch (texformat)
{
// TODO(neobrain): This function currently has no way to enforce RGBA32 // TODO(neobrain): This function currently has no way to enforce RGBA32
// output, which however is required on some configurations to function // output, which however is required on some configurations to function
// properly. As a lazy workaround, we hence disable the optimized code // properly. As a lazy workaround, we hence disable the optimized code
// path for now. // path for now.
#if 0 #if 0
switch (texformat)
{
case GX_TF_I4: case GX_TF_I4:
case GX_TF_I8: case GX_TF_I8:
case GX_TF_IA4: case GX_TF_IA4:
@ -131,7 +131,6 @@ PC_TexFormat GetHiresTex(const std::string& filename, unsigned int* pWidth, unsi
} }
returnTex = PC_TEX_FMT_IA8; returnTex = PC_TEX_FMT_IA8;
break; break;
#endif
default: default:
*required_size = width * height * 4; *required_size = width * height * 4;
if (data_size < *required_size) if (data_size < *required_size)
@ -141,6 +140,14 @@ PC_TexFormat GetHiresTex(const std::string& filename, unsigned int* pWidth, unsi
returnTex = PC_TEX_FMT_RGBA32; returnTex = PC_TEX_FMT_RGBA32;
break; break;
} }
#else
*required_size = width * height * 4;
if (data_size < *required_size)
goto cleanup;
memcpy(data, temp, width * height * 4);
returnTex = PC_TEX_FMT_RGBA32;
#endif
INFO_LOG(VIDEO, "Loading custom texture from %s", textureMap[filename].c_str()); INFO_LOG(VIDEO, "Loading custom texture from %s", textureMap[filename].c_str());
cleanup: cleanup:

View File

@ -100,8 +100,8 @@ void PixelShaderManager::SetConstants()
if (s_bViewPortChanged) if (s_bViewPortChanged)
{ {
constants.zbias[1][0] = xfmem.viewport.farZ; constants.zbias[1][0] = static_cast<u32>(xfmem.viewport.farZ);
constants.zbias[1][1] = xfmem.viewport.zRange; constants.zbias[1][1] = static_cast<u32>(xfmem.viewport.zRange);
dirty = true; dirty = true;
s_bViewPortChanged = false; s_bViewPortChanged = false;
} }
@ -110,10 +110,10 @@ void PixelShaderManager::SetConstants()
void PixelShaderManager::SetColorChanged(int type, int num) void PixelShaderManager::SetColorChanged(int type, int num)
{ {
int4* c = type ? constants.kcolors : constants.colors; int4* c = type ? constants.kcolors : constants.colors;
c[num][0] = bpmem.tevregs[num].red; c[num][0] = static_cast<s32>(bpmem.tevregs[num].red);
c[num][3] = bpmem.tevregs[num].alpha; c[num][3] = static_cast<s32>(bpmem.tevregs[num].alpha);
c[num][2] = bpmem.tevregs[num].blue; c[num][2] = static_cast<s32>(bpmem.tevregs[num].blue);
c[num][1] = bpmem.tevregs[num].green; c[num][1] = static_cast<s32>(bpmem.tevregs[num].green);
dirty = true; dirty = true;
PRIM_LOG("pixel %scolor%d: %d %d %d %d\n", type?"k":"", num, c[num][0], c[num][1], c[num][2], c[num][3]); PRIM_LOG("pixel %scolor%d: %d %d %d %d\n", type?"k":"", num, c[num][0], c[num][1], c[num][2], c[num][3]);

View File

@ -285,9 +285,10 @@ void VertexShaderManager::SetConstants()
double(light.ddir[1]) * double(light.ddir[1]) + double(light.ddir[1]) * double(light.ddir[1]) +
double(light.ddir[2]) * double(light.ddir[2]); double(light.ddir[2]) * double(light.ddir[2]);
norm = 1.0 / sqrt(norm); norm = 1.0 / sqrt(norm);
dstlight.dir[0] = light.ddir[0] * norm; float norm_float = static_cast<float>(norm);
dstlight.dir[1] = light.ddir[1] * norm; dstlight.dir[0] = light.ddir[0] * norm_float;
dstlight.dir[2] = light.ddir[2] * norm; dstlight.dir[1] = light.ddir[1] * norm_float;
dstlight.dir[2] = light.ddir[2] * norm_float;
} }
dirty = true; dirty = true;