Jump to content
  • Advertisement
Sign in to follow this  
BlackJoker

Which DXGI formats supported by D2D::CreateDxgiSurfaceRenderTarget

This topic is 2114 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 am currently tying to create swap chain with DXGI format DXGI_FORMAT_R10G10B10A2_UNORM, but my program is crashed on creating DXGI surface for D2D using that format without any description:





swapChain->GetBuffer(0, IID_PPV_ARGS(&dxgiBackbuffer));
	D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(
		D2D1_RENDER_TARGET_TYPE_HARDWARE,
		D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED));
	
	d2dfactory->CreateDxgiSurfaceRenderTarget(dxgiBackbuffer, props, &d2dRenderTarget);

Whne I use DXGI_FORMAT_R8G8B8A8_UNORM - D2D render target creates without any errors. 

 

Could someone answer why mentioned above format is not supported or I just do something wrong and which formats supported by this function?

Edited by BlackJoker

Share this post


Link to post
Share on other sites
Advertisement
I thought you were working from (or at least have used once) the Braynzarsoft D2D sample. It does pretty much that: Creates a custom texture (but compatible one), renders the text there and finally renders a full screen quad (two triangles) sampling said texture. I just tried and changed that sample using your HDR format for the backbuffer and it works fine (even with RGBA16F).

Hmmm, can't PIX that thing though (now I remember why I don't like to use D2D).

A warning though: IIRC there are some inconveniences coming along when using this approach: Transparency. If you got only one 2D layer (text, say) or opaque then you're probably fine.

Share this post


Link to post
Share on other sites

I use almost the same code for D2D, but I am wonder if I can correctly render text using ID2D1HwndRenderTarget?

I create render target for HWND like this:



result = d2dfactory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),D2D1::HwndRenderTargetProperties(hwnd, size),&d2dHwndRenderTarget);

It works, but image is flickering. Why is this happening? Or HwndRenderTarget will not work with D3D11?

Edited by BlackJoker

Share this post


Link to post
Share on other sites
Not that I've tried, but I guess so: ericrrichards has the same troubles. (D2D seems quite popular around here lately)

Nah, I remember some similar behavior with D3D9: When you tried to combine D3D with GDI/GDI+ rendering you got a unavoidable flicker (or bad framerate or both). So yeah, you need to go the offscreen texture route. Edited by unbird

Share this post


Link to post
Share on other sites

Unfortunately, offscreen texture is not the best way for me. I want to use D2D. It very easy to render any text in any language using it. Disadvantage only in that it not support all pixel formats. 

Does anyone know how to solve this problem using only D2D or it unsolvable fow now (even for window 8.1)?

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!