Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在macOS上,MTKview colorAttachments[0]。clearColor seam无法工作_Objective C_Macos_Metal_Metalkit_Mtkview - Fatal编程技术网

Objective c 在macOS上,MTKview colorAttachments[0]。clearColor seam无法工作

Objective c 在macOS上,MTKview colorAttachments[0]。clearColor seam无法工作,objective-c,macos,metal,metalkit,mtkview,Objective C,Macos,Metal,Metalkit,Mtkview,在macos下,当我这样做时: MTLRenderPassDescriptor* renderPassDesc = [MTLRenderPassDescriptor renderPassDescriptor]; MTLRenderPassColorAttachmentDescriptor* colorAttachmentDesc = [MTLRenderPassColorAttachmentDescriptor new]; colorAttachmentDesc.texture = drawa

在macos下,当我这样做时:

MTLRenderPassDescriptor* renderPassDesc = [MTLRenderPassDescriptor renderPassDescriptor];

MTLRenderPassColorAttachmentDescriptor* colorAttachmentDesc = [MTLRenderPassColorAttachmentDescriptor new];
colorAttachmentDesc.texture = drawable.texture;
colorAttachmentDesc.loadAction = MTLLoadActionClear;
colorAttachmentDesc.storeAction = MTLStoreActionStore;
colorAttachmentDesc.clearColor = MTLClearColorMake(1, 1, 1, 1);
当我检查完
colorAttachmentDesc.clearColor的值后,我可以看到我仍然有(0,0,0,1),而不是(1,1,1)


在ios上它工作得很好,但在使用NSView而不是UIView的macOS上,我不明白为什么它不工作。我遗漏了什么吗?

您能否提供更多的上下文,说明您随后如何对渲染过程进行编码?您是在配置视图提供的渲染过程描述符,还是从头开始创建自己的渲染过程描述符?您是在执行多个过程,还是直接渲染到视图的当前可绘制纹理?@warrenm我刚刚用示例更新了问题。我不明白为什么它不起作用:(在这里,没有什么不正确的用法(假设您正在修改最终由渲染过程使用的附件描述符,并且引用的可绘制文件就是最终呈现的文件).如果你有一个复制这个问题的小项目,我鼓励你发布它。@warrenm“变异”是什么意思?