Skip to content

Commit

Permalink
[Shader Playground] Make PC shader models work at least with invalid …
Browse files Browse the repository at this point in the history
…shaders
  • Loading branch information
Triang3l committed Apr 18, 2020
1 parent b8ec553 commit 5820893
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/shader-playground/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ public override Stream Open(CompilerIncludeHandlerType includeType,
}

void Process(string shaderSourceCode) {
shaderSourceCode += "\ncnop";
shaderSourceCode += "\ncnop";
if (shaderSourceCode.IndexOf("xvs_3_0") != -1 || shaderSourceCode.IndexOf("xps_3_0") != -1) {
shaderSourceCode += "\ncnop";
shaderSourceCode += "\ncnop";
}
var preprocessorDefines = new CompilerMacro[2];
preprocessorDefines[0].Name = "XBOX";
preprocessorDefines[1].Name = "XBOX360";
Expand Down Expand Up @@ -170,7 +172,7 @@ void Process(string shaderSourceCode) {
UpdateTextBox(outputTextBox, disassembledSourceCode, true);

string shaderType =
shaderSourceCode.IndexOf("xvs_") == -1 ? "ps" : "vs";
shaderSourceCode.IndexOf("vs_") == -1 ? "ps" : "vs";
var ucodeWords = ExtractAndDumpWords(shaderType, compiledShader.GetShaderCode());
if (ucodeWords != null) {
TryCompiler(shaderType, ucodeWords);
Expand Down

0 comments on commit 5820893

Please sign in to comment.