Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  
wh1sp3rik

Map texture for reading problem

This topic is 2073 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

Hello,

 

I have a strange problem with mapping texture for reading.

My texture is R32_SINT format. When mapping, I obtained pData, RowPitch and DepthPitch.

My texture is 800 x 600 in size. Graphics debugger says, It's 800x600 and its size is 1920000. That's correct.

Unfortunately, RowPitch is 3328 ( which is about 128 more then it should be ) and DepthPitch is 1996800 ( and it should be 1920000 ).

 

Creating texture code

				ZeroMemory(&textureDesc, sizeof(D3D11_TEXTURE2D_DESC));
				textureDesc.BindFlags = 0;
				textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
				textureDesc.Width = width;
				textureDesc.Height = height;
				textureDesc.Format = dxformat;
				textureDesc.Usage = D3D11_USAGE_STAGING;
				textureDesc.SampleDesc.Quality = 0;
				textureDesc.SampleDesc.Count = 1;
				textureDesc.ArraySize = 1;
				textureDesc.MipLevels = 1;
				_device->CreateTexture2D(&textureDesc, 0, &resource->_resourceRead);

where width = 800, height = 600, dxformat = DXGI_FORMAT_R32_SINT.

 

Why it happend ? What's going on ?

 

Thank you very much for answers.

Share this post


Link to post
Share on other sites
Advertisement

Depending on driver, GPU and other things there might be some padding. Sometimes till power of 2, sometimes till multiple of 2 or other number.

In short 800 * 4 bytes are pixel data, next 128 bytes are unused, then next row starts.

Share this post


Link to post
Share on other sites
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!