Also the main function of the Pixel Shader(GBufferPS) returns a struct:
struct GBuffer { float4 normal_specular : SV_Target0; float4 albedo : SV_Target1; float2 positionZGrad : SV_Target2; };
Instead of a float4.How does the gpu even work with this?I mean a pixel shader can only return a color,right?Not a whole struct.
This features is called "multiple render targets" (MRT), and like the name suggests it allows the GPU to output to up to 8 render targets simultaneously. Honestly it's a pretty basic GPU/D3D feature, and if you're not familiar with such things yet I would stick to simpler material before looking at the Intel sample (which is quite advanced!).