Created
May 16, 2019 14:10
-
-
Save iondune/d49287c2973c596d0f9b996bc38f09f3 to your computer and use it in GitHub Desktop.
Short HLSL shader that causes an internal compiler error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int solve(float x) | |
{ | |
if (x < 0) | |
{ | |
return 0; | |
} | |
// 1>MinRepo.hlsl(7,2): warning X4000: use of potentially uninitialized variable (solve) | |
// 1>error X8000 : D3D11 Internal Compiler error : Invalid Bytecode: Negate modifier not allowed for operand #4 of opcode #6 (counts are 1-based). | |
return 1; | |
} | |
int problem(float a) | |
{ | |
int num = 0; | |
float b = (a < 0.0 ? -a : a); | |
num += solve(b); | |
b = (a < 0.0 ? a : -a); | |
num += solve(b); | |
return num; | |
} | |
float3 pixel(float value : TEXCOORD0) : SV_Target0 | |
{ | |
float3 output = float3(0.0, 0.0, 0.0); | |
int count = problem(value); | |
if (count > 0) | |
{ | |
output = float3(1, 0, 1); | |
} | |
else | |
{ | |
output = float3(0, 0, 0); | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment