首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误X8000 : D3D11内部编译器错误:无效字节码:操作码#86的操作数#1的操作数类型无效(计数从1开始)

错误X8000 : D3D11内部编译器错误:无效字节码:操作码#86的操作数#1的操作数类型无效(计数从1开始)
EN

Stack Overflow用户
提问于 2014-10-24 08:15:05
回答 1查看 2.6K关注 0票数 8

我和我的讲师/实验室助理一样被难住了。

出于某种原因,下面的HLSL代码在输出窗口中返回以下内容:

代码语言:javascript
运行
复制
error X8000 : D3D11 Internal Compiler error : Invalid Bytecode: Invalid operand type for operand #1 of opcode #86 (counts are 1-based).

以下是HLSL中导致该问题的函数:

代码语言:javascript
运行
复制
// Projects a sphere diameter large in screen space to calculate desired tesselation factor
float SphereToScreenSpaceTessellation(float3 p0, float3 p1, float diameter)
{
float3 centerPoint = (p0 + p1) * 0.5f;

float4 point0 = mul( float4(centerPoint,1.0f) , gTileWorldView);

float4 point1 = point0;
point1.x += diameter;

float4 point0ClipSpace = mul(point0, gTileProj);
float4 point1ClipSpace = mul(point1, gTileProj);

point0ClipSpace /= point0ClipSpace.w;
point1ClipSpace /= point1ClipSpace.w;

point0ClipSpace.xy *= gScreenSize;
point1ClipSpace.xy *= gScreenSize;

float projSizeOfEdge = distance(point0ClipSpace, point1ClipSpace);

float result = projSizeOfEdge / gTessellatedTriWidth;

return clamp(result, 0, 64);
}

我已经将它的范围缩小到可能是"mul“内在的程度。我们已经从代码中提取了所有内容,并尝试像这样返回一个临时变量,它工作得很好:

代码语言:javascript
运行
复制
float SphereToScreenSpaceTessellation(float3 p0, float3 p1, float diameter)
{

float temp = 0;

float3 centerPoint = (p0 + p1) * 0.5f;

float4 point0 = mul( float4(centerPoint,1.0f) , gTileWorldView);

float4 point1 = point0;
point1.x += diameter;

float4 point0ClipSpace = mul(point0, gTileProj);
float4 point1ClipSpace = mul(point1, gTileProj);

point0ClipSpace /= point0ClipSpace.w;
point1ClipSpace /= point1ClipSpace.w;

point0ClipSpace.xy *= gScreenSize;
point1ClipSpace.xy *= gScreenSize;

float projSizeOfEdge = distance(point0ClipSpace, point1ClipSpace);

float result = projSizeOfEdge / gTessellatedTriWidth;

return temp;
//return clamp(result, 0, 64);
}

如果有人想知道:

代码语言:javascript
运行
复制
gTileWorldView, gTileProj are float4x4's in a .hlsli file
gScreenSize is a float2 in a .hlsli file.
gTessellatedTriWidth is a float in a .hlsli file.

以下函数是位于:http://dx11-xpr.googlecode.com/svn/trunk/XPR/Media/Effects/TerrainTessellation.fx的2011 NVidia着色器中的状态

我试图复制并粘贴他们的解决方案,用上面的变量替换他们的变量,但同样的错误也出现了。

我完全被难住了,我需要帮助才能完成这项任务,请帮帮忙。

EN

回答 1

Stack Overflow用户

发布于 2014-10-24 10:59:43

看看这一行:

point0ClipSpace.xy *= gScreenSize;

gScreenSize是float2吗?我不相信你可以将一个vec与任何vec类型进行标量相乘。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26539596

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档