Dear All,
Please have a look into the following code.
An exception occurs when I call UnLockRect. Are you able to see some problems with the code
The level is defined as 0 in this case.
Other type of texture creations are working properly. Problem happening with D3DFMT_A32B32G32R32F type.
hr = D3DXCreateTexture( m_pd3dDevice, SCIF_TEXWIDTH, SCIF_TEXHEIGHT,
D3DX_DEFAULT, 0, D3DFMT_A32B32G32R32F,
D3DPOOL_MANAGED, &m_pKernelTextureC );
if( D3D_OK != hr )
{
return SC_FAILED;
}
hr = m_pKernelTextureC->LockRect( LEVEL, &d3dlr, 0, 0 );
if( D3D_OK != hr )
{
return SC_FAILED;
}
nPosition = 0;
for ( nIndex = 0; nIndex < 32; nIndex++)
{
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex]; //R
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 32]; //G
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 64]; //B
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 96]; //A
Please have a look into the following code.
An exception occurs when I call UnLockRect. Are you able to see some problems with the code
The level is defined as 0 in this case.
Other type of texture creations are working properly. Problem happening with D3DFMT_A32B32G32R32F type.
hr = D3DXCreateTexture( m_pd3dDevice, SCIF_TEXWIDTH, SCIF_TEXHEIGHT,
D3DX_DEFAULT, 0, D3DFMT_A32B32G32R32F,
D3DPOOL_MANAGED, &m_pKernelTextureC );
if( D3D_OK != hr )
{
return SC_FAILED;
}
hr = m_pKernelTextureC->LockRect( LEVEL, &d3dlr, 0, 0 );
if( D3D_OK != hr )
{
return SC_FAILED;
}
nPosition = 0;
for ( nIndex = 0; nIndex < 32; nIndex++)
{
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex]; //R
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 32]; //G
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 64]; //B
(( float* )d3dlr.pBits )[nPosition++]
= m_pfScifKernelC[nIndex + 96]; //A
}
hr = m_pKernelTextureC->UnlockRect( LEVEL ); // Here is the problem
if( D3D_OK != hr )
{
return SC_FAILED;
}
hr = m_pKernelTextureC->UnlockRect( LEVEL ); // Here is the problem
if( D3D_OK != hr )
{
return SC_FAILED;
}