private void RebuildCommands() { PICACommandWriter Writer = new PICACommandWriter(); PICARegister Register = PICARegister.GPUREG_DUMMY; switch (StageIndex) { case 0: Register = PICARegister.GPUREG_TEXENV0_SOURCE; break; case 1: Register = PICARegister.GPUREG_TEXENV1_SOURCE; break; case 2: Register = PICARegister.GPUREG_TEXENV2_SOURCE; break; case 3: Register = PICARegister.GPUREG_TEXENV3_SOURCE; break; case 4: Register = PICARegister.GPUREG_TEXENV4_SOURCE; break; case 5: Register = PICARegister.GPUREG_TEXENV5_SOURCE; break; } Writer.SetCommand(Register, true, Stage.Source.ToUInt32(), Stage.Operand.ToUInt32(), Stage.Combiner.ToUInt32(), Stage.Color.ToUInt32(), Stage.Scale.ToUInt32()); Commands = Writer.GetBuffer(); }
bool ICustomSerialization.Serialize(BinarySerializer Serializer) { PICARegister[] Cmd0 = new PICARegister[] { PICARegister.GPUREG_TEXUNIT0_TYPE, PICARegister.GPUREG_TEXUNIT1_TYPE, PICARegister.GPUREG_TEXUNIT2_TYPE }; PICARegister[] Cmd1 = new PICARegister[] { PICARegister.GPUREG_TEXUNIT0_BORDER_COLOR, PICARegister.GPUREG_TEXUNIT1_BORDER_COLOR, PICARegister.GPUREG_TEXUNIT2_BORDER_COLOR }; PICACommandWriter Writer = new PICACommandWriter(); uint Filter; Filter = ((uint)MagFilter & 1) << 1; Filter |= ((uint)MinFilter & 1) << 2; Filter |= ((uint)MipFilter & 1) << 24; Filter |= ((uint)WrapV & 7) << 8; Filter |= ((uint)WrapU & 7) << 12; uint LOD; LOD = (uint)((int)(LODBias * 0x100) & 0x1fff); LOD |= ((uint)MinLOD & 0xf) << 24; Writer.SetCommand(Cmd0[MapperIndex], 0, 1); Writer.SetCommand(Cmd1[MapperIndex], true, BorderColor.ToUInt32(), 0, Filter, LOD, 0, 0, 0, 0, 0, 0); Commands = Writer.GetBuffer(); CommandsLength = Commands.Length * 4; //TODO: Don't assume it uses the Standard sampler, could be the Shadow sampler too GfxTextureSamplerStd Samp = (GfxTextureSamplerStd)Sampler; Samp.LODBias = LODBias; Samp.BorderColor = BorderColor.ToVector4(); Samp.MinFilter = GetMinFilter(); return(false); }
public void SetCommand(PICARegister Register, params bool[] Params) { uint Param = 0; for (int Bit = 0; Bit < Params.Length; Bit++) { if (Params[Bit]) { Param |= (1u << Bit); } } SetCommand(Register, Param, 1); }
public void SetCommands(PICARegister Register, bool Consecutive, uint Mask, params uint[] Params) { Commands.Add(Params[0]); uint ExtraParams = (((uint)Params.Length - 1) & 0x7ff) << 20; uint ConsecutiveBit = Consecutive ? (1u << 31) : 0; Commands.Add((uint)Register | (Mask << 16) | ExtraParams | ConsecutiveBit); for (int Index = 1; Index < Params.Length; Index++) { Commands.Add(Params[Index]); } Align(); }
public void SetCommand(PICARegister Register, bool Param, uint Mask = 0xf) { Commands.Add(Param ? 1u : 0u); Commands.Add((uint)Register | (Mask << 16)); }
public void SetCommand(PICARegister Register, float Param, uint Mask = 0xf) { Commands.Add(Param); Commands.Add((uint)Register | (Mask << 16)); }
public void SetCommand(PICARegister Register, bool Consecutive, params float[] Params) { SetCommands(Register, Consecutive, 0xf, Params); }