Jump to content
  • Advertisement
Sign in to follow this  
Backfist

DX11 [DX11] Sharing CB's between few effects

This topic is 2776 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,
For a few days I'm trying to achieve EffectPools functionality in DirectX11.
In my test app I'v got two effects:
-GlobalVariables.fx (Something like effect pool but using registers)
-Material.fx

GlobalVariables.fx

[..]
shared Texture2D txDiffuse[MAX_TEXTURES_PER_MATERIAL] : register(t7);
//*****
//Clip plane info
shared cbuffer clipPlaneData :register(b2)
{
float3 clipPlaneNormal;
float clipPlaneOffset;
}


Material.fx

#include GlobalVariables.fx
//Make use of it


The only effect I use to set constant buffers and variables is created using GlobalVariables.fx (similary to effect pools).

CLIP_PLANE_DATA *cpData;
D3D11_MAPPED_SUBRESOURCE subResource;
((CTbDeviceDx10*)m_device)->getDeviceContext()->Map(m_clipPlaneDataBuffer,0,D3D11_MAP_WRITE_DISCARD,0,&subResource);
cpData = (CLIP_PLANE_DATA*)subResource.pData;
cpData->clipPlaneNormal = normal;
cpData->clipPlaneOffset = offset;
((CTbDeviceDx10*)m_device)->getDeviceContext()->Unmap(m_clipPlaneDataBuffer,0);
// Set the constant buffer
ID3DX11EffectConstantBuffer* cbuffer = m_effectPool->GetConstantBufferByName("clipPlaneData");
if (cbuffer != NULL && cbuffer->IsValid()) {
cbuffer->SetConstantBuffer(m_clipPlaneDataBuffer);
}

I update texture buffers updat using ID3DX11EffectShaderResourceVariable interface.

Sadly, It doesn't work :( Is the whole idea wrong or I have just messed up someting in implementation ?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!