get rid of few warnings when running with direct3d9 debug runtime

This commit is contained in:
UnknownShadow200 2018-03-10 22:14:56 +11:00
parent 2376994210
commit cec101ba5c
3 changed files with 10 additions and 8 deletions

View File

@ -62,6 +62,7 @@ namespace ClassicalSharp {
/// <summary> Lava style 'swimming'/'bobbing' interaction when player collides. </summary> /// <summary> Lava style 'swimming'/'bobbing' interaction when player collides. </summary>
public const byte LiquidLava = 6; public const byte LiquidLava = 6;
/// <summary> Rope/Ladder style climbing interaction when player collides. </summary>
public const byte ClimbRope = 7; public const byte ClimbRope = 7;
} }

View File

@ -89,7 +89,7 @@ namespace ClassicalSharp.GraphicsAPI {
} }
Compare[] compareFuncs; Compare[] compareFuncs;
Compare alphaTestFunc; Compare alphaTestFunc = Compare.Always;
int alphaTestRef; int alphaTestRef;
public override void AlphaTestFunc(CompareFunc func, float value) { public override void AlphaTestFunc(CompareFunc func, float value) {
alphaTestFunc = compareFuncs[(int)func]; alphaTestFunc = compareFuncs[(int)func];
@ -99,7 +99,8 @@ namespace ClassicalSharp.GraphicsAPI {
} }
Blend[] blendFuncs; Blend[] blendFuncs;
Blend srcBlendFunc, dstBlendFunc; Blend srcBlendFunc = Blend.One;
Blend dstBlendFunc = Blend.Zero;
public override void AlphaBlendFunc(BlendFunc srcFunc, BlendFunc dstFunc) { public override void AlphaBlendFunc(BlendFunc srcFunc, BlendFunc dstFunc) {
srcBlendFunc = blendFuncs[(int)srcFunc]; srcBlendFunc = blendFuncs[(int)srcFunc];
dstBlendFunc = blendFuncs[(int)dstFunc]; dstBlendFunc = blendFuncs[(int)dstFunc];
@ -252,7 +253,7 @@ namespace ClassicalSharp.GraphicsAPI {
device.SetRenderState(RenderState.ColorWriteEnable, flags); device.SetRenderState(RenderState.ColorWriteEnable, flags);
} }
Compare depthTestFunc; Compare depthTestFunc = Compare.LessEqual;
public override void DepthTestFunc(CompareFunc func) { public override void DepthTestFunc(CompareFunc func) {
depthTestFunc = compareFuncs[(int)func]; depthTestFunc = compareFuncs[(int)func];
device.SetRenderState(RenderState.ZFunc, (int)depthTestFunc); device.SetRenderState(RenderState.ZFunc, (int)depthTestFunc);

View File

@ -355,7 +355,7 @@ void Gfx_SetAlphaTest(bool enabled) {
D3D9_SetRenderState((UInt32)enabled, D3DRS_ALPHATESTENABLE, "D3D9_SetAlphaTest"); D3D9_SetRenderState((UInt32)enabled, D3DRS_ALPHATESTENABLE, "D3D9_SetAlphaTest");
} }
D3DCMPFUNC d3d9_alphaTestFunc = 0; D3DCMPFUNC d3d9_alphaTestFunc = D3DCMP_ALWAYS;
Int32 d3d9_alphaTestRef = 0; Int32 d3d9_alphaTestRef = 0;
void Gfx_SetAlphaTestFunc(Int32 compareFunc, Real32 refValue) { void Gfx_SetAlphaTestFunc(Int32 compareFunc, Real32 refValue) {
d3d9_alphaTestFunc = d3d9_compareFuncs[compareFunc]; d3d9_alphaTestFunc = d3d9_compareFuncs[compareFunc];
@ -372,8 +372,8 @@ void Gfx_SetAlphaBlending(bool enabled) {
D3D9_SetRenderState((UInt32)enabled, D3DRS_ALPHABLENDENABLE, "D3D9_SetAlphaBlending"); D3D9_SetRenderState((UInt32)enabled, D3DRS_ALPHABLENDENABLE, "D3D9_SetAlphaBlending");
} }
D3DBLEND d3d9_srcBlendFunc = 0; D3DBLEND d3d9_srcBlendFunc = D3DBLEND_ONE;
D3DBLEND d3d9_dstBlendFunc = 0; D3DBLEND d3d9_dstBlendFunc = D3DBLEND_ZERO;
void Gfx_SetAlphaBlendFunc(Int32 srcBlendFunc, Int32 dstBlendFunc) { void Gfx_SetAlphaBlendFunc(Int32 srcBlendFunc, Int32 dstBlendFunc) {
d3d9_srcBlendFunc = d3d9_blendFuncs[srcBlendFunc]; d3d9_srcBlendFunc = d3d9_blendFuncs[srcBlendFunc];
D3D9_SetRenderState(d3d9_srcBlendFunc, D3DRS_SRCBLEND, "D3D9_SetAlphaBlendFunc_Src"); D3D9_SetRenderState(d3d9_srcBlendFunc, D3DRS_SRCBLEND, "D3D9_SetAlphaBlendFunc_Src");
@ -405,7 +405,7 @@ void Gfx_SetDepthTest(bool enabled) {
D3D9_SetRenderState((UInt32)enabled, D3DRS_ZENABLE, "D3D9_SetDepthTest"); D3D9_SetRenderState((UInt32)enabled, D3DRS_ZENABLE, "D3D9_SetDepthTest");
} }
D3DCMPFUNC d3d9_depthTestFunc = 0; D3DCMPFUNC d3d9_depthTestFunc = D3DCMP_LESSEQUAL;
void Gfx_SetDepthTestFunc(Int32 compareFunc) { void Gfx_SetDepthTestFunc(Int32 compareFunc) {
d3d9_depthTestFunc = d3d9_compareFuncs[compareFunc]; d3d9_depthTestFunc = d3d9_compareFuncs[compareFunc];
D3D9_SetRenderState(d3d9_alphaTestFunc, D3DRS_ZFUNC, "D3D9_SetDepthTestFunc"); D3D9_SetRenderState(d3d9_alphaTestFunc, D3DRS_ZFUNC, "D3D9_SetDepthTestFunc");
@ -528,7 +528,7 @@ void Gfx_DrawVb_IndexedTris_Range(Int32 verticesCount, Int32 startVertex) {
} }
void Gfx_DrawIndexedVb_TrisT2fC4b(Int32 verticesCount, Int32 startVertex) { void Gfx_DrawIndexedVb_TrisT2fC4b(Int32 verticesCount, Int32 startVertex) {
ReturnCode hresult = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, ReturnCode hresult = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST,
startVertex, 0, verticesCount, 0, verticesCount >> 1); startVertex, 0, verticesCount, 0, verticesCount >> 1);
ErrorHandler_CheckOrFail(hresult, "D3D9_DrawIndexedVb_TrisT2fC4b"); ErrorHandler_CheckOrFail(hresult, "D3D9_DrawIndexedVb_TrisT2fC4b");
} }