🐎 Make the hardware decode's plane textures read-only
The Metal bundle's textures over a decode's output planes declared ShaderRead and ShaderWrite. No host arm needs the write: VA-API and NVDEC land a picture in the plane's buffer (the surface's device cache or its pages), by the CPU or a GPU copy into that buffer, never through a texture or a shader, and no host path checks the texture's usage. The decode op already names both planes written whatever their usage (rgfxEncodeVideoSession). The usage only made the device take a plane as written wherever a shader with no interface at hand bound it, on the guest (RgfxSurfaceBindings) and on the host (usage_writes, a laid-out cache's use), each a download or a dirty shape of a surface no shader wrote. The textures now declare ShaderRead alone.
This commit is contained in:
1 parent
9df71bca5e
commit
06f95df9d2
1 file changed
+5
-1
@@ -281,7 +281,11 @@ id<MTLTexture> planeTexture(RgfxMetalDevice *device, IOSurfaceRef surface, size_
|
||||
width:w
|
||||
height:h
|
||||
mipmapped:NO];
|
||||
desc.usage = MTLTextureUsageShaderRead | MTLTextureUsageShaderWrite;
|
||||
// Read alone: the host's decode writes the plane's bytes in the surface's device cache or its
|
||||
// pages, not a shader, and the decode op names the texture written whatever its usage
|
||||
// (rgfxEncodeVideoSession). A usage with ShaderWrite would have the device take the plane as
|
||||
// written wherever a shader with no interface at hand binds it.
|
||||
desc.usage = MTLTextureUsageShaderRead;
|
||||
auto make = [&]() -> id<MTLTexture> {
|
||||
if (width == 0)
|
||||
return [device newTextureWithDescriptor:desc iosurface:surface plane:plane];
|
||||
|
||||
Reference in new issue
Block a user