简体   繁体   中英

While compiling on VS2012 using HLSL: float4 is undefined

I've just started to learn some basics of DirectX and 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. 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. What am I missing here?

I don't think Intellisense on VS2012 has support for HLSL keywords; you're fine just ignoring the fact that it can't resolve float4 . See also: VS2010 - HLSL Intellisense? (some answers do mention VS2012).

C++ compilers do not compile HLSL. HLSL is supposed to be used in the form of resources, and then supposed to be loaded at runtime. One canot simply create a .cpp file and expect HLSL code to compile as C++.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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