Sign in to follow this  
robydx

Format R32_Float for Render Target

Recommended Posts

robydx    225

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

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