Sign in to follow this  

DX9 Render target size

This topic is 2550 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 all,

I have the following problem:

I'm trying out rendering to texture and then applying the texture to full screen quad.

When I set the render target to 512x512 it renders fine.

When I set it to 1024x1024 or my back buffer size, it renders nothing.
I've checked this using PIX, nothing gets drawn onto the render target.

I set the render target as following:

m_mainD3DDevice->CreateTexture(512,512,1,D3DUSAGE_RENDERTARGET,D3DFMT_X8R8G8B8,D3DPOOL_DEFAULT,&m_RT1,NULL);



however, as I mentioned already, setting any other values for height and width renders nothing.

Any tips where the problem might me?

Share this post


Link to post
Share on other sites
Since you're getting a satisfactory HRESULT return, this is probably not the problem, but..
Quote:
D3DX Debug doesn't give any fault...

Just to make sure we're talking about the same thing - it's not just defining DEBUG, the D3D runtime debug version of the DLLs needs to be turned on in the DX control panel.

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
Since you're getting a satisfactory HRESULT return, this is probably not the problem, but..
Quote:
D3DX Debug doesn't give any fault...

Just to make sure we're talking about the same thing - it's not just defining DEBUG, the D3D runtime debug version of the DLLs needs to be turned on in the DX control panel.


Well, I do link against the debug versions and in Visual Studio Debug output I do get messages from D3DX like : D3DX: (INFO) Using SSE2 optimizations.

I have seen error messages before when I had other errors so I am pretty sure I do get debug info. Is there setting to for a level of debug info or is it constant?

Share this post


Link to post
Share on other sites
Quote:
Original post by Corefanatic
Zbuffer: AutoDepthStencilFormat = D3DFMT_D16;


I meant the width*height of the z-buffer, not the bit depth.

Share this post


Link to post
Share on other sites
You can set the level of debugging messages. That's why we posted the link to the DruinkJournal. Did you check the DX control panel?

EDIT: The messages should come from Direct3D, not D3DX.

Ex:

Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.


( EDIT2: C'mon, Steve. Keep up! [smile])

Share this post


Link to post
Share on other sites
Quote:
Original post by Corefanatic
Well, I do link against the debug versions and in Visual Studio Debug output I do get messages from D3DX like : D3DX: (INFO) Using SSE2 optimizations.
D3DX debug spew comes from linking d3dx9d.lib. Do you get any debug output from D3D9? You should at least get a message saying it's using a HAL HWVP device or similar.

EDIT: Ninja'd again!

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
You can set the level of debugging messages. That's why we posted the link to the DruinkJournal. Did you check the DX control panel?

EDIT: The messages should come from Direct3D, not D3DX.

Ex:

Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.


( EDIT2: C'mon, Steve. Keep up! [smile])


Ok, got the proper debug now but no errors or warnings related to textures or render targets when I step through the code, just few warnings about vertex buffers after loading .x mesh.

Share this post


Link to post
Share on other sites
Quote:
Original post by kauna
Quote:
Original post by Corefanatic
Zbuffer: AutoDepthStencilFormat = D3DFMT_D16;


I meant the width*height of the z-buffer, not the bit depth.


I don't explicitly set it, I assume D3D does that automatically from my window size.

Share this post


Link to post
Share on other sites
Quote:
Original post by Corefanatic
Quote:
Original post by kauna
Quote:
Original post by Corefanatic
Zbuffer: AutoDepthStencilFormat = D3DFMT_D16;


I meant the width*height of the z-buffer, not the bit depth.


I don't explicitly set it, I assume D3D does that automatically from my window size.


So logically, if your window size is smaller than 1024*1024, then rendering to a 1024*1024 render target will fail, since your z-buffer will be the same size as the back buffer.

I am not saying that this is the case, but just something to verify.

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
Just for fun, try m_RT1->GetLevelDesc and see if all the parameters in D3DSURFACE_DESC are correct. Obviously, width and height should be as requested.


Seems correct, format is as I set it,

Type is D3DRTYPE_SURFACE
Usage is 1
Pool is D3DPOOL_DEFAULT
MultiSampleType is D3DMULTISAMPLE_NONE
MultiSampleQuality is 0
Width and Height are 1024 which doesn't work

Share this post


Link to post
Share on other sites
Quote:
Original post by kauna
Quote:
Original post by Corefanatic
Quote:
Original post by kauna
Quote:
Original post by Corefanatic
Zbuffer: AutoDepthStencilFormat = D3DFMT_D16;


I meant the width*height of the z-buffer, not the bit depth.


I don't explicitly set it, I assume D3D does that automatically from my window size.


So logically, if your window size is smaller than 1024*1024, then rendering to a 1024*1024 render target will fail, since your z-buffer will be the same size as the back buffer.

I am not saying that this is the case, but just something to verify.


I think you are onto the problem, my height is less than 1024. Also, the backbuffer size is probably less then my window size since the window frame takes a bit off.

What is the best way to find out the backbuffer size after it's been created?

Share this post


Link to post
Share on other sites

Hi,

IDirect3DSurface9 *pZStencilSurface;

you can get the z-buffer/stencil with device->GetDepthStencilSurface(&pZStencilSurface);

You may create a separate depth-stencil surface to use with your 1024x1024 render target.

Cheers!

Share this post


Link to post
Share on other sites
Quote:
Original post by kauna

Hi,

IDirect3DSurface9 *pZStencilSurface;

you can get the z-buffer/stencil with device->GetDepthStencilSurface(&pZStencilSurface);

You may create a separate depth-stencil surface to use with your 1024x1024 render target.

Cheers!


Ok, solved it, the dimensions of my backbuffer and therefore the depthbuffer were slightly smaller than my window size, therefore nothing rendered. After I got the right dimensions from my backbuffer, the render target works as intended.

Thx for everyone's help.

Share this post


Link to post
Share on other sites
Quote:
Original post by kauna

Hi,

IDirect3DSurface9 *pZStencilSurface;

you can get the z-buffer/stencil with device->GetDepthStencilSurface(&pZStencilSurface);

You may create a separate depth-stencil surface to use with your 1024x1024 render target.

Cheers!


Ok, solved it, the dimensions of my backbuffer and therefore the depthbuffer were slightly smaller than my window size, therefore nothing rendered. After I got the right dimensions from my backbuffer, the render target works as intended.

Thx for everyone's help.

Share this post


Link to post
Share on other sites

This topic is 2550 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this