• Advertisement
Sign in to follow this  

dx sdk tutorial "State Management" confusing

This topic is 3815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi below 2 commented para brings the same render results. It's confusing, since the results should never be the same. Thanks for suggestions.
	ID3D10BlendState* pStateBlend = NULL;
	D3D10_BLEND_DESC descBlend;
	ZeroMemory(&descBlend, sizeof(D3D10_BLEND_DESC));
	descBlend.BlendEnable[0] = TRUE;
	descBlend.SrcBlend = D3D10_BLEND_ONE; //D3D10_BLEND_SRC_COLOR ; the same
	descBlend.DestBlend = D3D10_BLEND_ONE; //D3D10_BLEND_DEST_COLOR ; the same
	descBlend.BlendOp = D3D10_BLEND_OP_MAX;
	descBlend.SrcBlendAlpha = D3D10_BLEND_SRC_ALPHA ;
	descBlend.DestBlendAlpha = D3D10_BLEND_DEST_ALPHA;
	descBlend.BlendOpAlpha = D3D10_BLEND_OP_MIN;
	descBlend.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL;
	V(g_pd3dDevice->CreateBlendState(&descBlend, &pStateBlend));
	float blendFactor[4] = {0, 0, 0, 0};
	UINT sampleMask = 0xffffffff;
	g_pd3dDevice->OMSetBlendState(pStateBlend, blendFactor, sampleMask);
about CreateBlendState()'s D3D10_BLEND_DESC descBlend: confusing. for anyone of descBlend's SrcBlend,DestBlend,SrcBlendAlpha,or DestBlendAlpha, take SrcBlend for example, the equation is said by SDK to be SrcColor*SrcBlend(BlendOp)DestColor*DestBlend where SrcBlend or DestBlend can be srcColor's or destColor's component, or 0, 1 const, or BlendFactor const(which is set outside in another function OMSetBlendState()). if i use the 2 commented paras, then results should not be max(ps output color, rendertarget's existing color), but rather be max(ps*ps, rt*rt). But i find actual result is still max(ps, rt), which is weird. btw, this tutorial sets State in shader, not in API; but the sdk never gives Shader State spec. [Edited by - yk_cadcg on October 10, 2007 10:03:23 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement