Jump to content
  • Advertisement
Sign in to follow this  
Happy SDE

Is it possible “Update” texture in one pass?

This topic is 807 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

I have source HDR texture (it may be MSAA or no-MSAA).

I have quarter-res bloom texture that contains luminance.

I would like update source texture in 1 full-screen pass (pixel-by-pixel):

  1. Sample HDR, calculate luminance.
  2. Increase luminance by sampled value from bloom texture.
  3. Store new color value to source texture.

As I know I can do it by creating another HDR texture and store result there.

But I would like to save some memory.

Is it possible?

 

Thanks in advance.

Edited by Happy SDE

Share this post


Link to post
Share on other sites
Advertisement

as long as the compute shader runs per pixel (and doesn't sample neighbouring pixel),  Sergio's suggest should work well.

Share this post


Link to post
Share on other sites

I can imagine how to do it for non-MSAA texture.

But is it possible to run on per-sample?

 

AFAIK UAV can not be created for multisampled texture:

typedef struct D3D11_UNORDERED_ACCESS_VIEW_DESC {
  DXGI_FORMAT         Format;
  D3D11_UAV_DIMENSION ViewDimension;
  union {
    D3D11_BUFFER_UAV      Buffer;
    D3D11_TEX1D_UAV       Texture1D;
    D3D11_TEX1D_ARRAY_UAV Texture1DArray;
    D3D11_TEX2D_UAV       Texture2D;
    D3D11_TEX2D_ARRAY_UAV Texture2DArray;
    D3D11_TEX3D_UAV       Texture3D;
  };
} D3D11_UNORDERED_ACCESS_VIEW_DESC;

Any ideas?

Share this post


Link to post
Share on other sites
if you really just want to add the bloom value, how about additive blending,while the pixelshader reads and output the bloom color?

Share this post


Link to post
Share on other sites
if you really just want to add the bloom value, how about additive blending,while the pixelshader reads and output the bloom color?

If it would be different textures, I will not save VRAM =(

 

When I tried to set the same texture as RT and SRV, I got this error:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

 

So I got one choice left: Use quarter res bloom texture's SRV on tone-mapping stage.

RT in this case will be LDR back buffer, that is already allocated.

 

Or find a way how to write to particular sub-sample =)

In this case it will be possible to iterate over all subsamples of a pixel in CS/PS, and compute new color value.

But Texture2DMS has no write operators =(

Edited by Happy SDE

Share this post


Link to post
Share on other sites

You can't create a UAV for a multisampled texture, so you can't write to one directly from a shader. Even if you could, you can't read from an fp16 UAV texture unless the GPU supports extended formats for UAV reads, and you're running on D3D11.3 or D3D12. 

Edited by MJP

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!