static void TestSharedVertexBlack(VertexType vertexType, ShaderStage stage) { var gen = new ShaderBlackGenerator(); var bytecode = gen.GenerateSharedVertexShader(vertexType, stage).Bytecode; WriteShaderFile($"generated_shader_black_{stage.ToString().ToLower()}_{vertexType.ToString().ToLower()}.glvs", D3DCompiler.Disassemble(bytecode)); }
public static void DrawDiagonal() { sortedList = Points.OrderByDescending(v => v.y).ToList(); MaxIndex = Points.IndexOf(sortedList.Last()); MinIndex = Points.IndexOf(sortedList.First()); int MostLeftPointIndex = Points.IndexOf(Points.OrderBy(v => v.x).First()); LeftChain = ((MinIndex < MostLeftPointIndex && MostLeftPointIndex < MaxIndex) || (MaxIndex < MostLeftPointIndex && MostLeftPointIndex < MinIndex)); for (int i = 0; i < sortedList.Count; i++) { int TargetIndex = Points.IndexOf(sortedList[i]); Vector3 o = sortedList[i]; Vector3 a = GetListElementWithLoop(Points, TargetIndex - 1); Vector3 b = GetListElementWithLoop(Points, TargetIndex + 1); VertexType t = GetVertexType(a, o, b); Debug.Log("Target Vertex : " + TargetIndex + t.ToString() + ", o : " + o + ", a : " + a + ", b : " + b); switch (t) { case VertexType.StartVertex: HandleStartVertex(TargetIndex); break; case VertexType.SplitVertex: HandleSplitVertex(TargetIndex); break; case VertexType.MergeVertex: HandleMergeVertex(TargetIndex); break; case VertexType.RegularVertex: HandleRegularVertex(TargetIndex); break; case VertexType.EndVertex: HandleEndVertex(TargetIndex); break; } } }
public static string GetTestSharedVertexShader(VertexType vertex, ShaderStage stage) { var vertexShaderPath = Path.Combine(ReferencePath, $"{ShaderType}_shared_vertex_shaders.glvs"); vertexShaderPath = Path.Combine(vertexShaderPath, $"{vertex.ToString().ToLower()}"); vertexShaderPath = Path.Combine(vertexShaderPath, $"{stage.ToString().ToLower()}.shared_vertex_shader"); return(vertexShaderPath); }
static void TestSharedVertexShader(ShaderType shaderType, VertexType vertexType, ShaderStage stage) { IShaderGenerator generator = GetShaderGenerator(shaderType); if (generator.IsEntryPointSupported(stage) && generator.IsVertexShaderShared(stage) && generator.IsVertexFormatSupported(vertexType)) { var bytecode = generator.GenerateSharedVertexShader(vertexType, stage).Bytecode; var disassembly = D3DCompiler.Disassemble(bytecode); WriteShaderFile($"generated_{stage.ToString().ToLower()}_{vertexType.ToString().ToLower()}.glvs", disassembly); } }
public static D3D.SHADER_MACRO CreateVertexMacro(string name, VertexType type) { return(new D3D.SHADER_MACRO { Name = name, Definition = $"{type.ToString().ToUpper()}_VERTEX" }); }
public override void LoadModel() { base.LoadModel(); mainModel.name = type.ToString() + "_" + Id; SetPosition(); }
public static void DisplayVertexShaderTestResults(bool success, VertexType vertex, ShaderStage stage, bool usesD3DX) { if (IgnoreD3DX && usesD3DX) { return; } if (!success) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Generated shader for {stage.ToString().ToLower()} vertex format {vertex.ToString().ToLower()} is not identical to reference." + (usesD3DX ? " USES D3DX." : "")); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Generated shader for {stage.ToString().ToLower()} vertex format {vertex.ToString().ToLower()} is identical to reference."); Console.ResetColor(); } }