c++ - DesktopImageInSystemMemory of DXGI_OUTDUPL_DESC -
i need variable true can use mapdesktopsurface of idxgioutputduplication
how set true. previous settings can done.
here link
http://msdn.microsoft.com/en-us/library/windows/desktop/hh404622(v=vs.85).aspx
i faced same problem...so need do:
the mapdesktopsurface method of times return dxgi_error_unsupported image not in system memory, in gpu memory.
in case, need transfer image gpu memory system memory.
so how that?
create descriptor
id3d11texture2d
of typed3d11_texture12d_desc
.use
getdesc
on image(id3d11texture2d
) acquired usingidxgioutputduplication::acquirenextframe
fill in descriptor.this descriptor has
framedescriptor.usage
setd3d11_usage_default
.you need set descriptor following parameters (let others remain is):
framedescriptor.usage = d3d11_usage_staging; framedescriptor.cpuaccessflags = d3d11_cpu_access_read; framedescriptor.bindflags = 0; framedescriptor.miscflags = 0; framedescriptor.miplevels = 1; framedescriptor.arraysize = 1; framedescriptor.sampledesc.count = 1;
now, create new staging buffer (
id3d11texture2d
) using above descriptor follows:m_device->createtexture2d(&framedescriptor, null, &newid3d11texture2d);
copy contents of acquired image staging buffer follows:
m_devicecontext->copyresource(newid3d11texture2d, m_acquireddesktopimage);
important: release acquired frame using
idxgioutputduplication::releaseframe()
now can process newtexture (
newid3d11texture2d
) wish!!!!!
map if want...
this should enough answering query...if want more information, can check out msdn pages or ask through comments...
Comments
Post a Comment