MCPcopy Create free account
hub / github.com/baldurk/renderdoc / PopulateImage

Method PopulateImage

renderdoc/driver/gl/gl_shaderdebug.cpp:1744–1846  ·  view source on GitHub ↗

Must be called from the replay manager thread (the debugger thread)

Source from the content-addressed store, hash-verified

1742
1743 // Must be called from the replay manager thread (the debugger thread)
1744 void PopulateImage(const ShaderBindIndex &bind)
1745 {
1746 CHECK_DEVICE_THREAD();
1747 ImageData data;
1748 bool valid = true;
1749 const Descriptor &imgData = GetDescriptor("performing image load/store", bind, valid);
1750 if(valid)
1751 {
1752 // if the resources might be dirty from side-effects from the action, replay back to right
1753 // before it.
1754 if(m_ResourcesDirty)
1755 {
1756 GLMarkerRegion region("un-dirtying resources");
1757 m_pDriver->GetReplay()->ReplayLog(m_EventID, eReplay_WithoutDraw);
1758 m_ResourcesDirty = false;
1759 }
1760
1761 if(imgData.type == DescriptorType::TypedBuffer ||
1762 imgData.type == DescriptorType::ReadWriteTypedBuffer)
1763 {
1764 ResourceId buffer = imgData.resource;
1765 uint64_t offset = imgData.byteOffset;
1766 GLenum format = MakeGLFormat(imgData.format);
1767 uint64_t byteWidth = imgData.byteSize;
1768
1769 data.fmt = imgData.format;
1770 data.texelSize = (uint32_t)GetByteSize(1, 1, 1, GetBaseFormat(format), GetDataType(format));
1771
1772 // convert to a texel width, rounding down as per spec
1773 data.width = uint32_t(byteWidth / data.texelSize);
1774 data.height = 1;
1775 data.depth = 1;
1776
1777 data.samplePitch = data.slicePitch = data.rowPitch = data.width * data.texelSize;
1778
1779 m_pDriver->GetReplay()->GetBufferData(imgData.resource, offset, data.rowPitch, data.bytes);
1780 }
1781 else if(imgData.resource != ResourceId())
1782 {
1783 ResourceId id = imgData.resource;
1784 const WrappedOpenGL::TextureData &texProps = m_pDriver->m_Textures[id];
1785
1786 uint32_t mip = imgData.firstMip;
1787
1788 data.width = RDCMAX(1, texProps.width >> mip);
1789 data.height = RDCMAX(1, texProps.height >> mip);
1790 if(texProps.curType == eGL_TEXTURE_3D)
1791 {
1792 data.depth = RDCMAX(1, texProps.depth >> mip);
1793 }
1794 else
1795 {
1796 data.depth = texProps.depth;
1797 }
1798
1799 GLenum format = MakeGLFormat(imgData.format);
1800
1801 data.fmt = imgData.format;

Callers

nothing calls this directly

Calls 15

GetDescriptorFunction · 0.85
MakeGLFormatFunction · 0.85
GetBaseFormatFunction · 0.85
GetDataTypeFunction · 0.85
RDCMAXFunction · 0.85
SubresourceClass · 0.85
GetByteSizeFunction · 0.70
ResourceIdFunction · 0.50
ReplayLogMethod · 0.45
GetReplayMethod · 0.45
GetBufferDataMethod · 0.45

Tested by

no test coverage detected