mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Format RenderApi code
This commit is contained in:
@@ -8,49 +8,49 @@ using Microsoft.Iris.Library;
|
||||
|
||||
namespace Microsoft.Iris.Render.Graphics
|
||||
{
|
||||
internal class Dx9DestinationElement
|
||||
{
|
||||
internal static void Generate(
|
||||
DestinationElement efiDestination,
|
||||
ref Dx9EffectBuilder effectBuilder)
|
||||
internal class Dx9DestinationElement
|
||||
{
|
||||
Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture();
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.SampleBackbuffer, (object) (int) efiDestination.DownsampleID);
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.DisablePerspectiveCorrection, (object) null);
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object) null);
|
||||
TextureVariableInfo textureVariableInfo = new TextureVariableInfo();
|
||||
textureVariableInfo.ID = (int) efiDestination.DestinationID;
|
||||
textureVariableInfo.Type = Dx9VariableType.Texture;
|
||||
textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiDestination.Name);
|
||||
textureVariableInfo.DefaultValue = (object) null;
|
||||
textureVariableInfo.SamplerName = textureInfo.Sampler;
|
||||
textureVariableInfo.MinFilter = "Linear";
|
||||
textureVariableInfo.MagFilter = "Linear";
|
||||
textureVariableInfo.CoordinateMapID = -1;
|
||||
textureVariableInfo.ImageIndexID = -1;
|
||||
effectBuilder.AddPropertyVariable((VariableInfo) textureVariableInfo);
|
||||
effectBuilder.AddPropertyVariable(new VariableInfo()
|
||||
{
|
||||
ID = (int) efiDestination.DownsampleID,
|
||||
Type = Dx9VariableType.Float,
|
||||
IsDynamic = efiDestination.IsDynamicProperty("Downsample"),
|
||||
Name = (string) null,
|
||||
DefaultValue = (object) efiDestination.Downsample
|
||||
});
|
||||
VariableInfo variableInfo = new VariableInfo()
|
||||
{
|
||||
ID = (int) efiDestination.UVOffsetID,
|
||||
Type = Dx9VariableType.Vector2,
|
||||
IsDynamic = efiDestination.IsDynamicProperty("UVOffset")
|
||||
};
|
||||
variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset");
|
||||
variableInfo.DefaultValue = (object) efiDestination.UVOffset;
|
||||
effectBuilder.AddPropertyVariable(variableInfo);
|
||||
effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Texture, efiDestination.Name);
|
||||
if (variableInfo.IsDynamic || !efiDestination.UVOffset.IsApproximate(Vector2.Zero))
|
||||
effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput, (object) textureInfo.TexelSize, (object) variableInfo.Name));
|
||||
else
|
||||
effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object) effectBuilder.PixelShaderOutput, (object) textureInfo.Sampler, (object) textureInfo.TexCoordInput));
|
||||
internal static void Generate(
|
||||
DestinationElement efiDestination,
|
||||
ref Dx9EffectBuilder effectBuilder)
|
||||
{
|
||||
Dx9TextureInfo textureInfo = effectBuilder.AllocateTexture();
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.SampleBackbuffer, (object)(int)efiDestination.DownsampleID);
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.DisablePerspectiveCorrection, (object)null);
|
||||
effectBuilder.AddRequirement(textureInfo, Dx9TextureRequirements.TexelSize, (object)null);
|
||||
TextureVariableInfo textureVariableInfo = new TextureVariableInfo();
|
||||
textureVariableInfo.ID = (int)efiDestination.DestinationID;
|
||||
textureVariableInfo.Type = Dx9VariableType.Texture;
|
||||
textureVariableInfo.Name = effectBuilder.GenerateGlobalVariable(textureVariableInfo.Type, efiDestination.Name);
|
||||
textureVariableInfo.DefaultValue = (object)null;
|
||||
textureVariableInfo.SamplerName = textureInfo.Sampler;
|
||||
textureVariableInfo.MinFilter = "Linear";
|
||||
textureVariableInfo.MagFilter = "Linear";
|
||||
textureVariableInfo.CoordinateMapID = -1;
|
||||
textureVariableInfo.ImageIndexID = -1;
|
||||
effectBuilder.AddPropertyVariable((VariableInfo)textureVariableInfo);
|
||||
effectBuilder.AddPropertyVariable(new VariableInfo()
|
||||
{
|
||||
ID = (int)efiDestination.DownsampleID,
|
||||
Type = Dx9VariableType.Float,
|
||||
IsDynamic = efiDestination.IsDynamicProperty("Downsample"),
|
||||
Name = (string)null,
|
||||
DefaultValue = (object)efiDestination.Downsample
|
||||
});
|
||||
VariableInfo variableInfo = new VariableInfo()
|
||||
{
|
||||
ID = (int)efiDestination.UVOffsetID,
|
||||
Type = Dx9VariableType.Vector2,
|
||||
IsDynamic = efiDestination.IsDynamicProperty("UVOffset")
|
||||
};
|
||||
variableInfo.Name = variableInfo.IsDynamic ? effectBuilder.GenerateGlobalVariable(variableInfo.Type, "UVOffset") : effectBuilder.GenerateGlobalConstant(variableInfo.Type, "UVOffset");
|
||||
variableInfo.DefaultValue = (object)efiDestination.UVOffset;
|
||||
effectBuilder.AddPropertyVariable(variableInfo);
|
||||
effectBuilder.PixelShaderOutput = effectBuilder.GenerateLocalVariable(Dx9VariableType.Texture, efiDestination.Name);
|
||||
if (variableInfo.IsDynamic || !efiDestination.UVOffset.IsApproximate(Vector2.Zero))
|
||||
effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2} + float2({3}.x * {4}.x, {3}.y * {4}.y));\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput, (object)textureInfo.TexelSize, (object)variableInfo.Name));
|
||||
else
|
||||
effectBuilder.EmitPixelFragment(InvariantString.Format(" // Load the image\r\n float4 {0} = tex2D({1}, {2});\r\n\r\n", (object)effectBuilder.PixelShaderOutput, (object)textureInfo.Sampler, (object)textureInfo.TexCoordInput));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user