Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Alpha blending fails unless Debug mode

4: Adsense

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
2 replies to this topic

#1 reaperrar   Members   

136
Like
0Likes
Like

Posted 13 March 2013 - 11:30 PM

SOLVED

 

Compiling with visual studio 2010...

 

If Compiling in DEBUG mode with D3D11_CREATE_DEVICE_DEBUG set for device creation, alpha blending works fine.

If Compiling in DEBUG mode with D3D11_CREATE_DEVICE_DEBUG NOT set for device creation, alpha blending works fine.

If Compiling in RELEASE mode with D3D11_CREATE_DEVICE_DEBUG set for device creation, alpha blending works fine.

If Compiling in RELEASE mode with D3D11_CREATE_DEVICE_DEBUG NOT set for device creation, alpha blending does not work... looks like alpha testing.

D3D11_BLEND_DESC oBlendStateDesc;

oBlendStateDesc.AlphaToCoverageEnable = 0;
oBlendStateDesc.IndependentBlendEnable = 0;

for (unsigned int a = 0; a < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++a)
{
	oBlendStateDesc.RenderTarget[a].BlendEnable = 1;
	oBlendStateDesc.RenderTarget[a].SrcBlend = D3D11_BLEND_SRC_ALPHA;
	oBlendStateDesc.RenderTarget[a].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
	oBlendStateDesc.RenderTarget[a].BlendOp = D3D11_BLEND_OP_ADD;
	oBlendStateDesc.RenderTarget[a].SrcBlendAlpha = D3D11_BLEND_ONE;
	oBlendStateDesc.RenderTarget[a].DestBlendAlpha = D3D11_BLEND_ONE;
	oBlendStateDesc.RenderTarget[a].BlendOpAlpha = D3D11_BLEND_OP_ADD;
	oBlendStateDesc.RenderTarget[a].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
}

HRESULT HResult = m_poDevice->CreateBlendState(&oBlendStateDesc, &m_poBlendState); //HResult returns S_OK

Anyone have any idea what may be causing this?

 

UPDATE: Tested on two different PC's... Both windows 7 64 bit, one has a GTX 460 & the other is a GTX 580. The one with the GTX 580 does not have any problems with alpha blending.

 

SOLVED: There was an initialized variable in there somewhere and I can only assume creating in debug mode caught the error. Another difference between the two tested machines is the visual studio version. So perhaps the later version machine (gtx 580) caught the error also.


Edited by reaperrar, 14 March 2013 - 04:27 PM.


#2 David_pb   Members   

1046
Like
0Likes
Like

Posted 14 March 2013 - 02:13 AM


Desc.RenderTarget[a].DestBlendAlpha = HZBLENDVALUE_ONE;


What's HZBLENDVALUE_ONE supposted to be?

#3 reaperrar   Members   

136
Like
0Likes
Like

Posted 14 March 2013 - 03:08 AM

 

Desc.RenderTarget[a].DestBlendAlpha = HZBLENDVALUE_ONE;

 

What's HZBLENDVALUE_ONE supposted to be?

Typo in the post, not in the code... my bad. Edited






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.