0
votes

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?

2

2 Answers

0
votes

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).

0
votes

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++.