DiligentGraphics / DiligentEngine

A modern cross-platform low-level graphics library and rendering framework
http://diligentgraphics.com/diligent-engine/
Apache License 2.0
3.63k stars 331 forks source link

render target failed #224

Closed zhaokaixs closed 1 year ago

zhaokaixs commented 1 year ago

i have two texture eg.

`
RefCntAutoPtr m_rendertarget1 RefCntAutoPtr m_rendertarget2;

            TextureDesc desc;
    desc.Width = width;
    desc.Height = height;
    desc.Name = "Backbuffer Texture";
    desc.Format = m_format;
    desc.Usage = USAGE_DEFAULT;
    desc.CPUAccessFlags = CPU_ACCESS_NONE;
    desc.Type = RESOURCE_DIM_TEX_2D;
    desc.BindFlags = BIND_SHADER_RESOURCE | BIND_RENDER_TARGET;
            CreateTexture(desc, nullptr, &m_rendertarget1);
            CreateTexture(desc, nullptr, &m_rendertarget2);

` when i draw a image to m_rendertarget1 , and save m_rendertarget1 to image file,it's successs, but draw m_rendertarget1 to m_rendertarget2, save to image file. the image file is empty . why not render failed ?

zhaokaixs commented 1 year ago

Tutorial03_Texturing.zip

TheMostDiligent commented 1 year ago

In your snippet, you use SRV of m_RenderTexture, but you never use SRV of m_RenderTexture1. This might be the reason.

zhaokaixs commented 1 year ago

In your snippet, you use SRV of m_RenderTexture, but you never use SRV of m_RenderTexture1. This might be the reason. Tutorial03_Texturing.zip is my test code,