| 1903 | return GetRenderTargetTexture(context, render_target, GetAttachmentBufferType(attachment)); |
| 1904 | } |
| 1905 | HTexture GetRenderTargetTexture(HContext context, HRenderTarget render_target, BufferType buffer_type) |
| 1906 | { |
| 1907 | GraphicsContext* gc = (GraphicsContext*)context; |
| 1908 | DM_MUTEX_OPTIONAL_SCOPED_LOCK(gc->m_AssetHandleContainerMutex); |
| 1909 | const RenderTarget* rt = GetAssetFromContainer<RenderTarget>(gc->m_AssetHandleContainer, render_target); |
| 1910 | if (!rt) |
| 1911 | { |
| 1912 | return 0; |
| 1913 | } |
| 1914 | |
| 1915 | if (IsColorBufferType(buffer_type)) |
| 1916 | { |
| 1917 | return rt->m_TextureColor[GetBufferTypeIndex(buffer_type)]; |
| 1918 | } |
| 1919 | else if (buffer_type == BUFFER_TYPE_DEPTH_BIT) |
| 1920 | { |
| 1921 | return rt->m_TextureDepth ? rt->m_TextureDepth : rt->m_TextureDepthStencil; |
| 1922 | } |
| 1923 | else if (buffer_type == BUFFER_TYPE_STENCIL_BIT) |
| 1924 | { |
| 1925 | return rt->m_TextureStencil ? rt->m_TextureStencil : rt->m_TextureDepthStencil; |
| 1926 | } |
| 1927 | return 0; |
| 1928 | } |
| 1929 | static inline const TextureParams* GetRenderTargetTextureParams(const RenderTarget* rt, BufferType buffer_type) |
| 1930 | { |
| 1931 | if (IsColorBufferType(buffer_type)) |