Axiom.RenderSystems.OpenGL.ATI.PixelShader.BindMachineInstInPassToFragmentShader C# (CSharp) Метод

BindMachineInstInPassToFragmentShader() приватный Метод

private BindMachineInstInPassToFragmentShader ( Axiom.Core.IntList PassMachineInstructions ) : bool
PassMachineInstructions Axiom.Core.IntList
Результат bool
		bool BindMachineInstInPassToFragmentShader( IntList PassMachineInstructions )
		{
			int instIDX = 0;
			int instCount = PassMachineInstructions.Count;
			bool error = false;

			while ( ( instIDX < instCount ) && !error )
			{
				switch ( (MachineInstruction)PassMachineInstructions[ instIDX ] )
				{
					case MachineInstruction.ColorOp1:
						if ( ( instIDX + 7 ) < instCount )
							Gl.glColorFragmentOp1ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ], // dst
								(int)PassMachineInstructions[ instIDX + 3 ], // dstMask
								(int)PassMachineInstructions[ instIDX + 4 ], // dstMod
								(int)PassMachineInstructions[ instIDX + 5 ], // arg1
								(int)PassMachineInstructions[ instIDX + 6 ], // arg1Rep
								(int)PassMachineInstructions[ instIDX + 7 ] );// arg1Mod
						instIDX += 8;
						break;

					case MachineInstruction.ColorOp2:
						if ( ( instIDX + 10 ) < instCount )
							Gl.glColorFragmentOp2ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ], // dst
								(int)PassMachineInstructions[ instIDX + 3 ], // dstMask
								(int)PassMachineInstructions[ instIDX + 4 ], // dstMod
								(int)PassMachineInstructions[ instIDX + 5 ], // arg1
								(int)PassMachineInstructions[ instIDX + 6 ], // arg1Rep
								(int)PassMachineInstructions[ instIDX + 7 ], // arg1Mod
								(int)PassMachineInstructions[ instIDX + 8 ], // arg2
								(int)PassMachineInstructions[ instIDX + 9 ], // arg2Rep
								(int)PassMachineInstructions[ instIDX + 10 ] );// arg2Mod
						instIDX += 11;
						break;

					case MachineInstruction.ColorOp3:
						if ( ( instIDX + 13 ) < instCount )
							Gl.glColorFragmentOp3ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ],  // dst
								(int)PassMachineInstructions[ instIDX + 3 ],  // dstMask
								(int)PassMachineInstructions[ instIDX + 4 ],  // dstMod
								(int)PassMachineInstructions[ instIDX + 5 ],  // arg1
								(int)PassMachineInstructions[ instIDX + 6 ],  // arg1Rep
								(int)PassMachineInstructions[ instIDX + 7 ],  // arg1Mod
								(int)PassMachineInstructions[ instIDX + 8 ],  // arg2
								(int)PassMachineInstructions[ instIDX + 9 ],  // arg2Rep
								(int)PassMachineInstructions[ instIDX + 10 ], // arg2Mod
								(int)PassMachineInstructions[ instIDX + 11 ], // arg2
								(int)PassMachineInstructions[ instIDX + 12 ], // arg2Rep
								(int)PassMachineInstructions[ instIDX + 13 ] );// arg2Mod
						instIDX += 14;
						break;

					case MachineInstruction.AlphaOp1:
						if ( ( instIDX + 6 ) < instCount )
							Gl.glAlphaFragmentOp1ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ],   // dst
								(int)PassMachineInstructions[ instIDX + 3 ],   // dstMod
								(int)PassMachineInstructions[ instIDX + 4 ],   // arg1
								(int)PassMachineInstructions[ instIDX + 5 ],   // arg1Rep
								(int)PassMachineInstructions[ instIDX + 6 ] );  // arg1Mod
						instIDX += 7;
						break;

					case MachineInstruction.AlphaOp2:
						if ( ( instIDX + 9 ) < instCount )
							Gl.glAlphaFragmentOp2ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ],   // dst
								(int)PassMachineInstructions[ instIDX + 3 ],   // dstMod
								(int)PassMachineInstructions[ instIDX + 4 ],   // arg1
								(int)PassMachineInstructions[ instIDX + 5 ],   // arg1Rep
								(int)PassMachineInstructions[ instIDX + 6 ],   // arg1Mod
								(int)PassMachineInstructions[ instIDX + 7 ],   // arg2
								(int)PassMachineInstructions[ instIDX + 8 ],   // arg2Rep
								(int)PassMachineInstructions[ instIDX + 9 ] );  // arg2Mod
						instIDX += 10;
						break;

					case MachineInstruction.AlphaOp3:
						if ( ( instIDX + 12 ) < instCount )
							Gl.glAlphaFragmentOp3ATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // op
								(int)PassMachineInstructions[ instIDX + 2 ],   // dst
								(int)PassMachineInstructions[ instIDX + 3 ],   // dstMod
								(int)PassMachineInstructions[ instIDX + 4 ],   // arg1
								(int)PassMachineInstructions[ instIDX + 5 ],   // arg1Rep
								(int)PassMachineInstructions[ instIDX + 6 ],   // arg1Mod
								(int)PassMachineInstructions[ instIDX + 7 ],   // arg2
								(int)PassMachineInstructions[ instIDX + 8 ],   // arg2Rep
								(int)PassMachineInstructions[ instIDX + 9 ],   // arg2Mod
								(int)PassMachineInstructions[ instIDX + 10 ],  // arg2
								(int)PassMachineInstructions[ instIDX + 11 ],  // arg2Rep
								(int)PassMachineInstructions[ instIDX + 12 ] ); // arg2Mod
						instIDX += 13;
						break;

					case MachineInstruction.SetConstants:

						if ( ( instIDX + 2 ) < instCount )
						{
							int start = (int)PassMachineInstructions[ instIDX + 2 ];
							float[] vals = new float[ 4 ];
							vals[ 0 ] = (float)constants[ start++ ];
							vals[ 1 ] = (float)constants[ start++ ];
							vals[ 2 ] = (float)constants[ start++ ];
							vals[ 3 ] = (float)constants[ start ];

							Gl.glSetFragmentShaderConstantATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // dst
								vals );
						}
						instIDX += 3;
						break;

					case MachineInstruction.PassTexCoord:
						if ( ( instIDX + 3 ) < instCount )
							Gl.glPassTexCoordATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // dst
								(int)PassMachineInstructions[ instIDX + 2 ], // coord
								(int)PassMachineInstructions[ instIDX + 3 ] ); // swizzle
						instIDX += 4;
						break;

					case MachineInstruction.SampleMap:
						if ( ( instIDX + 3 ) < instCount )
							Gl.glSampleMapATI(
								(int)PassMachineInstructions[ instIDX + 1 ], // dst
								(int)PassMachineInstructions[ instIDX + 2 ], // interp
								(int)PassMachineInstructions[ instIDX + 3 ] ); // swizzle
						instIDX += 4;
						break;

					default:
						instIDX = instCount;
						break;
					// should generate an error since an unknown instruction was found
					// instead for now the bind process is terminated and the fragment program may still function
					// but its output may not be what was programmed

				} // end of switch

				error = ( Gl.glGetError() != Gl.GL_NO_ERROR );
			}// end of while

			return !error;
		}