Followers 0

# DX11 wp8 problem

## 3 posts in this topic

Hello!

I'm trying to make something on wp8 using dx11. And I have one bug. I'm trying to draw a picture with transparency.gpApp->m_deviceContext->IASetVertexBuffers( 0, 1, vertexbuffer.GetAddressOf(), &stride, &offset );
gpApp->m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
gpApp->m_deviceContext->Draw( 3 * trianglesCount, 0 );

And all looks ok -

.

I see transparent square on a picture.

But then I minimizing the app the transparent part is going black -

struct VertexShaderInput
{
float4 pos : POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

{
float4 pos : SV_POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

{

output.pos = input.pos;
output.texcoord = input.texcoord;
output.color = input.color;

return output;
}
----------------------------------------------------

Texture2D Texture;
SamplerState ss;

{
float4 pos : SV_POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

{
return Texture.Sample(ss, input.texcoord);
//return input.color * Texture.Sample(ss, input.texcoord);
}

----------------------------------------------------

Please give me a direction that I have done wrong. Any ideas! Thanks!

Edited by Andrey.Mesheryakov
0

##### Share on other sites

We can safely assume that wp8 is Windows Phone 8, right? (Just have to ask)

• To simplify our lives, put the code in the <> tool your thread editor gives you. (It makes it more readable  )
• Can we see your blend state, how is it defined?
• Is the red in the background automatic, or is it something you draw as well? (Order matters!)

-MIGI0027

0

##### Share on other sites

Yes, wp8 mean Windows Phone 8.

Here is blend state creation -

D3D11_BLEND_DESC bd;
bd.RenderTarget[0].BlendEnable = TRUE;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
bd.IndependentBlendEnable = FALSE;
bd.AlphaToCoverageEnable = FALSE;

DX::ThrowIfFailed( m_device->CreateBlendState(&bd, &m_blendNormal) );


Red background is from here -

float blendFactor[] = {1.0f, 1.0f, 1.0f, 1.0f};
m_deviceContext->ClearRenderTargetView( m_rendertarget.Get(), color );

Edited by Andrey.Mesheryakov
0

##### Share on other sites

Fixed. Blend state should be -

D3D11_BLEND_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.RenderTarget[0].BlendEnable = TRUE;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
bd.IndependentBlendEnable = FALSE;
bd.AlphaToCoverageEnable = FALSE;
0

## Create an account

Register a new account

Followers 0

• ### Similar Content

• Hi Guys,
I am revisiting an old DX11 framework I was creating a while back and am scratching my head with a small issue.
I am trying to set the pixel shader resources and am getting the following error on every loop.
As you can see in the below code, I am clearing out the shader resources as per the documentation. (Even going overboard and doing it both sides of the main PSSet call). But I just can't get rid of the error. Which results in the render target not being drawn.
ID3D11ShaderResourceView* srv = { 0 }; d3dContext->PSSetShaderResources(0, 1, &srv); for (std::vector<RenderTarget>::iterator it = rtVector.begin(); it != rtVector.end(); ++it) { if (it->szName == name) { //std::cout << it->srv <<"\r\n"; d3dContext->PSSetShaderResources(0, 1, &it->srv); break; } } d3dContext->PSSetShaderResources(0, 1, &srv);
I am storing the RT's in a vector and setting them by name. I have tested the it->srv and am retrieving a valid pointer.
At this stage I am out of ideas.
Any help would be greatly appreciated

• hi, guys, how to understand the math used in CDXUTDirectionWidget ::UpdateLightDir
the  following code snippet is taken from MS DXTU source code

D3DXMATRIX mInvView;
D3DXMatrixInverse( &mInvView, NULL, &m_mView );
mInvView._41 = mInvView._42 = mInvView._43 = 0;
D3DXMATRIX mLastRotInv;
D3DXMatrixInverse( &mLastRotInv, NULL, &m_mRotSnapshot );
D3DXMATRIX mRot = *m_ArcBall.GetRotationMatrix();
m_mRotSnapshot = mRot;
// Accumulate the delta of the arcball's rotation in view space.
// Note that per-frame delta rotations could be problematic over long periods of time.
m_mRot *= m_mView * mLastRotInv * mRot * mInvView;
// Since we're accumulating delta rotations, we need to orthonormalize
// the matrix to prevent eventual matrix skew
D3DXVECTOR3* pXBasis = ( D3DXVECTOR3* )&m_mRot._11;
D3DXVECTOR3* pYBasis = ( D3DXVECTOR3* )&m_mRot._21;
D3DXVECTOR3* pZBasis = ( D3DXVECTOR3* )&m_mRot._31;
D3DXVec3Normalize( pXBasis, pXBasis );
D3DXVec3Cross( pYBasis, pZBasis, pXBasis );
D3DXVec3Normalize( pYBasis, pYBasis );
D3DXVec3Cross( pZBasis, pXBasis, pYBasis );

https://github.com/Microsoft/DXUT/blob/master/Optional/DXUTcamera.cpp
• By YixunLiu
Hi,
I have a surface mesh and I want to use a cone to cut a hole on the surface mesh.
Anybody know a fast method to calculate the intersected boundary of these two geometries?

Thanks.

YL

• By hiya83
Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
Thanks!

• Hi Guys,
I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?
Any advice would be greatly appreciated

• 9
• 17
• 10
• 28
• 14