按 IOSurface 行对齐要求创建奇数宽度的追踪诊断图

这个提交包含在:
mac 于 2026-11-08 19:13:46 +08:00 提交
1 父节点 63c49b0135
当前提交 4336454932
2 个文件已更改
+3 -2

没有与搜索条件相匹配的文件

+2 -1
查看文件
@@ -120,8 +120,9 @@
@implementation DYDiagnosticTile
- (instancetype)initWithDevice:(id<MTLDevice>)device width:(NSUInteger)width height:(NSUInteger)height {
if((self=[super init])) {
size_t bytesPerRow=IOSurfaceAlignProperty(kIOSurfaceBytesPerRow,width*8);
NSDictionary *properties=@{(id)kIOSurfaceWidth:@(width),(id)kIOSurfaceHeight:@(height),
(id)kIOSurfaceBytesPerElement:@8,(id)kIOSurfaceBytesPerRow:@(width*8),
(id)kIOSurfaceBytesPerElement:@8,(id)kIOSurfaceBytesPerRow:@(bytesPerRow),
(id)kIOSurfacePixelFormat:@(kCVPixelFormatType_64RGBAHalf)};
_surface=IOSurfaceCreate((CFDictionaryRef)properties);
MTLTextureDescriptor *d=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:width height:height mipmapped:NO];