swift - 在金属的内核函数中水平翻转纹理
问题描述
我只需要使用金属中的核函数水平翻转纹理。这是我的内核。
kernel void compute(
texture2d<float,access::read> des [[texture(0)]],
texture2d<float, access::write> src [[texture(1)]],
uint2 gid [[thread_position_in_grid]])
{
float4 flipColor = src.read(uint2(gid.x,1536 - gid.y));
des.write(flipColor, gid);
}
这里源纹理是我需要翻转的纹理。我正在从源纹理读取并写入目标纹理。但它不能正常工作。(赋予透明质感)
原因是什么?请给个建议好吗?
解决方案
推荐阅读
- javascript - 在这个 svg 滚动动画中使用粘性导航
- spring-vault - 将 Spring Cloud Vault 和 ConfigData API 与多个配置文件一起使用
- solidity - Solidity - 基于字符串值哈希的映射
- next.js - 在一个请求中创建多个页面
- amazon-web-services - 雅典娜找到一个月的最后一天
- python - 为什么在输入文件中搜索字符串时会出现“StopIteration”?
- excel - 将数据粘贴到 Excel 模板中
- python - 如何在python中检索语句的未保存输出?
- java - Hibernate 创建了一个额外的不必要的请求
- javascript - Material UI StepIcon 具有实际图标但保留背景圆圈