Question about shader optimization (rendertarget to 1x1 texture for data)

More
1 week 6 days ago - 1 week 6 days ago #1 by Daemonjax
So, I was reading this old thread:  https://reshade.me/forum/shader-presentation/230-ported-storybook-shader
... where crosire was describing a method to have a pixel shader pass run once per frame instead of once per pixel per frame :

Warning: Spoiler!


My questions: 

Is this simply because the rendertarget is 1x1 pixel (which would explain why multiple rendertargets require the pixel dimensions to be the same)?  So if we ONLY changed the texture to be 8x8 pixels, the shader would then run 64 times per frame (setting each pixel in the rendertarget to the same value)?  So I guess there's always a rendertarget even when it's not explicit in the technique declaration, and the default rendertarget is what exactly?  The next color buffer?

I'm always really paranoid on relying on compiller optimizations I don't fully understand.  I could imagine it being dumb and just run 1920*1080 times per frame, setting the same exact pixel in the 1x1 rendertarget to the same value and I'd be none the wiser.  Are there any gotchas to this approach?  

 
Last edit: 1 week 6 days ago by Daemonjax.

Please Log in or Create an account to join the conversation.

More
1 week 4 days ago #2 by Daemonjax
Or would I still need to include a

if (texcoord.x != 0.5 && texcoord.y != 0.5) discard;

?

 

Please Log in or Create an account to join the conversation.