Jump to content

  • Log In with Google      Sign In   
  • Create Account


Map texture for reading problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 wh1sp3rik   Members   -  Reputation: 248

Like
0Likes
Like

Posted 16 February 2014 - 02:23 PM

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.


DirectX 11, C++


Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 3652

Like
2Likes
Like

Posted 16 February 2014 - 02:38 PM

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.



#3 wh1sp3rik   Members   -  Reputation: 248

Like
0Likes
Like

Posted 16 February 2014 - 02:43 PM

Yeah, I realized it now. Padding ...

 

Thank you, let's try it.


DirectX 11, C++





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS