当前位置: 首页>>代码示例>>C#>>正文


C# State.GpuStateStruct类代码示例

本文整理汇总了C#中CSPspEmu.Core.Gpu.State.GpuStateStruct的典型用法代码示例。如果您正苦于以下问题:C# GpuStateStruct类的具体用法?C# GpuStateStruct怎么用?C# GpuStateStruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GpuStateStruct类属于CSPspEmu.Core.Gpu.State命名空间,在下文中一共展示了GpuStateStruct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareStateMatrix

		private static void PrepareStateMatrix(GpuStateStruct* GpuState)
		{
			// DRAW BEGIN COMMON
			{
				if (GpuState->VertexState.Type.Transform2D)
				//if (true)
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.Ortho(0, 480, 272, 0, 0, -0xFFFF);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
				}
				else
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.MultMatrix(GpuState->VertexState.ProjectionMatrix.Values);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
					GpuState->VertexState.ViewMatrix.SetLastColumn();
					GpuState->VertexState.WorldMatrix.SetLastColumn();
					GL.MultMatrix(GpuState->VertexState.ViewMatrix.Values);
					GL.MultMatrix(GpuState->VertexState.WorldMatrix.Values);

					if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
					{
						throw (new Exception("Invalid WorldMatrix"));
					}

					//GpuState->VertexState.ViewMatrix.Dump();
					//GpuState->VertexState.WorldMatrix.Dump();

					//Console.WriteLine("NO Transform2D");
				}
			}
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:35,代码来源:OpenglGpuImpl.StateMatrix.cs

