Skip to main content
GameDev.net gamedev.net
🔒 Locked

Render Target

Started by compiler Jan 27, 2006 at 1:17 PM 5 replies 1.2k views
Original Post
compiler
compiler
hello, referring to this pipeline poster Pipeline i wanted to ask WHEN does d3d actually write to the render target? i think d3d writes at the last stage to the render target and all stages before it just reads from the render target. but maybe im wrong and d3d already writes after the z-buffer test to the render target. maybe u guys know it:)
Namethatnobodyelsetook
Namethatnobodyelsetook
D3D writes to the rendertarget and/or depth buffer if it makes it all the way through the pipeline. Things than can prevent this are, Z depth tests, stencil tests, alphatests, texkill pixelshader instructions, or a COLORWRITEENABLE setting of 0. A card may do early Z rejection without doing pixel shading if the shader doesn't write to the depth output register.

The only time the backbuffer is read is when alphablending is enabled and DESTCOLOR or DESTALPHA is referred to in SRCBLEND or DESTBLEND.
compiler
compiler
i think you are not correct. im (almost) sure, that d3d also reads from the render target during the depth/stencil test (besides the mentioned alphablending readings).

in this
pipeline poster u can see some arrows going FROM the render target to the two tests, but no arrow is GOING to the render target.
so i still think the d3d just writes a single time to the render target: if a pixel is through ALL stages. i hope somebody can approve my assumption ;)
DrGUI
DrGUI
I had a look at that diagram...I think you're both right since it seems to be calling both the backbuffer and the depthstencil the render target. I mean, you wouldn't read colour in a depthstencil test would you [lol]
compiler
compiler
Quote:
Original post by DrGUI
I had a look at that diagram...I think you're both right since it seems to be calling both the backbuffer and the depthstencil the render target. I mean, you wouldn't read colour in a depthstencil test would you [lol]

i wouldnt read color but the information stored in a stencil buffer.
Namethatnobodyelsetook
Namethatnobodyelsetook
You're right that I was wrong, but not what I was wrong about. :) Backbuffer is read if SRCBLEND has DESTCOLOR or DESTALPHA, or DESTBLEND is not ZERO. It's one of the things that makes alpha blending slow. It needs to do a READ/MODIFY/WRITE instead of just WRITE.

Also, thinking about it a bit more, the GPU likely accesses more than 1 pixel at a time due to the size of cache lines. If a non blended triangle will affect all the pixels for a cache line, the read will likely be skipped (unless the engineers are quite bad, which I doubt). A read may occur if only some pixels on the cache line are affected, such at the edge of a triangle, or a hole caused by alphatest/stencil operations.
DrGUI
DrGUI
Quote:
Original post by compiler
Quote:
Original post by DrGUI
I had a look at that diagram...I think you're both right since it seems to be calling both the backbuffer and the depthstencil the render target. I mean, you wouldn't read colour in a depthstencil test would you [lol]

i wouldnt read color but the information stored in a stencil buffer.

yep, i was just clarifying the terminology.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.