DXGL r122 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r121‎ | r122 | r123 >
Date:22:30, 11 March 2012
Author:admin
Status:new
Tags:
Comment:
Add SetTextureStageState
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -142,7 +142,9 @@
143143 0,
144144 0,
145145 D3DTTFF_DISABLE,
146 - NULL
 146+ NULL,
 147+ 0,
 148+ 0
147149 };
148150 const TEXTURESTAGE texstagedefault1 =
149151 {
@@ -166,7 +168,9 @@
167169 0,
168170 0,
169171 D3DTTFF_DISABLE,
170 - NULL
 172+ NULL,
 173+ 0,
 174+ 0
171175 };
172176
173177 int setdrawmode(D3DPRIMITIVETYPE d3dptPrimitiveType)
@@ -869,6 +873,129 @@
870874 HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
871875 {
872876 if(!this) return DDERR_INVALIDPARAMS;
 877+ if(dwStage > 7) return DDERR_INVALIDPARAMS;
 878+ switch(dwState)
 879+ {
 880+ case D3DTSS_COLOROP:
 881+ if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
 882+ texstages[dwStage].colorop = (D3DTEXTUREOP)dwValue;
 883+ texstages[dwStage].dirty = true;
 884+ return D3D_OK;
 885+ case D3DTSS_COLORARG1:
 886+ if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
 887+ if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 888+ texstages[dwStage].colorarg1 = dwValue;
 889+ texstages[dwStage].dirty = true;
 890+ return D3D_OK;
 891+ case D3DTSS_COLORARG2:
 892+ if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
 893+ if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 894+ texstages[dwStage].colorarg2 = dwValue;
 895+ texstages[dwStage].dirty = true;
 896+ return D3D_OK;
 897+ case D3DTSS_ALPHAOP:
 898+ if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
 899+ texstages[dwStage].alphaop = (D3DTEXTUREOP )dwValue;
 900+ texstages[dwStage].dirty = true;
 901+ return D3D_OK;
 902+ case D3DTSS_ALPHAARG1:
 903+ if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
 904+ if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 905+ texstages[dwStage].alphaarg1 = dwValue;
 906+ texstages[dwStage].dirty = true;
 907+ return D3D_OK;
 908+ case D3DTSS_ALPHAARG2:
 909+ if((dwValue & D3DTA_SELECTMASK) > 4) return DDERR_INVALIDPARAMS;
 910+ if(dwValue > 0x34) return DDERR_INVALIDPARAMS;
 911+ texstages[dwStage].alphaarg2 = dwValue;
 912+ texstages[dwStage].dirty = true;
 913+ return D3D_OK;
 914+ case D3DTSS_BUMPENVMAT00:
 915+ memcpy(&texstages[dwStage].bumpenv00,&dwValue,sizeof(D3DVALUE));
 916+ texstages[dwStage].dirty = true;
 917+ return D3D_OK;
 918+ case D3DTSS_BUMPENVMAT01:
 919+ memcpy(&texstages[dwStage].bumpenv01,&dwValue,sizeof(D3DVALUE));
 920+ texstages[dwStage].dirty = true;
 921+ return D3D_OK;
 922+ case D3DTSS_BUMPENVMAT10:
 923+ memcpy(&texstages[dwStage].bumpenv10,&dwValue,sizeof(D3DVALUE));
 924+ texstages[dwStage].dirty = true;
 925+ return D3D_OK;
 926+ case D3DTSS_BUMPENVMAT11:
 927+ memcpy(&texstages[dwStage].bumpenv11,&dwValue,sizeof(D3DVALUE));
 928+ texstages[dwStage].dirty = true;
 929+ return D3D_OK;
 930+ case D3DTSS_TEXCOORDINDEX:
 931+ if((dwValue & 0xFFFF) > 7) return DDERR_INVALIDPARAMS;
 932+ if((dwValue >> 16) > 3) return DDERR_INVALIDPARAMS;
 933+ texstages[dwStage].texcoordindex = dwValue;
 934+ texstages[dwStage].dirty = true;
 935+ return D3D_OK;
 936+ case D3DTSS_ADDRESS:
 937+ if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 938+ texstages[dwStage].addressu = (D3DTEXTUREADDRESS)dwValue;
 939+ texstages[dwStage].addressv = (D3DTEXTUREADDRESS)dwValue;
 940+ texstages[dwStage].dirty = true;
 941+ return D3D_OK;
 942+ case D3DTSS_ADDRESSU:
 943+ if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 944+ texstages[dwStage].addressu = (D3DTEXTUREADDRESS)dwValue;
 945+ texstages[dwStage].dirty = true;
 946+ return D3D_OK;
 947+ case D3DTSS_ADDRESSV:
 948+ if(!dwValue || (dwValue > 4)) return DDERR_INVALIDPARAMS;
 949+ texstages[dwStage].addressv = (D3DTEXTUREADDRESS)dwValue;
 950+ texstages[dwStage].dirty = true;
 951+ return D3D_OK;
 952+ case D3DTSS_BORDERCOLOR:
 953+ texstages[dwStage].bordercolor = dwValue;
 954+ texstages[dwStage].dirty = true;
 955+ return D3D_OK;
 956+ case D3DTSS_MAGFILTER:
 957+ if(!dwValue || (dwValue > 5)) return DDERR_INVALIDPARAMS;
 958+ texstages[dwStage].magfilter = (D3DTEXTUREMAGFILTER)dwValue;
 959+ texstages[dwStage].dirty = true;
 960+ return D3D_OK;
 961+ case D3DTSS_MINFILTER:
 962+ if(!dwValue || (dwValue > 3)) return DDERR_INVALIDPARAMS;
 963+ texstages[dwStage].minfilter = (D3DTEXTUREMINFILTER)dwValue;
 964+ texstages[dwStage].dirty = true;
 965+ return D3D_OK;
 966+ case D3DTSS_MIPFILTER:
 967+ if(!dwValue || (dwValue > 3)) return DDERR_INVALIDPARAMS;
 968+ texstages[dwStage].mipfilter = (D3DTEXTUREMIPFILTER)dwValue;
 969+ texstages[dwStage].dirty = true;
 970+ return D3D_OK;
 971+ case D3DTSS_MIPMAPLODBIAS:
 972+ memcpy(&texstages[dwStage].lodbias,&dwValue,sizeof(D3DVALUE));
 973+ texstages[dwStage].dirty = true;
 974+ return D3D_OK;
 975+ case D3DTSS_MAXMIPLEVEL:
 976+ texstages[dwStage].miplevel = dwValue;
 977+ texstages[dwStage].dirty = true;
 978+ return D3D_OK;
 979+ case D3DTSS_MAXANISOTROPY:
 980+ texstages[dwStage].anisotropy = dwValue;
 981+ texstages[dwStage].dirty = true;
 982+ return D3D_OK;
 983+ case D3DTSS_BUMPENVLSCALE:
 984+ memcpy(&texstages[dwStage].bumpenvlscale,&dwValue,sizeof(D3DVALUE));
 985+ texstages[dwStage].dirty = true;
 986+ return D3D_OK;
 987+ case D3DTSS_BUMPENVLOFFSET:
 988+ memcpy(&texstages[dwStage].bumpenvloffset,&dwValue,sizeof(D3DVALUE));
 989+ texstages[dwStage].dirty = true;
 990+ return D3D_OK;
 991+ case D3DTSS_TEXTURETRANSFORMFLAGS:
 992+ if((dwValue & 0xFF) > 4) return DDERR_INVALIDPARAMS;
 993+ if((dwValue >> 8) > 1) return DDERR_INVALIDPARAMS;
 994+ texstages[dwStage].textransform = dwValue;
 995+ texstages[dwStage].dirty = true;
 996+ return D3D_OK;
 997+ default:
 998+ return DDERR_INVALIDPARAMS;
 999+ }
8731000 FIXME("glDirect3DDevice7::SetTextureStageState: stub");
8741001 ERR(DDERR_GENERIC);
8751002 }
Index: ddraw/glDirect3DDevice.h
@@ -45,6 +45,8 @@
4646 D3DVALUE bumpenvloffset;
4747 D3DTEXTURETRANSFORMFLAGS textransform;
4848 glDirectDrawSurface7 *texture;
 49+ bool dirty;
 50+ __int64 shaderid;
4951 };
5052
5153 class glDirect3DLight;