direct3d 10 question

Started by
1 comment, last by LPVOID 10 years, 7 months ago

I have this

ID3D10ShaderResourceView* myTexture = NULL;

ID3D10EffectShaderResourceVariable* g_pTextureReader = NULL;

ID3D10EffectTechnique* g_pTechnique1 = NULL;
ID3D10EffectTechnique* g_pTechnique2 = NULL;
now I do this
g_pTextureReader ->SetResource( myTexture );
g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 );
g_pd3dDevice->Draw(1, 0);
g_pTechnique2->GetPassByIndex( 0 )->Apply( 0 );
g_pd3dDevice->Draw(1, 0);
then I want to render to "myTexture" renderTarget, so I need to unbound "myTexture" , to do that I do this
g_pTextureReader ->SetResource( NULL );
g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 );
g_pTechnique2->GetPassByIndex( 0 )->Apply( 0 );
Is this last thing the way it is done normally?
Advertisement

don't know very well how the bound and unbound works, it looks like if I don't unbound them on every technique it has been bound to, the bound will be still there, so every time you want to render to a bound thing you have to remember in which technique it was bounded, and the only method I know to unbound texture is the "apply(0)" thing

anyone knows more?

I know one method .when you have changed the render target ,then do this

ID3D10ShaderResourceView* pSRV[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
pDev->PSSetShaderResources( 0, _countof(pSRV), pSRV );

This topic is closed to new replies.

Advertisement