Jump to content

  • Log In with Google      Sign In   
  • Create Account

Questions about Intel Sample


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 06 October 2012 - 10:20 AM

http://software.intel.com/en-us/articles/deferred-rendering-for-current-and-future-rendering-pipelines/ I'm learning about deferred rendering from this sample.What do you think about the method used for the lighting?I'm still having some confusion about how the compute shader works in the sample.What does this part mean:

#define MAX_LIGHTS_POWER 10
#define MAX_LIGHTS (1<<MAX_LIGHTS_POWER)

In the sample exe,the max light number is 1024.How do you get 1024 from 1<<10?What does << do?

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.

Sponsor:

#2 zacaj   Members   -  Reputation: 643

Like
1Likes
Like

Posted 06 October 2012 - 10:37 AM

The << is a bitshift. It shifts the number (1 in this case) left ten bits, which is the equivilant of multiplying 1 by 2^10. 2^10=1024, 1024*1=1024

#3 mhagain   Crossbones+   -  Reputation: 8275

Like
1Likes
Like

Posted 06 October 2012 - 10:58 AM

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.


If you look at what's being returned you'll see that it's returning 3 colours - one in SV_Target0, one in SV_Target1 and one in SV_Target2. That means that it has 3 rendertargets bound to the pipeline, and each rendertarget gets it's own colour from the pixel shader. That's just a classic multiple rendertargets approach, nothing special.

Pixels shaders can also return depth by the way; see http://msdn.microsoft.com/en-us/library/windows/desktop/bb509647%28v=vs.85%29.aspx#System_Value

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 MJP   Moderators   -  Reputation: 11737

Like
1Likes
Like

Posted 06 October 2012 - 10:59 AM

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

Edited by MJP, 06 October 2012 - 11:00 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS