mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
THIS BREAKS THE D3D PLUGIN FOR THE NEAR TERM. Resurrect an old patch that moves D3D over to the common shader generator framework. Needs a lot more work.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2484 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -22,3 +22,42 @@
|
||||
//BP state
|
||||
// STATE_TO_SAVE
|
||||
BPMemory bpmem;
|
||||
|
||||
// The plugin must implement this.
|
||||
void BPWritten(int addr, int changes, int newval);
|
||||
|
||||
// Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg()
|
||||
void LoadBPReg(u32 value0)
|
||||
{
|
||||
//handle the mask register
|
||||
int opcode = value0 >> 24;
|
||||
int oldval = ((u32*)&bpmem)[opcode];
|
||||
int newval = (oldval & ~bpmem.bpMask) | (value0 & bpmem.bpMask);
|
||||
int changes = (oldval ^ newval) & 0xFFFFFF;
|
||||
//reset the mask register
|
||||
if (opcode != 0xFE)
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
BPWritten(opcode, changes, newval);
|
||||
}
|
||||
|
||||
// Called when loading a saved state.
|
||||
// Needs more testing though.
|
||||
void BPReload()
|
||||
{
|
||||
for (int i = 0; i < 254; i++)
|
||||
{
|
||||
switch (i) {
|
||||
case 0x41:
|
||||
case 0x45: //GXSetDrawDone
|
||||
case 0x52:
|
||||
case 0x65:
|
||||
case 0x67: // set gp metric?
|
||||
case BPMEM_PE_TOKEN_ID:
|
||||
case BPMEM_PE_TOKEN_INT_ID:
|
||||
// Cases in which we DON'T want to reload the BP
|
||||
continue;
|
||||
default:
|
||||
BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,10 +96,13 @@ public:
|
||||
virtual void SetupVertexPointers() const = 0;
|
||||
virtual void EnableComponents(u32 components) {}
|
||||
|
||||
int GetVertexStride() const { return vertex_stride; }
|
||||
|
||||
static NativeVertexFormat *Create();
|
||||
|
||||
// TODO: move these in under private:
|
||||
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
||||
u32 vertex_stride;
|
||||
|
||||
protected:
|
||||
// Let subclasses construct.
|
||||
|
||||
@@ -261,7 +261,7 @@ static void Decode()
|
||||
break;
|
||||
|
||||
case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
|
||||
DebugLog("Invalidate (vertex cache?)");
|
||||
DEBUG_LOG("Invalidate (vertex cache?)");
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
|
||||
@@ -928,11 +928,11 @@ static bool WriteAlphaTest(char *&p)
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE(p, "discard( ");
|
||||
WRITE(p, "clip( ");
|
||||
WriteAlphaCompare(p, 0, bpmem.alphaFunc.comp0);
|
||||
|
||||
// negated because testing the inverse condition
|
||||
switch(bpmem.alphaFunc.logic) {
|
||||
switch (bpmem.alphaFunc.logic) {
|
||||
case 0: WRITE(p, " || "); break; // and
|
||||
case 1: WRITE(p, " && "); break; // or
|
||||
case 2: WRITE(p, " == "); break; // xor
|
||||
|
||||
@@ -5,12 +5,15 @@ Import('env')
|
||||
files = [
|
||||
'BPMemory.cpp',
|
||||
'CPMemory.cpp',
|
||||
'XFMemory.cpp',
|
||||
'XFStructs.cpp',
|
||||
'memcpy_amd.cpp',
|
||||
'LookUpTables.cpp',
|
||||
'OpcodeDecoding.cpp',
|
||||
'TextureDecoder.cpp',
|
||||
'XFMemory.cpp',
|
||||
'XFBConvert.cpp',
|
||||
'IndexGenerator.cpp',
|
||||
'PixelShaderGen.cpp',
|
||||
'PixelShaderManager.cpp',
|
||||
'VertexShaderGen.cpp',
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "VideoCommon.h"
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
static FILE* pfLog = NULL;
|
||||
void __Log(const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
if (pfLog == NULL)
|
||||
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
|
||||
|
||||
if (pfLog != NULL)
|
||||
fwrite(Msg, strlen(Msg), 1, pfLog);
|
||||
#ifdef _WIN32
|
||||
// DWORD tmp;
|
||||
// WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#else
|
||||
//printf("%s", Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void __Log(int type, const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
#ifdef _WIN32
|
||||
// DWORD tmp;
|
||||
// WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#endif
|
||||
}
|
||||
+233
-236
@@ -1,236 +1,233 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
#include "XFMemory.h"
|
||||
#include "VertexManager.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "PixelShaderManager.h"
|
||||
|
||||
// LoadXFReg 0x10
|
||||
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
||||
{
|
||||
u32 address = baseAddress;
|
||||
for (int i = 0; i < (int)transferSize; i++)
|
||||
{
|
||||
address = baseAddress + i;
|
||||
|
||||
// Setup a Matrix
|
||||
if (address < 0x1000)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::InvalidateXFRange(address, address + transferSize);
|
||||
//PRIM_LOG("xfmem write: 0x%x-0x%x\n", address, address+transferSize);
|
||||
|
||||
u32* p1 = &xfmem[address];
|
||||
memcpy_gc(p1, &pData[i], transferSize*4);
|
||||
i += transferSize;
|
||||
}
|
||||
else if (address<0x2000)
|
||||
{
|
||||
u32 data = pData[i];
|
||||
switch (address)
|
||||
{
|
||||
case 0x1000: // error
|
||||
break;
|
||||
case 0x1001: // diagnostics
|
||||
break;
|
||||
case 0x1002: // internal state 0
|
||||
break;
|
||||
case 0x1003: // internal state 1
|
||||
break;
|
||||
case 0x1004: // xf_clock
|
||||
break;
|
||||
case 0x1005: // clipdisable
|
||||
if (data & 1) { // disable clipping detection
|
||||
}
|
||||
if (data & 2) { // disable trivial rejection
|
||||
}
|
||||
if (data & 4) { // disable cpoly clipping acceleration
|
||||
}
|
||||
break;
|
||||
case 0x1006: //SetGPMetric
|
||||
break;
|
||||
|
||||
case 0x1008: //__GXXfVtxSpecs, wrote 0004
|
||||
xfregs.hostinfo = *(INVTXSPEC*)&data;
|
||||
break;
|
||||
|
||||
case 0x1009: //GXSetNumChans (no)
|
||||
if ((u32)xfregs.nNumChans != (data&3)) {
|
||||
VertexManager::Flush();
|
||||
xfregs.nNumChans = data&3;
|
||||
}
|
||||
break;
|
||||
case 0x100a: //GXSetChanAmbientcolor
|
||||
if (xfregs.colChans[0].ambColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].ambColor = data;
|
||||
VertexShaderManager::SetMaterialColor(0, data);
|
||||
}
|
||||
break;
|
||||
case 0x100b: //GXSetChanAmbientcolor
|
||||
if (xfregs.colChans[1].ambColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].ambColor = data;
|
||||
VertexShaderManager::SetMaterialColor(1, data);
|
||||
}
|
||||
break;
|
||||
case 0x100c: //GXSetChanMatcolor (rgba)
|
||||
if (xfregs.colChans[0].matColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].matColor = data;
|
||||
VertexShaderManager::SetMaterialColor(2, data);
|
||||
}
|
||||
break;
|
||||
case 0x100d: //GXSetChanMatcolor (rgba)
|
||||
if (xfregs.colChans[1].matColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].matColor = data;
|
||||
VertexShaderManager::SetMaterialColor(3, data);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x100e: // color0
|
||||
if (xfregs.colChans[0].color.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].color.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x100f: // color1
|
||||
if (xfregs.colChans[1].color.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].color.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1010: // alpha0
|
||||
if (xfregs.colChans[0].alpha.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].alpha.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1011: // alpha1
|
||||
if (xfregs.colChans[1].alpha.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].alpha.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1012: // dual tex transform
|
||||
if (xfregs.bEnableDualTexTransform != (data & 1)) {
|
||||
VertexManager::Flush();
|
||||
xfregs.bEnableDualTexTransform = data & 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1013:
|
||||
case 0x1014:
|
||||
case 0x1015:
|
||||
case 0x1016:
|
||||
case 0x1017:
|
||||
DEBUG_LOG(VIDEO, "xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
case 0x1018:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex0");
|
||||
VertexShaderManager::SetTexMatrixChangedA(data); //?
|
||||
break;
|
||||
case 0x1019:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex1");
|
||||
VertexShaderManager::SetTexMatrixChangedB(data); //?
|
||||
break;
|
||||
|
||||
case 0x101a:
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetViewport((float*)&pData[i]);
|
||||
PixelShaderManager::SetViewport((float*)&pData[i]);
|
||||
i += 6;
|
||||
break;
|
||||
|
||||
case 0x101c: // paper mario writes 16777216.0f, 1677721.75
|
||||
break;
|
||||
case 0x101f: // paper mario writes 16777216.0f, 5033165.0f
|
||||
break;
|
||||
|
||||
case 0x1020:
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetProjection((float*)&pData[i]);
|
||||
i += 7;
|
||||
return;
|
||||
|
||||
case 0x103f: // GXSetNumTexGens
|
||||
if ((u32)xfregs.numTexGens != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.numTexGens = data;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1040: xfregs.texcoords[0].texmtxinfo.hex = data; break;
|
||||
case 0x1041: xfregs.texcoords[1].texmtxinfo.hex = data; break;
|
||||
case 0x1042: xfregs.texcoords[2].texmtxinfo.hex = data; break;
|
||||
case 0x1043: xfregs.texcoords[3].texmtxinfo.hex = data; break;
|
||||
case 0x1044: xfregs.texcoords[4].texmtxinfo.hex = data; break;
|
||||
case 0x1045: xfregs.texcoords[5].texmtxinfo.hex = data; break;
|
||||
case 0x1046: xfregs.texcoords[6].texmtxinfo.hex = data; break;
|
||||
case 0x1047: xfregs.texcoords[7].texmtxinfo.hex = data; break;
|
||||
|
||||
case 0x1048:
|
||||
case 0x1049:
|
||||
case 0x104a:
|
||||
case 0x104b:
|
||||
case 0x104c:
|
||||
case 0x104d:
|
||||
case 0x104e:
|
||||
case 0x104f:
|
||||
DEBUG_LOG(VIDEO, "xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
case 0x1050: xfregs.texcoords[0].postmtxinfo.hex = data; break;
|
||||
case 0x1051: xfregs.texcoords[1].postmtxinfo.hex = data; break;
|
||||
case 0x1052: xfregs.texcoords[2].postmtxinfo.hex = data; break;
|
||||
case 0x1053: xfregs.texcoords[3].postmtxinfo.hex = data; break;
|
||||
case 0x1054: xfregs.texcoords[4].postmtxinfo.hex = data; break;
|
||||
case 0x1055: xfregs.texcoords[5].postmtxinfo.hex = data; break;
|
||||
case 0x1056: xfregs.texcoords[6].postmtxinfo.hex = data; break;
|
||||
case 0x1057: xfregs.texcoords[7].postmtxinfo.hex = data; break;
|
||||
|
||||
default:
|
||||
DEBUG_LOG(VIDEO, "xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (address >= 0x4000)
|
||||
{
|
||||
// MessageBox(NULL, "1", "1", MB_OK);
|
||||
//4010 __GXSetGenMode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - verify that it is correct. Seems to work, though.
|
||||
void LoadIndexedXF(u32 val, int array)
|
||||
{
|
||||
int index = val >> 16;
|
||||
int address = val & 0xFFF; //check mask
|
||||
int size = ((val >> 12) & 0xF) + 1;
|
||||
//load stuff from array to address in xf mem
|
||||
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::InvalidateXFRange(address, address + size);
|
||||
//PRIM_LOG("xfmem iwrite: 0x%x-0x%x\n", address, address + size);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
xfmem[address + i] = Memory_Read_U32(arraybases[array] + arraystrides[array] * index + i * 4);
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "VideoCommon.h"
|
||||
#include "XFMemory.h"
|
||||
#include "CPMemory.h"
|
||||
#include "NativeVertexWriter.h"
|
||||
#include "VertexShaderManager.h"
|
||||
|
||||
// LoadXFReg 0x10
|
||||
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
||||
{
|
||||
u32 address = baseAddress;
|
||||
for (int i = 0; i < (int)transferSize; i++)
|
||||
{
|
||||
address = baseAddress + i;
|
||||
|
||||
// Setup a Matrix
|
||||
if (address < 0x1000)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::InvalidateXFRange(address, address + transferSize);
|
||||
//PRIM_LOG("xfmem write: 0x%x-0x%x\n", address, address+transferSize);
|
||||
|
||||
u32* p1 = &xfmem[address];
|
||||
memcpy_gc(p1, &pData[i], transferSize*4);
|
||||
i += transferSize;
|
||||
}
|
||||
else if (address < 0x2000)
|
||||
{
|
||||
u32 data = pData[i];
|
||||
switch (address)
|
||||
{
|
||||
case 0x1000: // error
|
||||
break;
|
||||
case 0x1001: // diagnostics
|
||||
break;
|
||||
case 0x1002: // internal state 0
|
||||
break;
|
||||
case 0x1003: // internal state 1
|
||||
break;
|
||||
case 0x1004: // xf_clock
|
||||
break;
|
||||
case 0x1005: // clipdisable
|
||||
if (data & 1) { // disable clipping detection
|
||||
}
|
||||
if (data & 2) { // disable trivial rejection
|
||||
}
|
||||
if (data & 4) { // disable cpoly clipping acceleration
|
||||
}
|
||||
break;
|
||||
case 0x1006: //SetGPMetric
|
||||
break;
|
||||
case 0x1008: //__GXXfVtxSpecs, wrote 0004
|
||||
xfregs.hostinfo = *(INVTXSPEC*)&data;
|
||||
break;
|
||||
case 0x1009: //GXSetNumChans (no)
|
||||
if ((u32)xfregs.nNumChans != (data & 3)) {
|
||||
VertexManager::Flush();
|
||||
xfregs.nNumChans = data & 3;
|
||||
}
|
||||
break;
|
||||
case 0x100a: //GXSetChanAmbientcolor
|
||||
if (xfregs.colChans[0].ambColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].ambColor = data;
|
||||
VertexShaderManager::SetMaterialColor(0, data);
|
||||
}
|
||||
break;
|
||||
case 0x100b: //GXSetChanAmbientcolor
|
||||
if (xfregs.colChans[1].ambColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].ambColor = data;
|
||||
VertexShaderManager::SetMaterialColor(1, data);
|
||||
}
|
||||
break;
|
||||
case 0x100c: //GXSetChanMatcolor (rgba)
|
||||
if (xfregs.colChans[0].matColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].matColor = data;
|
||||
VertexShaderManager::SetMaterialColor(2, data);
|
||||
}
|
||||
break;
|
||||
case 0x100d: //GXSetChanMatcolor (rgba)
|
||||
if (xfregs.colChans[1].matColor != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].matColor = data;
|
||||
VertexShaderManager::SetMaterialColor(3, data);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x100e: // color0
|
||||
if (xfregs.colChans[0].color.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].color.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x100f: // color1
|
||||
if (xfregs.colChans[1].color.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].color.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1010: // alpha0
|
||||
if (xfregs.colChans[0].alpha.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[0].alpha.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1011: // alpha1
|
||||
if (xfregs.colChans[1].alpha.hex != (data & 0x7fff) ) {
|
||||
VertexManager::Flush();
|
||||
xfregs.colChans[1].alpha.hex = data;
|
||||
}
|
||||
break;
|
||||
case 0x1012: // dual tex transform
|
||||
if (xfregs.bEnableDualTexTransform != (data & 1)) {
|
||||
VertexManager::Flush();
|
||||
xfregs.bEnableDualTexTransform = data & 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1013:
|
||||
case 0x1014:
|
||||
case 0x1015:
|
||||
case 0x1016:
|
||||
case 0x1017:
|
||||
DEBUG_LOG("xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
case 0x1018:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex0");
|
||||
VertexShaderManager::SetTexMatrixChangedA(data); //?
|
||||
break;
|
||||
case 0x1019:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex1");
|
||||
VertexShaderManager::SetTexMatrixChangedB(data); //?
|
||||
break;
|
||||
|
||||
case 0x101a:
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetViewport((float*)&pData[i]);
|
||||
i += 6;
|
||||
break;
|
||||
|
||||
case 0x101c: // paper mario writes 16777216.0f, 1677721.75
|
||||
break;
|
||||
case 0x101f: // paper mario writes 16777216.0f, 5033165.0f
|
||||
break;
|
||||
|
||||
case 0x1020:
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetProjection((float*)&pData[i]);
|
||||
i += 7;
|
||||
return;
|
||||
|
||||
case 0x103f: // GXSetNumTexGens
|
||||
if ((u32)xfregs.numTexGens != data) {
|
||||
VertexManager::Flush();
|
||||
xfregs.numTexGens = data;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1040: xfregs.texcoords[0].texmtxinfo.hex = data; break;
|
||||
case 0x1041: xfregs.texcoords[1].texmtxinfo.hex = data; break;
|
||||
case 0x1042: xfregs.texcoords[2].texmtxinfo.hex = data; break;
|
||||
case 0x1043: xfregs.texcoords[3].texmtxinfo.hex = data; break;
|
||||
case 0x1044: xfregs.texcoords[4].texmtxinfo.hex = data; break;
|
||||
case 0x1045: xfregs.texcoords[5].texmtxinfo.hex = data; break;
|
||||
case 0x1046: xfregs.texcoords[6].texmtxinfo.hex = data; break;
|
||||
case 0x1047: xfregs.texcoords[7].texmtxinfo.hex = data; break;
|
||||
|
||||
case 0x1048:
|
||||
case 0x1049:
|
||||
case 0x104a:
|
||||
case 0x104b:
|
||||
case 0x104c:
|
||||
case 0x104d:
|
||||
case 0x104e:
|
||||
case 0x104f:
|
||||
DEBUG_LOG("xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
case 0x1050: xfregs.texcoords[0].postmtxinfo.hex = data; break;
|
||||
case 0x1051: xfregs.texcoords[1].postmtxinfo.hex = data; break;
|
||||
case 0x1052: xfregs.texcoords[2].postmtxinfo.hex = data; break;
|
||||
case 0x1053: xfregs.texcoords[3].postmtxinfo.hex = data; break;
|
||||
case 0x1054: xfregs.texcoords[4].postmtxinfo.hex = data; break;
|
||||
case 0x1055: xfregs.texcoords[5].postmtxinfo.hex = data; break;
|
||||
case 0x1056: xfregs.texcoords[6].postmtxinfo.hex = data; break;
|
||||
case 0x1057: xfregs.texcoords[7].postmtxinfo.hex = data; break;
|
||||
|
||||
default:
|
||||
DEBUG_LOG("xf addr: %x=%x\n", address, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (address >= 0x4000)
|
||||
{
|
||||
// MessageBox(NULL, "1", "1", MB_OK);
|
||||
//4010 __GXSetGenMode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - verify that it is correct. Seems to work, though.
|
||||
void LoadIndexedXF(u32 val, int array)
|
||||
{
|
||||
int index = val >> 16;
|
||||
int address = val & 0xFFF; //check mask
|
||||
int size = ((val >> 12) & 0xF) + 1;
|
||||
//load stuff from array to address in xf mem
|
||||
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::InvalidateXFRange(address, address+size);
|
||||
//PRIM_LOG("xfmem iwrite: 0x%x-0x%x\n", address, address+size);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
xfmem[address + i] = Memory_Read_U32(arraybases[array] + arraystrides[array]*index + i*4);
|
||||
}
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "XFMemory.h"
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "XFMemory.h"
|
||||
@@ -458,6 +458,14 @@
|
||||
RelativePath=".\Src\XFMemory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFStructs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFStructs.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ShaderManagers"
|
||||
@@ -470,6 +478,14 @@
|
||||
RelativePath=".\Src\PixelShaderManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShaderManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShaderManager.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Util"
|
||||
@@ -643,18 +659,14 @@
|
||||
RelativePath=".\Src\VertexLoaderManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShaderManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShaderManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VideoCommon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VideoLog.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@@ -250,9 +250,9 @@ void Initialize(void *init)
|
||||
}
|
||||
|
||||
#if defined(WIN32) && defined(_DEBUG)
|
||||
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
||||
_CrtSetDbgFlag(tmpflag);
|
||||
//int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
//tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
||||
//_CrtSetDbgFlag(tmpflag);
|
||||
#endif
|
||||
|
||||
if (soundStream)
|
||||
|
||||
@@ -1185,98 +1185,18 @@
|
||||
RelativePath=".\Src\BPStructs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\CPStructs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\CPStructs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DecodedVArray.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\DecodedVArray.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NativeVertexFormat.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\TransformEngine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\TransformEngine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_Color.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_MtxIndex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_Normal.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_Normal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_Position.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoader_TextCoord.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexLoaderManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFStructs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XFStructs.h"
|
||||
RelativePath=".\Src\VertexShaderCache.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Render"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\PixelShader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PixelShader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\PixelShaderCache.cpp"
|
||||
>
|
||||
@@ -1302,15 +1222,15 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShader.cpp"
|
||||
RelativePath=".\Src\VertexLoaderManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShader.h"
|
||||
RelativePath=".\Src\VertexManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VertexShaderCache.cpp"
|
||||
RelativePath=".\Src\VertexManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "CPStructs.h"
|
||||
#include "XFStructs.h"
|
||||
#include "TransformEngine.h"
|
||||
#include "VertexManager.h"
|
||||
#include "VertexLoader.h"
|
||||
|
||||
@@ -27,7 +26,7 @@
|
||||
|
||||
void CPUpdateMatricesA()
|
||||
{
|
||||
float *flipmem = (float *)xfmem;
|
||||
const float *flipmem = (const float *)xfmem;
|
||||
CTransformEngine::SetPosNormalMatrix(
|
||||
flipmem + MatrixIndexA.PosNormalMtxIdx * 4, //CHECK
|
||||
flipmem + 0x400 + 3 * (MatrixIndexA.PosNormalMtxIdx & 31)); //CHECK
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace D3D
|
||||
{
|
||||
|
||||
LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len)
|
||||
LPDIRECT3DVERTEXSHADER9 CompileVertexShader(const char *code, int len)
|
||||
{
|
||||
//try to compile
|
||||
LPD3DXBUFFER shaderBuffer = 0;
|
||||
@@ -43,8 +43,7 @@ LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len)
|
||||
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
||||
hello += "\n\n";
|
||||
hello += code;
|
||||
if (g_Config.bShowShaderErrors)
|
||||
MessageBox(0, hello.c_str(), "Error compiling vertex shader", MB_ICONERROR);
|
||||
MessageBox(0, hello.c_str(), "Error compiling vertex shader", MB_ICONERROR);
|
||||
vShader = 0;
|
||||
}
|
||||
else if (SUCCEEDED(hr))
|
||||
@@ -55,8 +54,7 @@ LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len)
|
||||
hr = D3D::dev->CreateVertexShader((DWORD *)shaderBuffer->GetBufferPointer(), &vShader);
|
||||
if (FAILED(hr) || vShader == 0)
|
||||
{
|
||||
if (g_Config.bShowShaderErrors)
|
||||
MessageBox(0,code,(char*)errorBuffer->GetBufferPointer(),MB_ICONERROR);
|
||||
MessageBox(0, code, (char*)errorBuffer->GetBufferPointer(),MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len)
|
||||
return vShader;
|
||||
}
|
||||
|
||||
LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len)
|
||||
LPDIRECT3DPIXELSHADER9 CompilePixelShader(const char *code, int len)
|
||||
{
|
||||
LPD3DXBUFFER shaderBuffer = 0;
|
||||
LPD3DXBUFFER errorBuffer = 0;
|
||||
@@ -83,8 +81,7 @@ LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len)
|
||||
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
||||
hello += "\n\n";
|
||||
hello += code;
|
||||
if (g_Config.bShowShaderErrors)
|
||||
MessageBox(0, hello.c_str(), "Error compiling pixel shader", MB_ICONERROR);
|
||||
MessageBox(0, hello.c_str(), "Error compiling pixel shader", MB_ICONERROR);
|
||||
pShader = 0;
|
||||
}
|
||||
else
|
||||
@@ -93,8 +90,7 @@ LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len)
|
||||
HRESULT hr = D3D::dev->CreatePixelShader((DWORD *)shaderBuffer->GetBufferPointer(), &pShader);
|
||||
if (FAILED(hr) || pShader == 0)
|
||||
{
|
||||
if (g_Config.bShowShaderErrors)
|
||||
MessageBox(0,"damn","error creating pixelshader",MB_ICONERROR);
|
||||
MessageBox(0, "damn", "error creating pixelshader", MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,4 +102,5 @@ LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len)
|
||||
|
||||
return pShader;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
namespace D3D
|
||||
{
|
||||
LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len);
|
||||
LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len);
|
||||
LPDIRECT3DVERTEXSHADER9 CompileVertexShader(const char *code, int len);
|
||||
LPDIRECT3DPIXELSHADER9 CompilePixelShader(const char *code, int len);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace D3D
|
||||
HFONT hFont = CreateFont(nHeight, 0, 0, 0, dwBold, 0,
|
||||
FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
|
||||
VARIABLE_PITCH, "Courier New");
|
||||
VARIABLE_PITCH, "Tahoma");
|
||||
|
||||
if (NULL == hFont)
|
||||
return E_FAIL;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DecodedVArray.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
DecodedVArray::DecodedVArray()
|
||||
{
|
||||
Zero();
|
||||
}
|
||||
|
||||
DecodedVArray::~DecodedVArray()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void DecodedVArray::Zero()
|
||||
{
|
||||
size = 0;
|
||||
count = 0;
|
||||
components = 0;
|
||||
positions = 0;
|
||||
posMtxInds = 0;
|
||||
for (int i=0; i<3; i++)
|
||||
normals[i] = 0;
|
||||
for (int i=0; i<2; i++)
|
||||
colors[i] = 0;
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
texMtxInds[i] = 0;
|
||||
uvs[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DecodedVArray::Destroy()
|
||||
{
|
||||
//,,
|
||||
delete [] positions;
|
||||
delete [] posMtxInds;
|
||||
for (int i=0; i<3; i++)
|
||||
delete [] normals[i];
|
||||
for (int i=0; i<2; i++)
|
||||
delete [] colors[i];
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
delete [] uvs[i];
|
||||
delete [] texMtxInds[i];
|
||||
}
|
||||
Zero();
|
||||
}
|
||||
|
||||
void DecodedVArray::Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount)
|
||||
{
|
||||
size = _size;
|
||||
// position matrix indices
|
||||
if (pmcount)
|
||||
posMtxInds = new DecMtxInd[size];
|
||||
// texture matrix indices
|
||||
if (tmcount)
|
||||
for (int i=0; i<tmcount; i++)
|
||||
texMtxInds[i] = new DecMtxInd[size];
|
||||
// positions (always)
|
||||
positions = new DecPos[size];
|
||||
// normals
|
||||
if (nrmcount)
|
||||
for (int i=0; i<nrmcount; i++)
|
||||
normals[i] = new DecNormal[size];
|
||||
// colors
|
||||
if (colcount)
|
||||
for (int i=0; i<colcount; i++)
|
||||
colors[i] = new DecColor[size];
|
||||
|
||||
if (tccount)
|
||||
for (int i=0; i<tccount; i++)
|
||||
uvs[i] = new DecUV[size];
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _DECODED_VARRAY_H
|
||||
#define _DECODED_VARRAY_H
|
||||
|
||||
#include "Vec3.h"
|
||||
#include "Common.h"
|
||||
|
||||
typedef Vec3 DecPos;
|
||||
typedef Vec3 DecNormal;
|
||||
|
||||
struct DecUV
|
||||
{
|
||||
float u,v;
|
||||
};
|
||||
|
||||
typedef u32 DecColor;
|
||||
typedef u8 DecMtxInd;
|
||||
|
||||
int ComputeVertexSize(u32 components);
|
||||
|
||||
//TODO(ector): Change the internal implementation to pack it tight according to components
|
||||
// The tight packing will be fed directly to the gfx card in the mystic future.
|
||||
class DecodedVArray
|
||||
{
|
||||
int size;
|
||||
u32 components;
|
||||
int vertexSize;
|
||||
|
||||
public:
|
||||
int count;
|
||||
DecodedVArray();
|
||||
~DecodedVArray();
|
||||
void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components);
|
||||
ComputeComponents(); }
|
||||
u32 GetComponents() const {return components;}
|
||||
void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount);
|
||||
void Zero();
|
||||
void Destroy();
|
||||
void Reset() {count=0;}
|
||||
int GetSize() {return size;}
|
||||
int GetCount() {return count;}
|
||||
void Next() {count++;}
|
||||
void SetPosNrmIdx(int i) {posMtxInds[count] = i;}
|
||||
void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;}
|
||||
void SetPosX(float x) {positions[count].x=x;}
|
||||
void SetPosY(float y) {positions[count].y=y;}
|
||||
void SetPosZ(float z) {positions[count].z=z;}
|
||||
|
||||
void SetNormalX(int n,float x) {normals[n][count].x=x;}
|
||||
void SetNormalY(int n,float y) {normals[n][count].y=y;}
|
||||
void SetNormalZ(int n,float z) {normals[n][count].z=z;}
|
||||
void SetU(int n, float u) {uvs[n][count].u = u;}
|
||||
void SetV(int n, float v) {uvs[n][count].v = v;}
|
||||
void SetPosition(float x, float y, float z) {
|
||||
positions[count].x=x;
|
||||
positions[count].y=y;
|
||||
positions[count].z=z;
|
||||
}
|
||||
void SetNormal(int n, float x, float y, float z) {
|
||||
normals[n][count].x=x;
|
||||
normals[n][count].y=y;
|
||||
normals[n][count].z=z;
|
||||
}
|
||||
void SetColor(int n, u32 c)
|
||||
{
|
||||
colors[n][count] = c;
|
||||
}
|
||||
void SetUV(int n, float u, float v) {
|
||||
uvs[n][count].u=u;
|
||||
uvs[n][count].v=v;
|
||||
}
|
||||
|
||||
void ComputeComponents() {
|
||||
hasPosMatIdx = (components & (1 << 1)) != 0;
|
||||
for(int i = 0; i < 8; i++)
|
||||
hasTexMatIdx[i] = (components & (1 << (i + 2))) != 0;
|
||||
hasNrm = (components & (1 << 10)) != 0;
|
||||
}
|
||||
|
||||
const DecPos &GetPos(int n) const { return positions[n]; }
|
||||
const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; }
|
||||
const DecColor &GetColor(int i, int n) const { return colors[i][n]; }
|
||||
const DecUV &GetUV(int i, int n) const { return uvs[i][n]; }
|
||||
const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; }
|
||||
const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; }
|
||||
//private:
|
||||
DecPos *positions;
|
||||
DecNormal *normals[3];
|
||||
DecColor *colors[2];
|
||||
DecUV *uvs[8];
|
||||
DecMtxInd *posMtxInds;
|
||||
DecMtxInd *texMtxInds[8];
|
||||
|
||||
// Component data
|
||||
bool hasPosMatIdx, hasTexMatIdx[8], hasNrm;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -52,6 +52,7 @@ namespace EmuWindow
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
exit(0);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
@@ -21,7 +22,7 @@
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "VertexShader.h"
|
||||
#include "VertexShaderGen.h"
|
||||
|
||||
#include "CPMemory.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
@@ -29,7 +30,6 @@
|
||||
|
||||
class D3DVertexFormat : public NativeVertexFormat
|
||||
{
|
||||
PortableVertexDeclaration vtx_decl;
|
||||
LPDIRECT3DVERTEXDECLARATION9 d3d_decl;
|
||||
|
||||
public:
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
virtual void SetupVertexPointers() const;
|
||||
};
|
||||
|
||||
|
||||
NativeVertexFormat *NativeVertexFormat::Create()
|
||||
{
|
||||
return new D3DVertexFormat();
|
||||
@@ -58,7 +57,6 @@ D3DVertexFormat::~D3DVertexFormat()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
D3DDECLTYPE VarToD3D(VarType t)
|
||||
{
|
||||
static const D3DDECLTYPE lookup[5] =
|
||||
@@ -74,6 +72,8 @@ D3DDECLTYPE VarToD3D(VarType t)
|
||||
|
||||
void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
||||
{
|
||||
vertex_stride = _vtx_decl.stride;
|
||||
|
||||
D3DVERTEXELEMENT9 *elems = new D3DVERTEXELEMENT9[32];
|
||||
memset(elems, 0, sizeof(D3DVERTEXELEMENT9) * 32);
|
||||
|
||||
@@ -123,8 +123,9 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
||||
}
|
||||
}
|
||||
|
||||
if (vtx_decl.posmtx_offset != -1)
|
||||
if (_vtx_decl.posmtx_offset != -1)
|
||||
{
|
||||
PanicAlert("boo %i", _vtx_decl.posmtx_offset);
|
||||
// glVertexAttribPointer(SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, vtx_decl.stride, (void *)vtx_decl.posmtx_offset);
|
||||
elems[elem_idx].Offset = _vtx_decl.posmtx_offset;
|
||||
elems[elem_idx].Usage = D3DDECLUSAGE_BLENDINDICES;
|
||||
@@ -132,6 +133,11 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
||||
++elem_idx;
|
||||
}
|
||||
|
||||
// End marker
|
||||
elems[elem_idx].Stream = 0xff;
|
||||
elems[elem_idx].Type = D3DDECLTYPE_UNUSED;
|
||||
++elem_idx;
|
||||
|
||||
if (FAILED(D3D::dev->CreateVertexDeclaration(elems, &d3d_decl)))
|
||||
{
|
||||
PanicAlert("Failed to create D3D vertex declaration!");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user