示例2: Transfer

        public override void Transfer(GpuStateStruct* GpuState)
        {
            //return;
            var TextureTransferState = GpuState->TextureTransferState;

            if (
                (TextureTransferState.DestinationAddress.Address == GpuState->DrawBufferState.Address) &&
                (TextureTransferState.DestinationLineWidth == GpuState->DrawBufferState.Width) &&
                (TextureTransferState.BytesPerPixel == GpuState->DrawBufferState.BytesPerPixel)
            )
            {
                //Console.Error.WriteLine("Writting to DrawBuffer");
                TransferToFrameBuffer(GpuState);
            }
            else
            {
                Console.Error.WriteLine("NOT Writting to DrawBuffer");
                TransferGeneric(GpuState);
                /*
                base.Transfer(GpuStateStruct);
                PrepareWrite(GpuStateStruct);
                {

                }
                PrepareRead(GpuStateStruct);
                */
            }
            Console.Error.WriteLine("GpuImpl.Transfer Not Implemented!! : {0}", GpuState->TextureTransferState.ToStringDefault());
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:29,代码来源:OpenglGpuImpl.Transfer.cs

示例3: PrepareStateMatrix

        internal static void PrepareStateMatrix(GpuStateStruct* GpuState, ref Matrix4f WorldViewProjectionMatrix)
        {
            // DRAW BEGIN COMMON
            {
                if (GpuState->VertexState.Type.Transform2D)
                //if (true)
                {
                    WorldViewProjectionMatrix = Matrix4f.Ortho(0, 512, 272, 0, 0, -0xFFFF);
                    //WorldViewProjectionMatrix = Matrix4f.Ortho(0, 480, 272, 0, 0, -0xFFFF);
                }
                else
                {
                    if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
                    {
                        //Console.Error.WriteLine("Invalid WorldMatrix");
                        //Console.Error.WriteLine("Projection:");
                        //GpuState->VertexState.ProjectionMatrix.Dump();
                        //Console.Error.WriteLine("View:");
                        //GpuState->VertexState.ViewMatrix.Dump();
                        //Console.Error.WriteLine("World:");
                        //GpuState->VertexState.WorldMatrix.Dump();
                    }

                    GpuState->VertexState.ViewMatrix.SetLastColumn();
                    GpuState->VertexState.WorldMatrix.SetLastColumn();

                    WorldViewProjectionMatrix =
                        Matrix4f.Identity
                        .Multiply(GpuState->VertexState.WorldMatrix.Matrix4)
                        .Multiply(GpuState->VertexState.ViewMatrix.Matrix4)
                        .Multiply(GpuState->VertexState.ProjectionMatrix.Matrix4)
                    ;
                }
            }
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:35,代码来源:OpenglGpuImplMatrix.cs

示例4: PrepareStateDraw

		private void PrepareStateDraw(GpuStateStruct* GpuState)
		{
			GL.ColorMask(true, true, true, true);

#if ENABLE_TEXTURES
			PrepareState_Texture_Common(GpuState);
#endif
			PrepareState_Blend(GpuState);

			if (GpuState->VertexState.Type.Transform2D)
			{
				PrepareState_Colors_2D(GpuState);
				GL.Disable(EnableCap.StencilTest);
				GL.Disable(EnableCap.CullFace);
				GL.DepthRange((double)0, (double)1);
				GL.Disable(EnableCap.DepthTest);
				GL.Disable(EnableCap.Lighting);
			}
			else
			{
				PrepareState_Colors_3D(GpuState);
				PrepareState_CullFace(GpuState);
				PrepareState_Lighting(GpuState);
				PrepareState_Depth(GpuState);
				PrepareState_DepthTest(GpuState);
				PrepareState_Stencil(GpuState);
			}
			GL.ShadeModel((GpuState->ShadeModel == ShadingModelEnum.Flat) ? ShadingModel.Flat : ShadingModel.Smooth);
			PrepareState_AlphaTest(GpuState);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:30,代码来源:OpenglGpuImpl.StateDraw.cs

示例5: PrepareStateCommon

        private void PrepareStateCommon(GpuStateStruct* GpuState)
        {
            var Viewport = GpuState->Viewport;
            //ViewportStruct(
            //  Position=Vector3f(X=2048,Y=2048,Z=0.9999847),
            //  Scale=Vector3f(X=480,Y=-272,Z=-32768),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=479,Y=271)
            //)
            //ViewportStruct(
            //  RegionSize=PointS(X=384,Y=240),
            //  Position=Vector3f(X=2048,Y=2048,Z=0),
            //  Scale=Vector3f(X=480,Y=-272,Z=0),
            //  RegionTopLeft=PointS(X=0,Y=0),
            //  RegionBottomRight=PointS(X=383,Y=239)
            //)
            //Console.Error.WriteLine(Viewport.ToString());

            GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Fastest);
            GL.Hint(HintTarget.LineSmoothHint, HintMode.Fastest);
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Fastest);
            GL.Hint(HintTarget.PointSmoothHint, HintMode.Fastest);

            int ScaledWidth = (int)(((double)480 / (double)Viewport.RegionSize.X) * (double)480);
            int ScaledHeight = (int)(((double)272 / (double)Viewport.RegionSize.Y) * (double)272);

            GL.Viewport(
                (int)Viewport.RegionTopLeft.X,
                (int)Viewport.RegionTopLeft.Y,
                ScaledWidth,
                ScaledHeight
            );
        }
开发者ID:e-COS,项目名称:cspspemu,代码行数:33,代码来源:OpenglGpuImpl.StateCommon.cs

示例6: PrepareState_Stencil

		private void PrepareState_Stencil(GpuStateStruct* GpuState)
		{
			if (!GlEnableDisable(GL.GL_STENCIL_TEST, GpuState->StencilState.Enabled))
			{
				return;
			}

			//Console.Error.WriteLine("aaaaaa!");

			//if (state.stencilFuncFunc == 2) { outputDepthAndStencil(); assert(0); }

#if false
											Console.Error.WriteLine(
			"{0}:{1}:{2} - {3}, {4}, {5}",
			StencilFunctionTranslate[(int)GpuState->StencilState.Function],
			GpuState->StencilState.FunctionRef,
			GpuState->StencilState.FunctionMask,
			StencilOperationTranslate[(int)GpuState->StencilState.OperationFail],
			StencilOperationTranslate[(int)GpuState->StencilState.OperationZFail],
			StencilOperationTranslate[(int)GpuState->StencilState.OperationZPass]
		);
#endif

			GL.glStencilFunc(
				StencilFunctionTranslate[(int)GpuState->StencilState.Function],
				GpuState->StencilState.FunctionRef,
				GpuState->StencilState.FunctionMask
			);

			GL.glStencilOp(
				StencilOperationTranslate[(int)GpuState->StencilState.OperationFail],
				StencilOperationTranslate[(int)GpuState->StencilState.OperationZFail],
				StencilOperationTranslate[(int)GpuState->StencilState.OperationZPass]
			);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:35,代码来源:GpuImplOpenglEs.StateDraw.cs

示例7: TransferToFrameBuffer

		private void TransferToFrameBuffer(GpuStateStruct* GpuState)
		{
			var TextureTransferState = GpuState->TextureTransferState;

			var GlPixelFormat = GlPixelFormatList[(int)GpuState->DrawBufferState.Format];

			GL.PixelZoom(1, -1);
			GL.WindowPos2(TextureTransferState.DestinationX, 272 - TextureTransferState.DestinationY);
			//GL.PixelZoom(1, -1);
			//GL.PixelZoom(1, 1);
			GL.PixelStore(PixelStoreParameter.UnpackAlignment, TextureTransferState.BytesPerPixel);
			GL.PixelStore(PixelStoreParameter.UnpackRowLength, TextureTransferState.SourceLineWidth);
			GL.PixelStore(PixelStoreParameter.UnpackSkipPixels, TextureTransferState.SourceX);
			GL.PixelStore(PixelStoreParameter.UnpackSkipRows, TextureTransferState.SourceY);

			{
				GL.DrawPixels(
					TextureTransferState.Width,
					TextureTransferState.Height,
					PixelFormat.Rgba,
					GlPixelFormat.OpenglPixelType,
					new IntPtr(Memory.PspAddressToPointerSafe(
						TextureTransferState.SourceAddress,
						TextureTransferState.Width * TextureTransferState.Height * 4
					))
				);
			}

			GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
			GL.PixelStore(PixelStoreParameter.UnpackRowLength, 0);
			GL.PixelStore(PixelStoreParameter.UnpackSkipPixels, 0);
			GL.PixelStore(PixelStoreParameter.UnpackSkipRows, 0);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:33,代码来源:OpenglGpuImpl.Transfer.cs

示例8: PrepareStateDraw

		private void PrepareStateDraw(GpuStateStruct* GpuState)
		{
			GL.glColorMask(true, true, true, true);

#if ENABLE_TEXTURES
			PrepareState_Texture_Common(GpuState);
#endif
			PrepareState_Blend(GpuState);

			if (GpuState->VertexState.Type.Transform2D)
			{
				PrepareState_Colors_2D(GpuState);
				GL.glDisable(GL.GL_STENCIL_TEST);
				GL.glDisable(GL.GL_CULL_FACE);
				GL.glDepthRangef(0, 1);
				GL.glDisable(GL.GL_DEPTH_TEST);
				//GL.glDisable(GL.GL_LIGHTNING_TEST);
			}
			else
			{
				PrepareState_Colors_3D(GpuState);
				PrepareState_CullFace(GpuState);
				PrepareState_Lighting(GpuState);
				PrepareState_Depth(GpuState);
				PrepareState_DepthTest(GpuState);
				PrepareState_Stencil(GpuState);
			}
			//GL.ShadeModel((GpuState->ShadeModel == ShadingModelEnum.Flat) ? ShadingModel.Flat : ShadingModel.Smooth);
			PrepareState_AlphaTest(GpuState);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:30,代码来源:GpuImplOpenglEs.StateDraw.cs

示例9: TransferGeneric

        private void TransferGeneric(GpuStateStruct* GpuState)
        {
            Console.WriteLine("TransferGeneric Not Implemented");
            var TextureTransferState = GpuState->TextureTransferState;

            var SourceX = TextureTransferState.SourceX;
            var SourceY = TextureTransferState.SourceY;
            var DestinationX = TextureTransferState.DestinationX;
            var DestinationY = TextureTransferState.DestinationY;
            var BytesPerPixel = TextureTransferState.BytesPerPixel;

            var SourceTotalBytes = TextureTransferState.SourceLineWidth * TextureTransferState.Height * BytesPerPixel;
            var DestinationTotalBytes = TextureTransferState.DestinationLineWidth * TextureTransferState.Height * BytesPerPixel;

            var SourcePointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.SourceAddress.Address, SourceTotalBytes);
            var DestinationPointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.DestinationAddress.Address, DestinationTotalBytes);

            for (uint y = 0; y < TextureTransferState.Height; y++)
            {
                var RowSourceOffset = (uint)(
                    (TextureTransferState.SourceLineWidth * (y + SourceY)) + SourceX
                );
                var RowDestinationOffset = (uint)(
                    (TextureTransferState.DestinationLineWidth * (y + DestinationY)) + DestinationX
                );
                PointerUtils.Memcpy(
                    DestinationPointer + RowDestinationOffset * BytesPerPixel,
                    SourcePointer + RowSourceOffset * BytesPerPixel,
                    TextureTransferState.Width * BytesPerPixel
                );
            }

            /*
            // Generic implementation.
            with (gpu.state.textureTransfer) {
                auto srcAddressHost = cast(ubyte*)gpu.memory.getPointer(srcAddress);
                auto dstAddressHost = cast(ubyte*)gpu.memory.getPointer(dstAddress);

                if (gpu.state.drawBuffer.isAnyAddressInBuffer([srcAddress, dstAddress])) {
                    gpu.performBufferOp(BufferOperation.STORE, BufferType.COLOR);
                }

                for (int n = 0; n < height; n++) {
                    int srcOffset = ((n + srcY) * srcLineWidth + srcX) * bpp;
                    int dstOffset = ((n + dstY) * dstLineWidth + dstX) * bpp;
                    (dstAddressHost + dstOffset)[0.. width * bpp] = (srcAddressHost + srcOffset)[0.. width * bpp];
                    //writefln("%08X <- %08X :: [%d]", dstOffset, srcOffset, width * bpp);
                }
                //std.file.write("buffer", dstAddressHost[0..512 * 272 * 4]);

                if (gpu.state.drawBuffer.isAnyAddressInBuffer([dstAddress])) {
                    //gpu.impl.test();
                    //gpu.impl.test("trxkick");
                    gpu.markBufferOp(BufferOperation.LOAD, BufferType.COLOR);
                }
                //gpu.impl.test();
            }
            */
        }
开发者ID:soywiz,项目名称:cspspemu,代码行数:59,代码来源:OpenglGpuImpl.Transfer.cs

示例10: PrepareState_Blend

        private void PrepareState_Blend(GpuStateStruct* GpuState)
        {
            var BlendingState = &GpuState->BlendingState;
            if (!GlEnableDisable(EnableCap.Blend, BlendingState->Enabled))
            {
                return;
            }

            //Console.WriteLine("Blend!");

            var OpenglFunctionSource = BlendFuncSrcTranslate[(int)BlendingState->FunctionSource];
            //var OpenglFunctionDestination = BlendFuncDstTranslate[(int)BlendingState->FunctionDestination];
            var OpenglFunctionDestination = (BlendingFactorDest)BlendFuncSrcTranslate[(int)BlendingState->FunctionDestination];

            Func<ColorfStruct, int> getBlendFix = (Color) =>
            {
                if (Color.IsColorf(0, 0, 0)) return GL_ZERO;
                if (Color.IsColorf(1, 1, 1)) return GL_ONE;
                return GL_CONSTANT_COLOR;
            };

            if (BlendingState->FunctionSource == GuBlendingFactorSource.GU_FIX)
            {
                OpenglFunctionSource = (BlendingFactorSrc)getBlendFix(BlendingState->FixColorSource);
            }

            if (BlendingState->FunctionDestination == GuBlendingFactorDestination.GU_FIX)
            {
                if (((int)OpenglFunctionSource == GL_CONSTANT_COLOR) && (BlendingState->FixColorSource + BlendingState->FixColorDestination).IsColorf(1, 1, 1))
                {
                    OpenglFunctionDestination = (BlendingFactorDest)GL_ONE_MINUS_CONSTANT_COLOR;
                }
                else
                {
                    OpenglFunctionDestination = (BlendingFactorDest)getBlendFix(BlendingState->FixColorDestination);
                }
            }
            //Console.WriteLine("{0}, {1}", OpenglFunctionSource, OpenglFunctionDestination);

            var OpenglBlendEquation = BlendEquationTranslate[(int)BlendingState->Equation];

            /*
            Console.WriteLine(
                "{0} : {1} -> {2}",
                OpenglBlendEquation, OpenglFunctionSource, OpenglFunctionDestination
            );
            */

            GL.BlendEquation(OpenglBlendEquation);
            GL.BlendFunc(OpenglFunctionSource, OpenglFunctionDestination);

            GL.BlendColor(
                BlendingState->FixColorDestination.Red,
                BlendingState->FixColorDestination.Green,
                BlendingState->FixColorDestination.Blue,
                BlendingState->FixColorDestination.Alpha
            );
        }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:58,代码来源:OpenglGpuImpl.State.cs

示例11: PrepareStateMatrix

		private void PrepareStateMatrix(GpuStateStruct* GpuState)
		{
			var VertexType = GpuState->VertexState.Type;
			var TextureState = &GpuState->TextureMappingState.TextureState;

			if (VertexType.Transform2D)
			{
				projectionMatrix.SetMatrix4(Matrix4Ortho);
				worldMatrix.SetMatrix4(Matrix4Identity);
				viewMatrix.SetMatrix4(Matrix4Identity);
				GL.glDepthRangef(0f, 1f);
			}
			else
			{
				projectionMatrix.SetMatrix4(GpuState->VertexState.ProjectionMatrix.Values);
				worldMatrix.SetMatrix4(GpuState->VertexState.WorldMatrix.Values);
				viewMatrix.SetMatrix4(GpuState->VertexState.ViewMatrix.Values);
			}

			/*
			// DRAW BEGIN COMMON
			{
				if (GpuState->VertexState.Type.Transform2D)
				//if (true)
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.Ortho(0, 480, 272, 0, 0, -0xFFFF);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
				}
				else
				{
					GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity();
					GL.MultMatrix(GpuState->VertexState.ProjectionMatrix.Values);

					GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();
					GpuState->VertexState.ViewMatrix.SetLastColumn();
					GpuState->VertexState.WorldMatrix.SetLastColumn();
					GL.MultMatrix(GpuState->VertexState.ViewMatrix.Values);
					GL.MultMatrix(GpuState->VertexState.WorldMatrix.Values);

					if (float.IsNaN(GpuState->VertexState.WorldMatrix.Values[0]))
					{
						throw (new Exception("Invalid WorldMatrix"));
					}

					//GpuState->VertexState.ViewMatrix.Dump();
					//GpuState->VertexState.WorldMatrix.Dump();

					//Console.WriteLine("NO Transform2D");
				}
			}
			*/
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:54,代码来源:GpuImplOpenglEs.StateMatrix.cs

示例12: PrepareState_AlphaTest

        private void PrepareState_AlphaTest(GpuStateStruct* GpuState)
        {
            if (!GlEnableDisable(EnableCap.AlphaTest, GpuState->AlphaTestState.Enabled))
            {
                return;
            }

            GL.AlphaFunc(
                (AlphaFunction)TestTranslate[(int)GpuState->AlphaTestState.Function],
                GpuState->AlphaTestState.Value
            );
        }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:12,代码来源:OpenglGpuImpl.State.cs

示例13: PrepareStateClear

		static void PrepareStateClear(GpuStateStruct* GpuState)
		{
			bool ccolorMask = false, calphaMask = false;

			//return;

			GL.glDisable(GL.GL_BLEND);
			//GL.glDisable(GLEnableCap.Lighting);
			GL.glDisable(GL.GL_TEXTURE_2D);
			//GL.glDisable(EnableCap.AlphaTest);
			GL.glDisable(GL.GL_DEPTH_TEST);
			GL.glDisable(GL.GL_STENCIL_TEST);
			//GL.glDisable(EnableCap.Fog);
			//GL.glDisable(EnableCap.ColorLogicOp);
			GL.glDisable(GL.GL_CULL_FACE);
			GL.glDepthMask(false);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.ColorBuffer))
			{
				ccolorMask = true;
			}

			if (GlEnableDisable(GL.GL_STENCIL_TEST, GpuState->ClearFlags.HasFlag(ClearBufferSet.StencilBuffer)))
			{
				calphaMask = true;
				// Sets to 0x00 the stencil.
				// @TODO @FIXME! : Color should be extracted from the color! (as alpha component)
				GL.glStencilFunc(GL.GL_ALWAYS, 0x00, 0xFF);
				GL.glStencilOp(GL.GL_REPLACE, GL.GL_REPLACE, GL.GL_REPLACE);
				//Console.Error.WriteLine("Stencil!");
				//GL.Enable(EnableCap.DepthTest);
			}

			//int i; glGetIntegerv(GL_STENCIL_BITS, &i); writefln("GL_STENCIL_BITS: %d", i);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.DepthBuffer))
			{
				GL.glEnable(GL.GL_DEPTH_TEST);
				GL.glDepthFunc(GL.GL_ALWAYS);
				GL.glDepthMask(true);
				GL.glDepthRangef(0f, 0f);
				//GL.DepthRange((double)-1, (double)0);

				//glDepthRange(0.0, 1.0); // Original value
			}

			GL.glColorMask(ccolorMask, ccolorMask, ccolorMask, calphaMask);

			//glClearDepth(0.0); glClear(GL_COLOR_BUFFER_BIT);

			//if (state.clearFlags & ClearBufferMask.GU_COLOR_BUFFER_BIT) glClear(GL_DEPTH_BUFFER_BIT);
			//GL.Clear(ClearBufferMask.StencilBufferBit);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:53,代码来源:GpuImplOpenglEs.StateClear.cs

示例14: PrepareState_AlphaTest

		private void PrepareState_AlphaTest(GpuStateStruct* GpuState)
		{
			//if (!GL.EnableDisable(EnableCap.AlphaTest, GpuState->AlphaTestState.Enabled))
			//{
			//	return;
			//}
			//
			//GL.glAlphaFunc(
			//	(AlphaFunction)DepthFunctionTranslate[(int)GpuState->AlphaTestState.Function],
			//	GpuState->AlphaTestState.Value
			//);
		}
开发者ID:soywiz,项目名称:cspspemu,代码行数:12,代码来源:OpenglGpuImpl.StateDraw.cs

示例15: PrepareStateClear

	    static void PrepareStateClear(GpuStateStruct* GpuState)
		{
			bool ccolorMask = false, calphaMask = false;

			//return;

			GL.Disable(EnableCap.Blend);
			GL.Disable(EnableCap.Lighting);
			GL.Disable(EnableCap.Texture2D);
			GL.Disable(EnableCap.AlphaTest);
			GL.Disable(EnableCap.DepthTest);
			GL.Disable(EnableCap.StencilTest);
			GL.Disable(EnableCap.Fog);
			GL.Disable(EnableCap.ColorLogicOp);
			GL.Disable(EnableCap.CullFace);
			GL.DepthMask(false);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.ColorBuffer))
			{
				ccolorMask = true;
			}

			if (GlEnableDisable(EnableCap.StencilTest, GpuState->ClearFlags.HasFlag(ClearBufferSet.StencilBuffer)))
			{
				calphaMask = true;
				// Sets to 0x00 the stencil.
				// @TODO @FIXME! : Color should be extracted from the color! (as alpha component)
				GL.StencilFunc(StencilFunction.Always, 0x00, 0xFF);
				GL.StencilOp(StencilOp.Replace, StencilOp.Replace, StencilOp.Replace);
				//Console.Error.WriteLine("Stencil!");
				//GL.Enable(EnableCap.DepthTest);
			}

			//int i; glGetIntegerv(GL_STENCIL_BITS, &i); writefln("GL_STENCIL_BITS: %d", i);

			if (GpuState->ClearFlags.HasFlag(ClearBufferSet.DepthBuffer))
			{
				GL.Enable(EnableCap.DepthTest);
				GL.DepthFunc(DepthFunction.Always);
				GL.DepthMask(true);
				GL.DepthRange((double)0, (double)0);
				//GL.DepthRange((double)-1, (double)0);

				//glDepthRange(0.0, 1.0); // Original value
			}

			GL.ColorMask(ccolorMask, ccolorMask, ccolorMask, calphaMask);

			//glClearDepth(0.0); glClear(GL_COLOR_BUFFER_BIT);

			//if (state.clearFlags & ClearBufferMask.GU_COLOR_BUFFER_BIT) glClear(GL_DEPTH_BUFFER_BIT);
			//GL.Clear(ClearBufferMask.StencilBufferBit);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:53,代码来源:OpenglGpuImpl.StateClear.cs


注:本文中的CSPspEmu.Core.Gpu.State.GpuStateStruct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。