简体   繁体   English

使用HLSL在VS2012上编译时:float4未定义

[英]While compiling on VS2012 using HLSL: float4 is undefined

I've just started to learn some basics of DirectX and hlsl. 我刚刚开始学习DirectX和hlsl的一些基础知识。 I'm following the examples from a book. 我正在遵循一本书中的示例。 I have a problem with the following basic shader: 我的以下基本着色器有问题:

float4 VS_Main( float4 pos:POSITION):SV_POSITION
{
return pos;
}

Intelligence says that float4 is an undefined identifier. 情报说float4是未定义的标识符。 As far as I know, this should be a standard type used in HLSL for defining a 4-dimensional vector, but I can't get enough informations on it and the book doesn't help either. 据我所知,这应该是HLSL中用于定义4维向量的标准类型,但是我无法获得足够的信息,这本书也无济于事。 What am I missing here? 我在这里想念什么?

I don't think Intellisense on VS2012 has support for HLSL keywords; 我认为VS2012上的Intellisense不支持HLSL关键字。 you're fine just ignoring the fact that it can't resolve float4 . 您可以忽略它无法解决float4的事实,这很好。 See also: VS2010 - HLSL Intellisense? 另请参阅: VS2010-HLSL Intellisense? (some answers do mention VS2012). (一些答案确实提到了VS2012)。

C++ compilers do not compile HLSL. C ++编译器不编译HLSL。 HLSL is supposed to be used in the form of resources, and then supposed to be loaded at runtime. HLSL应该以资源的形式使用,然后应该在运行时加载。 One canot simply create a .cpp file and expect HLSL code to compile as C++. 一个人可以简单地创建一个.cpp文件,并期望HLSL代码可以编译为C ++。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM