Jump to content
  • Advertisement
Sign in to follow this  
robydx

Format R32_Float for Render Target

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

I've created my Render Target in both R8G8B8A8_Unorm and R32G32B32A32_float. No problem.

But If I use R32_Float the texture is written (I'm using visual studio graphics debug to see that texture is written) but when I read it in a Shader, the result is always 0.

 

What' wrong? I create my resource like this

?

ClearValue renderTargetOptimizedClearValue = new ClearValue()

{

   Format = targetFormat,

   Color = new Vector4(0, 0, 0, 0)

};

 

renderTarget= Device.CreateCommittedResource(new HeapProperties(HeapType.Default), HeapFlags.None,

                    new ResourceDescription(ResourceDimension.Texture2D, 0, width, height, 1, 1, targetFormat, 1, 0, TextureLayout.Unknown, ResourceFlags.AllowRenderTarget), ResourceStates.RenderTarget, renderTargetOptimizedClearValue);

 

Device.CreateRenderTargetView(renderTarget, null, heapRTV);

 

ShaderResourceViewDescription desc = new ShaderResourceViewDescription

{

                Dimension = ShaderResourceViewDimension.Texture2D,

                Format =  targetFormat,

                Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING

};

desc.Texture2D.MipLevels = 1;

desc.Texture2D.MostDetailedMip = 0;

desc.Texture2D.ResourceMinLODClamp = 0;

 

Device.CreateShaderResourceView(renderTarget, desc, heapSRV);

Edited by robydx

Share this post


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