【发布时间】:2019-09-23 12:26:53
【问题描述】:
在编译这个简单的像素着色器时:
Texture2D tex0 : register(t0);
Texture2D tex1 : register(t1);
SamplerState s : register(s0);
float4 main(float2 tc : TEXCOORD0) : SV_TARGET
{
Texture2D tex = tex0;
if (tc.x > 0.5)
{
tex = tex1;
}
return tex.SampleLevel(s, tc, 0);
}
使用命令行fxc.exe /T ps_4_0 hello.hlsl我得到:
Microsoft (R) Direct3D Shader Compiler 10.1 (using C:\Windows Kits\10\bin\10.0.17763.0\x86\D3DCOMPILER_47.dll)
Copyright (C) 2013 Microsoft. All rights reserved.
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Invalid operand type for operand #3 of opcode #8 (counts are 1-based).
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Can't continue validation - aborting.
我做错了什么?
【问题讨论】: