Fix a vertex shader generation bug that crashed Super Monkey Ball. Better shader error handling. Random warning fixes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4170 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-09-02 21:19:35 +00:00
parent 50593397f3
commit 1e016dd522
8 changed files with 47 additions and 61 deletions

View File

@ -110,19 +110,19 @@ void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int S
{
// Change screen buffer size
COORD Co = {BufferWidth, BufferHeight};
SB = SetConsoleScreenBufferSize(hConsole, Co);
SB = (bool)SetConsoleScreenBufferSize(hConsole, Co);
// Change the screen buffer window size
SMALL_RECT coo = {0,0,ScreenWidth, ScreenHeight}; // top, left, right, bottom
SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
SW = (bool)SetConsoleWindowInfo(hConsole, TRUE, &coo);
}
else
{
// Change the screen buffer window size
SMALL_RECT coo = {0,0, ScreenWidth, ScreenHeight}; // top, left, right, bottom
SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
SW = (bool)SetConsoleWindowInfo(hConsole, TRUE, &coo);
// Change screen buffer size
COORD Co = {BufferWidth, BufferHeight};
SB = SetConsoleScreenBufferSize(hConsole, Co);
SB = (bool)SetConsoleScreenBufferSize(hConsole, Co);
}
#endif
}
@ -198,7 +198,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
int BytesRead = 0;
int i = 0;
int LastAttrRead = 0;
while(BytesRead < BufferSize)
while (BytesRead < BufferSize)
{
Str.push_back(new char[MAX_BYTES]);
if (!ReadConsoleOutputCharacter(hConsole, Str[i], ReadBufferSize, coordScreen, &cCharsRead))
@ -215,8 +215,8 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
LastAttrRead = cAttrRead;
}
// Letter space
int LWidth = floor((float)Width / 8.0) - 1.0;
int LHeight = floor((float)Height / 12.0) - 1.0;
int LWidth = (int)floor((float)Width / 8.0) - 1.0;
int LHeight = (int)floor((float)Height / 12.0) - 1.0;
int LBufWidth = LWidth + 1;
int LBufHeight = floor((float)BufferSize / (float)LBufWidth);
// Change screen buffer size

View File

@ -660,13 +660,13 @@ void Callback_VideoCopiedToXFB(bool video_update)
double wait_frametime = (1000.0 / VideoInterface::TargetRefreshRate);
if (Timer.GetTimeDifference() >= wait_frametime * frames)
no_framelimit=Timer.GetTimeDifference();
no_framelimit = (u32)Timer.GetTimeDifference();
while (Timer.GetTimeDifference() < wait_frametime * videoupd)
{
// TODO : This is wrong, the sleep shouldn't be there but rather in cputhread
// as it's not based on the fps but on the refresh rate...
if (no_framelimit==0)
if (no_framelimit == 0)
Common::SleepCurrentThread(1);
}
}

View File

@ -336,7 +336,7 @@ const char *GenerateVertexShader(u32 components, bool D3D)
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm0.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
case XF_SRCCOLORS_INROW:
_assert_( texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1 );
@ -346,21 +346,21 @@ const char *GenerateVertexShader(u32 components, bool D3D)
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm1.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
case XF_SRCBINORMAL_B_INROW:
if (components & VB_HAS_NRM2) {
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm2.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
default:
_assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW);
if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) )
WRITE(p, "float4 coord = float4(tex%d.x, tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
else
WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n");
WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
}