Backport Donko's hackfix to DX9 plugin. Move some code around. Add a couple of sanity checks.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@937 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-10-22 18:39:46 +00:00
parent ae0f0f8dcd
commit 32820d2036
8 changed files with 83 additions and 74 deletions

View File

@ -23,9 +23,10 @@
#include "VertexShader.h"
// This is the tricky one to get rid off.
#include "VertexLoader.h"
// #include "VertexLoader.h"
static char text[16384];
#define WRITE p+=sprintf
#define LIGHTS_POS ""
@ -34,6 +35,7 @@ char *GenerateLightShader(char* p, int index, const LitChannel& chan, const char
char *GenerateVertexShader(u32 components, bool has_zbuffer_target)
{
text[sizeof(text) - 1] = 0x7C; // canary
DVSTARTPROFILE();
_assert_( bpmem.genMode.numtexgens == xfregs.numTexGens);
@ -405,6 +407,8 @@ char *GenerateVertexShader(u32 components, bool has_zbuffer_target)
WRITE(p, "return o;\n}\n");
if (text[sizeof(text) - 1] != 0x7C)
PanicAlert("VertexShader generator - buffer too small, canary has been eaten!");
return text;
}
@ -415,7 +419,7 @@ char* GenerateLightShader(char* p, int index, const LitChannel& chan, const char
if (coloralpha == 1 ) swizzle = "xyz";
else if (coloralpha == 2 ) swizzle = "w";
if (!(chan.attnfunc&1)) {
if (!(chan.attnfunc & 1)) {
// atten disabled
switch (chan.diffusefunc) {
case LIGHTDIF_NONE: