Ejemplo n.º 1
0
 public static CompiledShader AssembleFromFile(Stream shaderSourceCode, int numberBytes,
     CompilerMacro[] preprocessorDefines, CompilerIncludeHandler includeHandler, CompilerOptions options, TargetPlatform platform)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 2
0
 public static CompiledShader CompileFromSource(string shaderSourceCode, CompilerMacro[] preprocessorDefines,
     CompilerIncludeHandler includeHandler, CompilerOptions options, string functionName, ShaderProfile profile, TargetPlatform platform)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 3
0
 public static CompiledShader AssembleFromFile(string shaderFileName, CompilerMacro[] preprocessorDefines,
     CompilerIncludeHandler includeHandler, CompilerOptions options, TargetPlatform platform)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 void TryRoundTrip(string sourcePrefix, string compilerSource, byte[] expectedBytes) {
   var shaderSourceCode = sourcePrefix + compilerSource;
   var preprocessorDefines = new CompilerMacro[2];
   preprocessorDefines[0].Name = "XBOX";
   preprocessorDefines[0].Name = "XBOX360";
   var includeHandler = new NopIncludeHandler();
   var options = CompilerOptions.None;
   var compiledShader = ShaderCompiler.AssembleFromSource(
       shaderSourceCode, preprocessorDefines, includeHandler, options,
       Microsoft.Xna.Framework.TargetPlatform.Xbox360);
   var compiledBytes = compiledShader.GetShaderCode();
   if (compiledBytes == null ||
       compiledBytes.Length != expectedBytes.Length ||
       !MemCmp(compiledBytes, expectedBytes)) {
     compilerUcodeTextBox.BackColor = System.Drawing.Color.Red;
   } else {
     compilerUcodeTextBox.BackColor = System.Drawing.SystemColors.Control;
   }
 }
Ejemplo n.º 5
0
    void Process(string shaderSourceCode) {
      shaderSourceCode += "\ncnop";
      shaderSourceCode += "\ncnop";
      var preprocessorDefines = new CompilerMacro[2];
      preprocessorDefines[0].Name = "XBOX";
      preprocessorDefines[0].Name = "XBOX360";
      var includeHandler = new NopIncludeHandler();
      var options = CompilerOptions.None;
      var compiledShader = ShaderCompiler.AssembleFromSource(
          shaderSourceCode, preprocessorDefines, includeHandler, options,
          Microsoft.Xna.Framework.TargetPlatform.Xbox360);

      var disassembledSourceCode = compiledShader.ErrorsAndWarnings;
      disassembledSourceCode = disassembledSourceCode.Replace("\n", Environment.NewLine);
      if (disassembledSourceCode.IndexOf("// PDB hint 00000000-00000000-00000000") == -1) {
        UpdateTextBox(outputTextBox, disassembledSourceCode, false);
        UpdateTextBox(compilerUcodeTextBox, "", false);
        UpdateTextBox(wordsTextBox, "", false);
        return;
      }
      var prefix = disassembledSourceCode.Substring(
          0, disassembledSourceCode.IndexOf(
                 ':', disassembledSourceCode.IndexOf(':') + 1));
      disassembledSourceCode =
          disassembledSourceCode.Replace(prefix + ": ", "");
      disassembledSourceCode = disassembledSourceCode.Replace(
          "// PDB hint 00000000-00000000-00000000" + Environment.NewLine, "");
      var firstLine = disassembledSourceCode.IndexOf("//");
      var warnings = "// " +
                     disassembledSourceCode.Substring(0, firstLine)
                         .Replace(Environment.NewLine, Environment.NewLine + "// ");
      disassembledSourceCode =
          warnings + disassembledSourceCode.Substring(firstLine + 3);
      disassembledSourceCode = disassembledSourceCode.Trim();
      UpdateTextBox(outputTextBox, disassembledSourceCode, true);

      string shaderType =
          shaderSourceCode.IndexOf("xvs_") == -1 ? "ps" : "vs";
      var ucodeWords = ExtractAndDumpWords(shaderType, compiledShader.GetShaderCode());
      if (ucodeWords != null) {
        TryCompiler(shaderType, ucodeWords);
      } else {
        UpdateTextBox(compilerUcodeTextBox, "", false);
      }

      if (compilerUcodeTextBox.Text.Length > 0) {
        var sourcePrefix = disassembledSourceCode.Substring(0, disassembledSourceCode.IndexOf("/*"));
        TryRoundTrip(sourcePrefix, compilerUcodeTextBox.Text, compiledShader.GetShaderCode());
      }
    }
Ejemplo n.º 6
0
 public static CompiledEffect CompileEffectFromSource(string effectFileSource, CompilerMacro[] preprocessorDefines, CompilerIncludeHandler includeHandler, CompilerOptions options, TargetPlatform platform) { throw new NotImplementedException(); }
Ejemplo n.º 7
0
 public static CompiledEffect CompileEffectFromFile(Stream effectFileStream, int numberBytes, CompilerMacro[] preprocessorDefines, CompilerIncludeHandler includeHandler, CompilerOptions options, TargetPlatform platform) { throw new NotImplementedException(); }