Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualCirno

Posted 26 April 2012 - 05:23 AM

Hi!

The code compiles just fine, but I think in practice it won’t help you much. You need a vertex shader. Otherwise the rasterizer has no idea, where to invoke the pixel shader. In case you want the pixel shader to be invoked for every pixel, you have to render a quad covering the whole viewport. For this you can pass in the vertices of the quad in post-clipping space ([-1,-1]..[1,1]) and let the vertex shader directly output them unchanged.

Cheers!


Thanks very much~
but actually a vertex shader can be left out..i wrote a pass without a vertex shader before and it works well..
A friend told me that maybe the compiling error is  caused by a structure(or an array?)..
typedef struct ScreenL
{
	float4 Pixels[SCREEN_SIZE.x];
}ScreenLine;
typedef struct ScreenD
{
	ScreenLine Lines[SCREEN_SIZE.y];
}ScreenData;
(#define SCREEN_SIZE int2(800, 480))

i thought the structure has nothing to do with the compiling..but he changed the 'SCREEN_SIZE' and the error disappeared..
why the structure caused the compiling error..it seems that the structure has nothing to do with compiling?

i want to write a GPU particle system, and need a structure to save the data of the texture consisting of all particles.So what type of structure should i use?

#1Cirno

Posted 26 April 2012 - 04:20 AM

Hi!

The code compiles just fine, but I think in practice it won’t help you much. You need a vertex shader. Otherwise the rasterizer has no idea, where to invoke the pixel shader. In case you want the pixel shader to be invoked for every pixel, you have to render a quad covering the whole viewport. For this you can pass in the vertices of the quad in post-clipping space ([-1,-1]..[1,1]) and let the vertex shader directly output them unchanged.

Cheers!


Thanks very much~
but actually a vertex shader can be left out..i wrote a pass without a vertex shader before and it works well..
A friend told me that maybe the compiling error is  caused by a structure(or an array?)..
typedef struct ScreenL
{
    float4 Pixels[SCREEN_SIZE.x];
}ScreenLine;
typedef struct ScreenD
{
    ScreenLine Lines[SCREEN_SIZE.y];
}ScreenData;
(#define SCREEN_SIZE int2(800, 480))

i thought the structure has nothing to do with the compiling..but he changed the 'SCREEN_SIZE' and the error disappeared..
i really cannot understand why the structure caused the compiling error..

PARTNERS