0

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?

Smi
  • 13,850
  • 9
  • 56
  • 64

2 Answers2

0

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

Community
  • 1
  • 1
sheu
  • 5,653
  • 17
  • 32
  • thanks for your fast answer, i dont know if it's related but when i compile the code i get a lot of errors on it, like C2146: sintax error: ';' missing before identifier 'VS_Main', and other errors of this kind. It looks it doesnt recognize the sintax at all. Might it be because im using VS2012 Express? – Simone Previti Feb 02 '13 at 14:41
  • i found something http://stackoverflow.com/questions/12408610/limitations-of-visual-studio-2012-express-desktop, it says that Express doesnt support HLSL editing and debugging.. – Simone Previti Feb 02 '13 at 15:01
  • @SimonePreviti: as to compilation errors -- it sounds like Visual Studio is trying to compile the shader as a C or C++ source file, when it should be using the shader compiler instead. See: http://msdn.microsoft.com/en-US/library/windows/desktop/bb509633 – sheu Feb 02 '13 at 19:46
0

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

antonijn
  • 5,702
  • 2
  • 26
  • 33