Draw every width Apple's setLineWidth: takes, as Metal draws it
RenderCommandEncoder::set_line_width refused every width but 1 (AppleOnly::LineWidth). Measured on the Apple M3 Max under macOS 27.0.1 (probes/line_widths.m): each encoder starts at 1 and the width holds across draws and pipeline states; Metal draws w' = floor(16 w) / 16 clamped to [0, 16] (NaN and negatives as 0, infinity as 16); at w' = 1 its ordinary diamond-exit lines; at every other w' Vulkan's non-strict parallelogram (major axis the larger extent, x on a tie; minor-axis edges through the endpoints, w' long and centred; ends not extended; centres inside, top-left ties; the width not rounded); at 0 exactly the pixel centres on the segment; one parallelogram per strip segment with no joins; triangles in fill mode Lines draw their edges so; at 4 samples every width is the parallelogram at the sample positions. The runtime (render/line_width.rs) keeps the quantized width in the encoder state and routes each draw at w' != 1: - the device's own lines (lineWidth w', no Bresenham mode) where it enables wideLines and w' lies in lineWidthRange above 0: exact where strictLines is unset, nonStrictWideLinesUseParallelogram set, w' > 1 and on lineWidthGranularity; elsewhere announced device-wide-lines under the default DevicePolicy::wide_lines = WideLinePolicy::Device, and the band under WideLinePolicy::Exact (exact_answers() selects it); - the pipeline's band variant otherwise (no wideLines, MoltenVK among them; w' outside the range; w' = 0 at half a width of 2^-subPixelPrecisionBits): cull none, the band's front face, fill mode, a PATCH_LIST of two points, viewport 0's half extent pushed with the half width; strips and loops listed as their segments (ListGap::WideLines), flat inputs under the last provoking vertex read from the list led by the last vertex, which covers the same pixels. Refused: Unsupported(WideLines) needing tessellationShader where neither route draws a line; NotImplemented(RuntimeGap::WideLines) for a triangle's edges or a mesh draw's lines the device's lines do not draw, an amplified band, a rate-mapped pass and an execution's commands. Counted: WorkCounts::device_wide_line_draws, line_band_draws. The lane test runtime_lane::line_widths draws the probe's cases through owned fixtures and compares every pixel with Metal's answers (line_widths_m3_max.txt, the probe's output), checks each wide draw took a route, and that every fragment is front-facing; its site WIDE_LINES holds the new kind in the lane's degrade-notice closure. Docs: FAST-PATHS.md's row for wide_lines and a known-gap bullet (edges and mesh lines on devices without wideLines, near-plane cuts, band fragments' inputs uncompared, width 1 on multisampled targets off MoltenVK); API.md's policy bullet and degrade catalogue; the runtime README's Line widths; RUNTIME-PORTING's row; REFUSALS.md regenerated (reach rows for feature and gap WideLines, apple LineWidth gone). Validation: the line limits the device description gained describe execution and are not compared in a profile's subset check; the generator's CORE_PROPERTIES and roadmap-2022's m2v_layer_presentation state them at the reader's absent values; opened_chains reblessed (one member more, wide_lines, on every device with it); golden_hashes' profile fingerprints reblessed (no output cell moved); api_signatures and api_surface name WideLinePolicy and LineBandState. RUNTIME_VERSION 1712; the runtime-sources pin rewritten. Verified on the M3 Max under MoltenVK 1.4.2 through maclock with the validation layer: runtime_lane::line_widths, 4 tests pass. Default and exact policies each: 102 cases, 100 matched pixel for pixel, 2 refused (the two fill-mode Lines cases at width 4, NotImplemented(WideLines)), 0 announced; 46 draws took the band, 0 the device's lines (MoltenVK has no wideLines). a_band_needs_tessellation (tessellationShader withheld: width 0 refused needing it, width 2 refused, width 1 matches) and the_lane_s_maps_tell_the_widths_apart pass. Negative control: the band widened by 1/16 of a pixel fails both runs at LANE lines 0.5. Also cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; nextest of metal2vulkan, -air, -runtime and -devtools (4954 run, the one failure the missing lane site, now declared), of metal2vulkan-validation (the failures the profile rules, chains and pin fixed here, rerun green) and of metal2vulkan-conformance (1007 pass). Not run: lavapipe, RADV, ANV and NVIDIA lanes, which take the device route. (Carried to development from steelbrain/reims-graphics-kext b16d03150c.)
This commit is contained in:
1 parent
fe22294b09
commit
eb41a55e82
40 files changed
+3032
-156
No files matched your search
@@ -0,0 +1,444 @@
|
||||
// What plain Metal draws for `-[MTLRenderCommandEncoder setLineWidth:]` (SPI), the reference the
|
||||
// runtime's line widths (`metal2vulkan-runtime`'s `line_width.rs`) and the lane test
|
||||
// `runtime_lane::line_widths` are read against.
|
||||
//
|
||||
// One case a process, named on the command line (no name lists them). Every target is cleared
|
||||
// to zero and drawn by a pass-through vertex function that places pixel coordinates (y down) of
|
||||
// an S x S target, `(x / (S / 2) - 1, 1 - y / (S / 2))`, and a fragment function that returns 1
|
||||
// (or 1/255, added, where a map counts fragments). A map prints the rows a draw touched, one
|
||||
// character a pixel: `.` none, `#` a full pixel, digits the fragments or the samples covered.
|
||||
//
|
||||
// lane the lane test's draws on 16 x 16: a list of two lines and a three-vertex strip at
|
||||
// widths 0, 0.5, 1, 2, 3.5 and 8, side by side;
|
||||
// quantize which width Metal draws: the rows a horizontal line at y = 32 (64 x 64) covers in
|
||||
// column 32, and whether a vertical line at x = 16.5 is the diamond rule's (rows 3 to
|
||||
// 26) or a band's (4 to 27), over widths near multiples of 1/16, past 16, negative,
|
||||
// NaN and infinite;
|
||||
// state the width each encoder starts at, and that it holds across draws and pipeline states;
|
||||
// ties a band's edges: rows of a horizontal line on a pixel edge and through centres, ends
|
||||
// on pixel centres in both directions, 45 degrees both ways, a y-major line;
|
||||
// zero width 0 and below 1/16: centres on the segment, its ends, a segment through none;
|
||||
// strips fragments counted where a strip's segments overlap, at widths 1, 3.5 and 8;
|
||||
// fill triangles under the fill mode Lines at widths 1 and 4, and Fill at 4, counted;
|
||||
// msaa 4 samples, resolved: a horizontal line at y = 16 at widths 0.5, 1 and 2.
|
||||
//
|
||||
// WHAT IT MEASURED, Apple M3 Max, macOS 27.0.1 (every case's output is
|
||||
// `metal2vulkan-validation`'s `runtime_lane/line_widths_m3_max.txt`):
|
||||
//
|
||||
// - Each encoder starts at width 1; a width holds across draws and pipeline states.
|
||||
// - Metal draws w' = floor(16 w) / 16 clamped to [0, 16]: negative widths and NaN as 0, 16 and
|
||||
// above, infinity among them, as 16.
|
||||
// - At w' = 1 the diamond-exit lines; at every other w', below 1 too, the parallelogram whose
|
||||
// minor-axis edges pass through the endpoints, w' long and centred, its other edges parallel
|
||||
// to the segment, the ends not extended, a pixel drawn where its centre is inside (top-left
|
||||
// ties), the width not rounded; at w' = 0 exactly the pixel centres on the segment.
|
||||
// - A strip draws one parallelogram per segment, no joins: an overlap takes two fragments (at 1 a
|
||||
// shared vertex is drawn once).
|
||||
// - Triangles in fill mode Lines draw their edges so; fill mode Fill ignores the width.
|
||||
// - At 4 samples every width, 1 included, is the parallelogram at the sample positions.
|
||||
//
|
||||
// Run it WITHOUT MTL_DEBUG_LAYER, each case on the Mac's GPU lock:
|
||||
//
|
||||
// clang -fobjc-arc -framework Metal -framework Foundation -o line_widths line_widths.m
|
||||
// maclock /usr/bin/env -u MTL_DEBUG_LAYER ./line_widths lane
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Metal/Metal.h>
|
||||
#import <objc/message.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static NSString *kSource =
|
||||
@"#include <metal_stdlib>\n"
|
||||
"using namespace metal;\n"
|
||||
"struct Out { float4 position [[position]]; };\n"
|
||||
"vertex Out place(uint v [[vertex_id]], const device float2 *at [[buffer(0)]],\n"
|
||||
" constant float &half_side [[buffer(1)]]) {\n"
|
||||
" Out o; float2 p = at[v];\n"
|
||||
" o.position = float4(p.x / half_side - 1.0, 1.0 - p.y / half_side, 0.0, 1.0);\n"
|
||||
" return o;\n"
|
||||
"}\n"
|
||||
"fragment float4 white() { return float4(1.0); }\n"
|
||||
"fragment float4 one_count() { return float4(1.0 / 255.0); }\n";
|
||||
|
||||
static id<MTLDevice> gDevice;
|
||||
static id<MTLCommandQueue> gQueue;
|
||||
static id<MTLLibrary> gLibrary;
|
||||
|
||||
typedef enum { kWhite, kCount } Shade;
|
||||
|
||||
static id<MTLRenderPipelineState> pipeline(Shade shade, NSUInteger samples) {
|
||||
MTLRenderPipelineDescriptor *d = [MTLRenderPipelineDescriptor new];
|
||||
d.vertexFunction = [gLibrary newFunctionWithName:@"place"];
|
||||
d.fragmentFunction = [gLibrary newFunctionWithName:shade == kCount ? @"one_count" : @"white"];
|
||||
d.colorAttachments[0].pixelFormat = MTLPixelFormatRGBA8Unorm;
|
||||
d.rasterSampleCount = samples;
|
||||
if (shade == kCount) {
|
||||
MTLRenderPipelineColorAttachmentDescriptor *c = d.colorAttachments[0];
|
||||
c.blendingEnabled = YES;
|
||||
c.sourceRGBBlendFactor = c.sourceAlphaBlendFactor = MTLBlendFactorOne;
|
||||
c.destinationRGBBlendFactor = c.destinationAlphaBlendFactor = MTLBlendFactorOne;
|
||||
}
|
||||
NSError *error = nil;
|
||||
id<MTLRenderPipelineState> state = [gDevice newRenderPipelineStateWithDescriptor:d error:&error];
|
||||
if (!state) {
|
||||
fprintf(stderr, "pipeline: %s\n", error.localizedDescription.UTF8String);
|
||||
exit(1);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
static void set_width(id<MTLRenderCommandEncoder> e, float width) {
|
||||
((void (*)(id, SEL, float))objc_msgSend)(e, sel_registerName("setLineWidth:"), width);
|
||||
}
|
||||
|
||||
// One draw of an encoder: its primitive type, its points, and the width set before it (`set` 0
|
||||
// sets none).
|
||||
typedef struct {
|
||||
MTLPrimitiveType type;
|
||||
const float *points;
|
||||
int count;
|
||||
int set;
|
||||
float width;
|
||||
MTLTriangleFillMode fill;
|
||||
int new_pipeline;
|
||||
} Draw;
|
||||
|
||||
// Draws each encoder's draws on an S x S target of `samples` samples; `encoders[i]` draws are
|
||||
// `draws` from `starts[i]` to `starts[i + 1]`. Returns the red bytes.
|
||||
static uint8_t *render(int side, NSUInteger samples, Shade shade, const Draw *draws,
|
||||
const int *starts, int encoders) {
|
||||
MTLTextureDescriptor *td =
|
||||
[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA8Unorm
|
||||
width:side
|
||||
height:side
|
||||
mipmapped:NO];
|
||||
td.usage = MTLTextureUsageRenderTarget;
|
||||
td.storageMode = MTLStorageModeShared;
|
||||
id<MTLTexture> resolved = [gDevice newTextureWithDescriptor:td];
|
||||
id<MTLTexture> target = resolved;
|
||||
if (samples > 1) {
|
||||
td.textureType = MTLTextureType2DMultisample;
|
||||
td.sampleCount = samples;
|
||||
td.storageMode = MTLStorageModePrivate;
|
||||
target = [gDevice newTextureWithDescriptor:td];
|
||||
}
|
||||
id<MTLRenderPipelineState> a = pipeline(shade, samples);
|
||||
id<MTLRenderPipelineState> b = pipeline(shade, samples);
|
||||
float half_side = side / 2.0f;
|
||||
id<MTLCommandBuffer> cb = [gQueue commandBuffer];
|
||||
for (int e = 0; e < encoders; e++) {
|
||||
MTLRenderPassDescriptor *rp = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
rp.colorAttachments[0].texture = target;
|
||||
rp.colorAttachments[0].loadAction = e == 0 ? MTLLoadActionClear : MTLLoadActionLoad;
|
||||
rp.colorAttachments[0].clearColor = MTLClearColorMake(0, 0, 0, 0);
|
||||
if (samples > 1) {
|
||||
rp.colorAttachments[0].storeAction = MTLStoreActionStoreAndMultisampleResolve;
|
||||
rp.colorAttachments[0].resolveTexture = resolved;
|
||||
} else {
|
||||
rp.colorAttachments[0].storeAction = MTLStoreActionStore;
|
||||
}
|
||||
id<MTLRenderCommandEncoder> enc = [cb renderCommandEncoderWithDescriptor:rp];
|
||||
[enc setRenderPipelineState:a];
|
||||
[enc setVertexBytes:&half_side length:sizeof half_side atIndex:1];
|
||||
for (int i = starts[e]; i < starts[e + 1]; i++) {
|
||||
const Draw *d = &draws[i];
|
||||
if (d->set) set_width(enc, d->width);
|
||||
if (d->new_pipeline) [enc setRenderPipelineState:(i & 1) ? b : a];
|
||||
[enc setTriangleFillMode:d->fill];
|
||||
id<MTLBuffer> points = [gDevice newBufferWithBytes:d->points
|
||||
length:sizeof(float) * 2 * d->count
|
||||
options:MTLResourceStorageModeShared];
|
||||
[enc setVertexBuffer:points offset:0 atIndex:0];
|
||||
[enc drawPrimitives:d->type vertexStart:0 vertexCount:d->count];
|
||||
}
|
||||
[enc endEncoding];
|
||||
}
|
||||
[cb commit];
|
||||
[cb waitUntilCompleted];
|
||||
if (cb.error) {
|
||||
fprintf(stderr, "command buffer: %s\n", cb.error.localizedDescription.UTF8String);
|
||||
exit(1);
|
||||
}
|
||||
uint8_t *rgba = malloc((size_t)side * side * 4);
|
||||
[resolved getBytes:rgba
|
||||
bytesPerRow:side * 4
|
||||
fromRegion:MTLRegionMake2D(0, 0, side, side)
|
||||
mipmapLevel:0];
|
||||
uint8_t *red = malloc((size_t)side * side);
|
||||
for (int i = 0; i < side * side; i++) red[i] = rgba[4 * i];
|
||||
free(rgba);
|
||||
return red;
|
||||
}
|
||||
|
||||
// One draw alone in one encoder.
|
||||
static uint8_t *one(int side, NSUInteger samples, Shade shade, MTLPrimitiveType type,
|
||||
const float *points, int count, float width) {
|
||||
Draw d = {type, points, count, 1, width, MTLTriangleFillModeFill, 0};
|
||||
int starts[2] = {0, 1};
|
||||
return render(side, samples, shade, &d, starts, 1);
|
||||
}
|
||||
|
||||
static char cell(uint8_t v, Shade shade, NSUInteger samples) {
|
||||
if (v == 0) return '.';
|
||||
if (shade == kCount) return v < 10 ? (char)('0' + v) : '*';
|
||||
if (samples > 1) {
|
||||
// The samples covered, of `samples`: the resolve averages them.
|
||||
int k = (int)lround(v * (double)samples / 255.0);
|
||||
return (char)('0' + k);
|
||||
}
|
||||
return v == 255 ? '#' : '?';
|
||||
}
|
||||
|
||||
static void print_map(const char *title, int side, const uint8_t *r, Shade shade,
|
||||
NSUInteger samples) {
|
||||
int covered = 0;
|
||||
for (int i = 0; i < side * side; i++) covered += r[i] != 0;
|
||||
printf("MAP %s (%d pixels)\n", title, covered);
|
||||
for (int y = 0; y < side; y++) {
|
||||
int any = 0;
|
||||
for (int x = 0; x < side; x++) any |= r[y * side + x];
|
||||
if (!any) continue;
|
||||
printf("%3d ", y);
|
||||
for (int x = 0; x < side; x++) putchar(cell(r[y * side + x], shade, samples));
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
// The first and last row column `x` covers, or -1.
|
||||
static void rows(int side, const uint8_t *r, int x, int *first, int *last) {
|
||||
*first = *last = -1;
|
||||
for (int y = 0; y < side; y++) {
|
||||
if (!r[y * side + x]) continue;
|
||||
if (*first < 0) *first = y;
|
||||
*last = y;
|
||||
}
|
||||
}
|
||||
|
||||
static const float kWidths[] = {0, 0.5f, 1, 2, 3.5f, 8};
|
||||
|
||||
static void lane(void) {
|
||||
// The lane test's geometry, 16 x 16: two lines, and a strip of three vertices.
|
||||
static const float lines[] = {1, 3, 15, 3, 1, 8, 15, 15};
|
||||
static const float strip[] = {3.5f, 1, 3.5f, 9.5f, 13.5f, 14.5f};
|
||||
struct {
|
||||
const char *name;
|
||||
MTLPrimitiveType type;
|
||||
const float *points;
|
||||
int count;
|
||||
} draws[] = {
|
||||
{"lines", MTLPrimitiveTypeLine, lines, 4},
|
||||
{"strip", MTLPrimitiveTypeLineStrip, strip, 3},
|
||||
};
|
||||
for (int d = 0; d < 2; d++) {
|
||||
for (size_t w = 0; w < sizeof kWidths / sizeof kWidths[0]; w++) {
|
||||
uint8_t *r = one(16, 1, kWhite, draws[d].type, draws[d].points, draws[d].count, kWidths[w]);
|
||||
// Every row, so the lane test reads the whole target.
|
||||
printf("LANE %s %g\n", draws[d].name, kWidths[w]);
|
||||
for (int y = 0; y < 16; y++) {
|
||||
printf(" \"");
|
||||
for (int x = 0; x < 16; x++) putchar(cell(r[y * 16 + x], kWhite, 1));
|
||||
printf("\",\n");
|
||||
}
|
||||
free(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void quantize(void) {
|
||||
static const float horizontal[] = {4, 32, 60, 32};
|
||||
static const float vertical[] = {16.5f, 4, 16.5f, 28};
|
||||
float widths[64];
|
||||
int n = 0;
|
||||
// Either side of 1 and of each multiple of 1/16 near 1 and 3.
|
||||
for (int k = 2; k <= 14; k++) {
|
||||
widths[n++] = 1.0f + ldexpf(1.0f, -k);
|
||||
widths[n++] = 1.0f - ldexpf(1.0f, -k);
|
||||
}
|
||||
float more[] = {3, 3.03125f, 3.0625f, 3.09375f, 2.9375f, 2.96875f, 15.9375f, 15.96875f,
|
||||
16, 16.03125f, 16.0625f, 17, 100, 1e30f, INFINITY, -0.0f,
|
||||
-1, -INFINITY, NAN, 0.03125f, 0.0625f, 0.09375f, 0.125f};
|
||||
for (size_t i = 0; i < sizeof more / sizeof more[0]; i++) widths[n++] = more[i];
|
||||
for (int i = 0; i < n; i++) {
|
||||
uint8_t *h = one(64, 1, kWhite, MTLPrimitiveTypeLine, horizontal, 2, widths[i]);
|
||||
uint8_t *v = one(32, 1, kWhite, MTLPrimitiveTypeLine, vertical, 2, widths[i]);
|
||||
int hf, hl, vf, vl;
|
||||
rows(64, h, 32, &hf, &hl);
|
||||
rows(32, v, 16, &vf, &vl);
|
||||
printf("QUANTIZE width %.9g (bits %08x): horizontal y=32 rows %d..%d, vertical x=16.5 rows "
|
||||
"%d..%d\n",
|
||||
widths[i], *(uint32_t *)&widths[i], hf, hl, vf, vl);
|
||||
free(h);
|
||||
free(v);
|
||||
}
|
||||
}
|
||||
|
||||
static void state(void) {
|
||||
// Two horizontal lines, rows apart; each encoder draws them.
|
||||
static const float upper[] = {4, 8, 28, 8};
|
||||
static const float lower[] = {4, 20, 28, 20};
|
||||
// Encoder 0: width 4 set before the first draw, none before the second, which changes the
|
||||
// pipeline state. Encoder 1: no width set.
|
||||
Draw draws[] = {
|
||||
{MTLPrimitiveTypeLine, upper, 2, 1, 4, MTLTriangleFillModeFill, 0},
|
||||
{MTLPrimitiveTypeLine, lower, 2, 0, 0, MTLTriangleFillModeFill, 1},
|
||||
};
|
||||
int starts[2] = {0, 2};
|
||||
uint8_t *r = render(32, 1, kWhite, draws, starts, 1);
|
||||
print_map("width 4, then a draw of another pipeline state with no width set", 32, r, kWhite, 1);
|
||||
free(r);
|
||||
// A second encoder of the same command buffer, which sets nothing.
|
||||
static const float third[] = {4, 14, 28, 14};
|
||||
Draw two[] = {
|
||||
{MTLPrimitiveTypeLine, upper, 2, 1, 4, MTLTriangleFillModeFill, 0},
|
||||
{MTLPrimitiveTypeLine, third, 2, 0, 0, MTLTriangleFillModeFill, 0},
|
||||
};
|
||||
int starts2[3] = {0, 1, 2};
|
||||
r = render(32, 1, kWhite, two, starts2, 2);
|
||||
print_map("width 4 in encoder 0; encoder 1 sets none", 32, r, kWhite, 1);
|
||||
free(r);
|
||||
}
|
||||
|
||||
static void ties(void) {
|
||||
struct {
|
||||
const char *name;
|
||||
int side;
|
||||
float points[4];
|
||||
float width;
|
||||
} cases[] = {
|
||||
{"horizontal y=16 width 3", 32, {4, 16, 28, 16}, 3},
|
||||
{"horizontal y=16 width 0.5", 32, {4, 16, 28, 16}, 0.5f},
|
||||
{"horizontal y=16.5 width 0.5", 32, {4, 16.5f, 28, 16.5f}, 0.5f},
|
||||
{"horizontal y=16 width 3.5", 32, {4, 16, 28, 16}, 3.5f},
|
||||
{"horizontal y=16.5 width 3.5", 32, {4, 16.5f, 28, 16.5f}, 3.5f},
|
||||
{"ends on centres x 4.5 to 27.5 width 2", 32, {4.5f, 10, 27.5f, 10}, 2},
|
||||
{"ends on centres x 27.5 to 4.5 width 2", 32, {27.5f, 10, 4.5f, 10}, 2},
|
||||
{"ends on centres y 4.5 to 27.5 width 2", 32, {10, 4.5f, 10, 27.5f}, 2},
|
||||
{"ends on centres y 27.5 to 4.5 width 2", 32, {10, 27.5f, 10, 4.5f}, 2},
|
||||
{"45 degrees down-right width 4", 24, {4, 4, 20, 20}, 4},
|
||||
{"45 degrees up-left width 4", 24, {20, 20, 4, 4}, 4},
|
||||
{"45 degrees up-right width 4", 24, {4, 20, 20, 4}, 4},
|
||||
{"x-major diagonal width 8", 32, {2, 6, 30, 20}, 8},
|
||||
{"y-major width 3.5", 32, {8, 4, 20, 28}, 3.5f},
|
||||
};
|
||||
for (size_t i = 0; i < sizeof cases / sizeof cases[0]; i++) {
|
||||
uint8_t *r = one(cases[i].side, 1, kWhite, MTLPrimitiveTypeLine, cases[i].points, 2,
|
||||
cases[i].width);
|
||||
print_map(cases[i].name, cases[i].side, r, kWhite, 1);
|
||||
free(r);
|
||||
}
|
||||
}
|
||||
|
||||
static void zero(void) {
|
||||
struct {
|
||||
const char *name;
|
||||
float points[4];
|
||||
float width;
|
||||
} cases[] = {
|
||||
{"horizontal y=16.5 x 4.5 to 27.5 width 0", {4.5f, 16.5f, 27.5f, 16.5f}, 0},
|
||||
{"horizontal y=16.5 x 27.5 to 4.5 width 0", {27.5f, 16.5f, 4.5f, 16.5f}, 0},
|
||||
{"vertical x=16.5 y 4.5 to 27.5 width 0", {16.5f, 4.5f, 16.5f, 27.5f}, 0},
|
||||
{"diagonal through centres width 0", {4.5f, 4.5f, 28.5f, 16.5f}, 0},
|
||||
{"diagonal through centres reversed width 0", {28.5f, 16.5f, 4.5f, 4.5f}, 0},
|
||||
{"45 degrees through centres width 0", {4.5f, 4.5f, 20.5f, 20.5f}, 0},
|
||||
{"diagonal through centres width -3", {4.5f, 4.5f, 28.5f, 16.5f}, -3},
|
||||
{"diagonal through centres width NaN", {4.5f, 4.5f, 28.5f, 16.5f}, NAN},
|
||||
{"diagonal through centres width 0.0625", {4.5f, 4.5f, 28.5f, 16.5f}, 0.0625f},
|
||||
{"horizontal y=16 width 0 (through no centre)", {4, 16, 28, 16}, 0},
|
||||
{"horizontal y=16.5 x 4 to 28 width 0", {4, 16.5f, 28, 16.5f}, 0},
|
||||
};
|
||||
for (size_t i = 0; i < sizeof cases / sizeof cases[0]; i++) {
|
||||
uint8_t *r = one(32, 1, kWhite, MTLPrimitiveTypeLine, cases[i].points, 2, cases[i].width);
|
||||
print_map(cases[i].name, 32, r, kWhite, 1);
|
||||
free(r);
|
||||
}
|
||||
}
|
||||
|
||||
static void strips(void) {
|
||||
static const float corner[] = {4, 8.5f, 24.5f, 8.5f, 24.5f, 28};
|
||||
static const float peak[] = {4, 28, 16, 4, 28, 28};
|
||||
float widths[] = {1, 3.5f, 8, 0};
|
||||
for (size_t w = 0; w < sizeof widths / sizeof widths[0]; w++) {
|
||||
char title[96];
|
||||
uint8_t *r = one(32, 1, kCount, MTLPrimitiveTypeLineStrip, corner, 3, widths[w]);
|
||||
snprintf(title, sizeof title, "strip L width %g, fragments", widths[w]);
|
||||
print_map(title, 32, r, kCount, 1);
|
||||
free(r);
|
||||
r = one(32, 1, kCount, MTLPrimitiveTypeLineStrip, peak, 3, widths[w]);
|
||||
snprintf(title, sizeof title, "strip peak width %g, fragments", widths[w]);
|
||||
print_map(title, 32, r, kCount, 1);
|
||||
free(r);
|
||||
}
|
||||
}
|
||||
|
||||
static void fill(void) {
|
||||
static const float triangle[] = {4, 4, 28, 4, 16, 28};
|
||||
struct {
|
||||
MTLTriangleFillMode fill;
|
||||
float width;
|
||||
const char *name;
|
||||
} cases[] = {
|
||||
{MTLTriangleFillModeLines, 1, "triangle fill Lines width 1, fragments"},
|
||||
{MTLTriangleFillModeLines, 4, "triangle fill Lines width 4, fragments"},
|
||||
{MTLTriangleFillModeLines, 0, "triangle fill Lines width 0, fragments"},
|
||||
{MTLTriangleFillModeFill, 4, "triangle fill Fill width 4, fragments"},
|
||||
};
|
||||
for (size_t i = 0; i < sizeof cases / sizeof cases[0]; i++) {
|
||||
Draw d = {MTLPrimitiveTypeTriangle, triangle, 3, 1, cases[i].width, cases[i].fill, 0};
|
||||
int starts[2] = {0, 1};
|
||||
uint8_t *r = render(32, 1, kCount, &d, starts, 1);
|
||||
print_map(cases[i].name, 32, r, kCount, 1);
|
||||
free(r);
|
||||
}
|
||||
}
|
||||
|
||||
static void msaa(void) {
|
||||
static const float horizontal[] = {4, 16, 28, 16};
|
||||
static const float diagonal[] = {4, 4, 28, 20};
|
||||
float widths[] = {0.5f, 1, 2};
|
||||
for (size_t w = 0; w < sizeof widths / sizeof widths[0]; w++) {
|
||||
char title[96];
|
||||
uint8_t *r = one(32, 4, kWhite, MTLPrimitiveTypeLine, horizontal, 2, widths[w]);
|
||||
snprintf(title, sizeof title, "4 samples horizontal y=16 width %g, samples", widths[w]);
|
||||
print_map(title, 32, r, kWhite, 4);
|
||||
free(r);
|
||||
}
|
||||
uint8_t *r = one(32, 4, kWhite, MTLPrimitiveTypeLine, diagonal, 2, 1);
|
||||
print_map("4 samples diagonal width 1, samples", 32, r, kWhite, 4);
|
||||
free(r);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@autoreleasepool {
|
||||
struct {
|
||||
const char *name;
|
||||
void (*run)(void);
|
||||
} cases[] = {{"lane", lane}, {"quantize", quantize}, {"state", state},
|
||||
{"ties", ties}, {"zero", zero}, {"strips", strips},
|
||||
{"fill", fill}, {"msaa", msaa}};
|
||||
size_t n = sizeof cases / sizeof cases[0];
|
||||
if (argc < 2) {
|
||||
for (size_t i = 0; i < n; i++) printf("%s\n", cases[i].name);
|
||||
return 0;
|
||||
}
|
||||
gDevice = MTLCreateSystemDefaultDevice();
|
||||
NSError *error = nil;
|
||||
gLibrary = [gDevice newLibraryWithSource:kSource options:nil error:&error];
|
||||
if (!gLibrary) {
|
||||
fprintf(stderr, "library: %s\n", error.localizedDescription.UTF8String);
|
||||
return 1;
|
||||
}
|
||||
gQueue = [gDevice newCommandQueue];
|
||||
printf("DEVICE %s\n", gDevice.name.UTF8String);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
if (strcmp(argv[1], cases[i].name) == 0) {
|
||||
cases[i].run();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "no case %s\n", argv[1]);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,8 @@ pub enum Policy {
|
||||
/// `DevicePolicy::exact_answers()`: the accurate form of each of the runtime's
|
||||
/// speed-for-accuracy switches, which are all it selects — `heap_compression`
|
||||
/// `Uncompressed`, `completion` `Exact`, `batch_order` `Exact`, `render_lowering` `AtCall`,
|
||||
/// `host_page_textures` `Shadow`, `half_chains` `EachOperation` and `pipeline_waits` `Exact`.
|
||||
/// `host_page_textures` `Shadow`, `half_chains` `EachOperation`, `pipeline_waits` `Exact` and
|
||||
/// `wide_lines` `Exact`.
|
||||
Exact,
|
||||
/// The runtime's own defaults: the fast form of every choice, which is what a consumer runs.
|
||||
Default,
|
||||
|
||||
@@ -442,6 +442,31 @@ options.messages = Some(MessageSink::new(|message: &DebugMessage| {
|
||||
let device = Device::system_default_with(&options)?;
|
||||
```
|
||||
|
||||
## Line widths
|
||||
|
||||
Apple's private `setLineWidth:` (`RenderCommandEncoder::set_line_width`) takes every width. As
|
||||
measured on an Apple M3 Max (macOS 27.0.1), Metal draws `w' = floor(16 w) / 16` clamped to
|
||||
`[0, 16]` (NaN and negative widths as 0), the encoder's from 1 at its start: at `w' = 1` its
|
||||
ordinary lines, at every other `w'` the parallelogram Vulkan's non-strict wide lines may be (its
|
||||
minor-axis edges `w'` long through the endpoints, the ends not extended), at 0 the pixel centres on
|
||||
the segment. A strip or loop draws one parallelogram per segment; triangles in fill mode `Lines`
|
||||
draw their edges so. The runtime draws each draw at `w' != 1` by one of two routes, counted
|
||||
(`WorkCounts::device_wide_line_draws`, `line_band_draws`):
|
||||
|
||||
| Device | Route |
|
||||
|---|---|
|
||||
| `wideLines`, non-strict, parallelogram wide lines, `w' > 1` on the granularity | Its own lines, exactly Metal's |
|
||||
| `wideLines`, its lines otherwise (strict, not stated as parallelograms, `w' < 1`, off the granularity) | Its own lines, announced `device-wide-lines` (`WideLinePolicy::Device`, the default); under `WideLinePolicy::Exact` (`DevicePolicy::exact_answers()`) the band |
|
||||
| No `wideLines` (MoltenVK), `w'` outside `lineWidthRange`, or `w' = 0` | The band |
|
||||
|
||||
The band is the pipeline's band variant: two triangles over the parallelogram through a
|
||||
tessellation control and evaluation stage the translator adds (docs/API.md section 4), a strip or
|
||||
loop drawn as the list of its segments. Without `tessellationShader` a line the device's lines do
|
||||
not draw is refused `Unsupported` (`Feature::WideLines`, needing it). Refused
|
||||
`NotImplemented(RuntimeGap::WideLines)`: a triangle's edges in fill mode `Lines` and a mesh draw's
|
||||
lines the device's lines do not draw, an amplified band, and a wide line in an execution or a
|
||||
rasterization-rate-mapped pass. docs/FAST-PATHS.md records the choice and the known gaps.
|
||||
|
||||
## GPU families
|
||||
|
||||
`DeviceProperties` answers Metal's device queries from the Vulkan device.
|
||||
|
||||
@@ -102,6 +102,11 @@ impl Amplification {
|
||||
self.count == 0
|
||||
}
|
||||
|
||||
/// Whether a draw draws more than one amplification.
|
||||
pub(super) fn amplifies(&self) -> bool {
|
||||
self.count > 1
|
||||
}
|
||||
|
||||
/// Whether a mapping moves an amplification to another viewport.
|
||||
pub(super) fn offsets_viewports(&self) -> bool {
|
||||
self.mappings
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
//! each is the runtime's own.
|
||||
//!
|
||||
//! Exact means one of:
|
||||
//! - the call states Metal's default, which every runtime object already has: a line width of
|
||||
//! 1, the viewport transform on;
|
||||
//! - the call states Metal's default, which every runtime object already has: the viewport
|
||||
//! transform on;
|
||||
//! - the call sets encoder state the runtime draws as Metal does: a provoking vertex mode of 0
|
||||
//! or 1, `render/provoking.rs`;
|
||||
//! or 1, `render/provoking.rs`; a line width, `render/line_width.rs` (the device's own lines
|
||||
//! where they differ from Metal's are announced, `device-wide-lines`);
|
||||
//! - the call acts on state no runtime object has: Vulkan shows no texture compression, so a
|
||||
//! reinterpretation flush has nothing to flush, and after an invalidation Metal leaves the
|
||||
//! contents undefined, so keeping them is one of the outcomes Metal allows;
|
||||
@@ -29,8 +30,6 @@
|
||||
//! otherwise there (`provoking-vertex-unmatched`).
|
||||
//!
|
||||
//! Every other call is refused, and records nothing:
|
||||
//! - a line width other than 1 (Apple's wide-line rule is unmeasured, where Vulkan has
|
||||
//! `wideLines`);
|
||||
//! - a vertex amplification mode whose count is 0, which draws a number of copies that changes
|
||||
//! from run to run on Metal, or above 8 (9 draws one copy and 16 and 32 eight, the rest
|
||||
//! unmeasured), and one whose count passes the view mappings kept (unmeasured);
|
||||
@@ -72,8 +71,6 @@ pub enum AppleOnly {
|
||||
/// (`command_buffer/protection.rs`): options changed once an encoder was made under some, or
|
||||
/// after options from 0x10 up, and a resource state encoder made under 1, 3 or 7.
|
||||
ProtectedContent,
|
||||
/// A line width other than 1 (`setLineWidth:`).
|
||||
LineWidth,
|
||||
/// The viewport transform turned off (`setViewportTransformEnabled:NO`).
|
||||
ViewportTransformDisabled,
|
||||
/// `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the
|
||||
@@ -106,7 +103,6 @@ impl AppleOnly {
|
||||
pub const fn gap(self) -> AppleOnlyGap {
|
||||
match self {
|
||||
Self::ProtectedContent
|
||||
| Self::LineWidth
|
||||
| Self::ViewportTransformDisabled
|
||||
| Self::VertexAmplificationMode
|
||||
| Self::SurfaceClientDirection => AppleOnlyGap::Unmeasured,
|
||||
@@ -175,19 +171,19 @@ impl AppleOnlyCall {
|
||||
|
||||
/// The runtime's answer: `Ok` where it takes the call (it states Metal's default, acts on
|
||||
/// state no runtime object has, so it records nothing, or sets the encoder's provoking
|
||||
/// vertex, [`RenderCommandEncoder::set_provoking_vertex_mode`]), else the refusal naming the
|
||||
/// missing feature.
|
||||
/// vertex or line width, [`RenderCommandEncoder::set_provoking_vertex_mode`] and
|
||||
/// [`RenderCommandEncoder::set_line_width`]), else the refusal naming the missing feature.
|
||||
pub fn check(self) -> Result<(), AppleOnly> {
|
||||
match self {
|
||||
AppleOnlyCall::InvalidateCompressedTexture
|
||||
| AppleOnlyCall::InvalidateCompressedTextureSlice
|
||||
| AppleOnlyCall::CompressedTextureReinterpretationFlush
|
||||
| AppleOnlyCall::SetAlphaTestReferenceValue(_)
|
||||
| AppleOnlyCall::SetLineWidth(_)
|
||||
| AppleOnlyCall::SetPointSize(_)
|
||||
| AppleOnlyCall::SetProvokingVertexMode(_)
|
||||
| AppleOnlyCall::SetDepthCleared
|
||||
| AppleOnlyCall::SetStencilCleared => Ok(()),
|
||||
AppleOnlyCall::SetLineWidth(width) => default_or(width == 1.0, AppleOnly::LineWidth),
|
||||
AppleOnlyCall::SetViewportTransformEnabled(enabled) => {
|
||||
default_or(enabled, AppleOnly::ViewportTransformDisabled)
|
||||
}
|
||||
@@ -287,7 +283,9 @@ impl RenderLowering {
|
||||
/// The lowering of [`RenderCommandEncoder::set_line_width`].
|
||||
pub(crate) fn set_line_width(&mut self, width: f32) -> Result<(), Error> {
|
||||
self.log(|_| RenderCall::LineWidth(width));
|
||||
answer(AppleOnlyCall::SetLineWidth(width))
|
||||
answer(AppleOnlyCall::SetLineWidth(width))?;
|
||||
self.set_encoder_line_width(width);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The lowering of [`RenderCommandEncoder::set_point_size`].
|
||||
@@ -346,9 +344,21 @@ impl RenderCommandEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
/// `setLineWidth:` (SPI): accepted at Metal's default width of 1, which every line the
|
||||
/// runtime draws has; any other width is refused ([`AppleOnly::LineWidth`]): Apple's
|
||||
/// wide-line rule is unmeasured.
|
||||
/// `setLineWidth:` (SPI): the width the encoder's lines are drawn at after the call, until the
|
||||
/// next call or the encoder's end, each encoder starting at 1, as Metal draws it (the M3 Max,
|
||||
/// macOS 27.0.1): `floor(16 width) / 16` clamped to `[0, 16]`, NaN and every width not
|
||||
/// above 0 as 0. At 1 a line is Metal's ordinary one; at any other width the parallelogram
|
||||
/// whose minor-axis edges pass through the endpoints, each that width long, a strip's
|
||||
/// segments each their own; at 0 the pixel centres on the segment. Points and filled
|
||||
/// triangles do not change. Every width is accepted. A draw at another width than 1 runs the
|
||||
/// device's own lines where they draw it (announced `device-wide-lines` where they differ
|
||||
/// from Metal's, or under `WideLinePolicy::Exact` the band below where they do), else the
|
||||
/// pipeline's band variant, two triangles over the parallelogram, which needs
|
||||
/// `tessellationShader` (refused `Unsupported` without it). Refused at the draw
|
||||
/// (`NotImplemented(WideLines)`): a triangle's edges in fill mode `Lines` and a mesh draw
|
||||
/// where the device's lines do not draw the width, a line in a rasterization-rate-mapped
|
||||
/// pass or of an execution's command, and a band under vertex amplification above 1. The
|
||||
/// runtime's README states the route each device takes.
|
||||
pub fn set_line_width(&mut self, width: f32) -> Result<(), Error> {
|
||||
match self.lowers_at_call() {
|
||||
true => self.at_call(|lowering| lowering.set_line_width(width)),
|
||||
|
||||
@@ -2044,6 +2044,17 @@ degradations! {
|
||||
"the points rasterize nothing, the vertex function run for each, where what Metal \
|
||||
draws is undefined: most of its draws draw nothing, and some a few of the points \
|
||||
or a box";
|
||||
/// A draw of lines at a width other than 1 (Apple's `setLineWidth:`), or of a triangle's
|
||||
/// edges in fill mode `Lines` or of a mesh draw, drawn by the device's own lines
|
||||
/// (`render/line_width.rs`) where they are not Metal's parallelogram: strict lines (the
|
||||
/// rectangle the width spans across the segment, square ends), lines Vulkan does not state
|
||||
/// as parallelograms (`nonStrictWideLinesUseParallelogram` unset, or a width below 1), or a
|
||||
/// width off the device's `lineWidthGranularity`, which rounds it. Under
|
||||
/// `WideLinePolicy::Exact` a draw of lines takes the band variant there instead, on a
|
||||
/// device with `tessellationShader`.
|
||||
DeviceWideLines = "device-wide-lines", Precision,
|
||||
"the lines can cover pixels Metal's parallelogram does not, and miss others, at each \
|
||||
end and along each edge";
|
||||
/// A draw of lines, or an emulated mesh draw of lines, under Apple's last provoking vertex
|
||||
/// (`setProvokingVertexMode:` 1), of a pipeline state that reads it (a flat input, or a
|
||||
/// slice or viewport its vertex function selects), on a device without
|
||||
|
||||
@@ -1757,6 +1757,15 @@ pub enum RuntimeGap {
|
||||
/// form) where its list has no device address; and a draw over indices or from indirect
|
||||
/// arguments the index rewrite pass cannot draw, as for `RestartedStrip`.
|
||||
ProvokingVertex,
|
||||
/// A draw at a line width other than 1 (Apple's `setLineWidth:`) the runtime does not draw
|
||||
/// as Metal does (`render/line_width.rs`): a triangle's edges in fill mode `Lines`, and a mesh
|
||||
/// draw, where the device's own lines do not draw the width (no `wideLines`, or the width
|
||||
/// outside `lineWidthRange` or 0), which the band variant does not draw; a band under vertex
|
||||
/// amplification above 1; a line drawn in a rasterization-rate-mapped pass or as an
|
||||
/// execution's command, whose width Metal's answer is not measured for; and a line strip's
|
||||
/// band, drawn as the list of its segments, where that list cannot be drawn as Metal draws,
|
||||
/// as for `ProvokingVertex`.
|
||||
WideLines,
|
||||
/// An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads
|
||||
/// `[[primitive_id]]` on a device whose fragment stage cannot declare it (neither
|
||||
/// `geometryShader` nor `tessellationShader`), which draws its indices as vertices from 0 in
|
||||
|
||||
@@ -185,6 +185,10 @@ pub(crate) struct FixedState {
|
||||
/// `VkPipelineRasterizationProvokingVertexStateCreateInfoEXT` with
|
||||
/// `VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT`, never dynamic.
|
||||
pub(crate) provoking_last: bool,
|
||||
/// The `lineWidth` the draw rasterizes lines at, as `f32` bits: 1 but where a line Apple's
|
||||
/// `setLineWidth:` widens is drawn by the device's own lines (`render/line_width.rs`), never
|
||||
/// dynamic. A pipeline of another width than 1 chains no Bresenham line mode.
|
||||
pub(crate) line_width: u32,
|
||||
}
|
||||
|
||||
/// The depth clip and clamp of a draw through a viewport depth range past `[0, 1]`
|
||||
@@ -320,6 +324,8 @@ pub(crate) struct GraphicsContent {
|
||||
///
|
||||
/// [`bresenham_lines`]: metal2vulkan::device::VkFeature::BresenhamLines
|
||||
bresenham_lines: bool,
|
||||
/// `lineWidth` ([`FixedState::line_width`]).
|
||||
line_width: f32,
|
||||
cull_mode: vk::CullModeFlags,
|
||||
front_face: vk::FrontFace,
|
||||
depth_bias: bool,
|
||||
@@ -599,6 +605,7 @@ impl GraphicsContent {
|
||||
key.fixed.depth_clamp,
|
||||
key.fixed.polygon_mode,
|
||||
key.fixed.provoking_last,
|
||||
key.fixed.line_width,
|
||||
key.fixed.cull_mode,
|
||||
key.fixed.front_face,
|
||||
depth_bias,
|
||||
@@ -753,7 +760,7 @@ impl GraphicsContent {
|
||||
.cull_mode(self.cull_mode)
|
||||
.front_face(self.front_face)
|
||||
.depth_bias_enable(self.depth_bias)
|
||||
.line_width(1.0);
|
||||
.line_width(self.line_width);
|
||||
if self.depth_clip.is_some() {
|
||||
raster = raster.push_next(&mut depth_clip);
|
||||
}
|
||||
@@ -772,12 +779,14 @@ impl GraphicsContent {
|
||||
// takes the rectangle's own fill rule at the ends, so a line's first and last pixels and
|
||||
// every boundary pixel differ from Metal's (measured on llvmpipe and on an RTX 5080,
|
||||
// which both set it; MoltenVK does not, and its lines are Metal's own). Bresenham's mode
|
||||
// is Metal's rule, and every device profile this tree holds offers it.
|
||||
// is Metal's rule, and every device profile this tree holds offers it. A wider line is
|
||||
// the device's own (`render/line_width.rs`), in Vulkan's default mode.
|
||||
let mut line = vk::PipelineRasterizationLineStateCreateInfoEXT::default()
|
||||
.line_rasterization_mode(vk::LineRasterizationModeEXT::BRESENHAM);
|
||||
let multisample_allows_bresenham =
|
||||
!self.alpha_to_coverage && !self.alpha_to_one && !self.sample_shading;
|
||||
if self.bresenham_lines
|
||||
&& self.line_width == 1.0
|
||||
&& multisample_allows_bresenham
|
||||
&& rasterizes_lines(self.topology, self.polygon_mode)
|
||||
{
|
||||
@@ -995,9 +1004,13 @@ impl VariantObjects {
|
||||
})
|
||||
.collect();
|
||||
// Metal biases triangles only: the bias is enabled by the topology, and its factors are
|
||||
// dynamic state (`metal::state::depth_bias`).
|
||||
// dynamic state (`metal::state::depth_bias`). A band's patches are lines.
|
||||
let biased = match graphics.line_band {
|
||||
Some(_) => metal2vulkan::vk::PrimitiveTopology::LINE_LIST,
|
||||
None => key.topology,
|
||||
};
|
||||
let bias = metal2vulkan::metal::state::depth_bias(
|
||||
key.topology,
|
||||
biased,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
@@ -1077,6 +1090,7 @@ impl VariantObjects {
|
||||
.enabled()
|
||||
.features
|
||||
.contains(&metal2vulkan::device::VkFeature::BresenhamLines),
|
||||
line_width: f32::from_bits(key.fixed.line_width),
|
||||
cull_mode: key.fixed.cull_mode.into(),
|
||||
front_face: key.fixed.front_face.into(),
|
||||
depth_bias: bias.enable,
|
||||
@@ -1101,7 +1115,11 @@ impl VariantObjects {
|
||||
blends,
|
||||
blend_flags,
|
||||
logic_op: graphics.logic_op.map(Into::into),
|
||||
patch_control_points: graphics.tessellation.map(|t| t.patch_control_points),
|
||||
// A band's patches are each line's two vertices.
|
||||
patch_control_points: match graphics.line_band {
|
||||
Some(_) => Some(metal2vulkan::pipeline::LineBandState::PATCH_CONTROL_POINTS),
|
||||
None => graphics.tessellation.map(|t| t.patch_control_points),
|
||||
},
|
||||
meshes: pipeline
|
||||
.stages
|
||||
.iter()
|
||||
@@ -1378,6 +1396,7 @@ mod tests {
|
||||
depth_range: None,
|
||||
masks_color: false,
|
||||
provoking_last: false,
|
||||
line_width: 1.0_f32.to_bits(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,6 +352,8 @@ pub(super) use executions::DeferredPass;
|
||||
use executions::{PassInstance, PassStorage, RenderExecution, RunPasses};
|
||||
use extended_shadow::ExtendedShadows;
|
||||
pub use late_resolve::ResolveTarget;
|
||||
use line_width::LineRoute;
|
||||
pub(crate) use line_width::LineWidth;
|
||||
use metal2vulkan::bind::BindingPlan;
|
||||
use metal2vulkan::bind::VertexAmplification;
|
||||
use metal2vulkan::bind::{
|
||||
@@ -395,6 +397,7 @@ mod extended_shadow;
|
||||
mod inline_first;
|
||||
mod inline_splits;
|
||||
mod late_resolve;
|
||||
mod line_width;
|
||||
mod lowering_worker;
|
||||
mod mesh;
|
||||
mod mesh_arguments;
|
||||
@@ -888,6 +891,11 @@ struct DrawSettings {
|
||||
/// Its `VkPipeline` takes the last provoking vertex (`render/provoking.rs`,
|
||||
/// `FixedState::provoking_last`).
|
||||
provoking_last: bool,
|
||||
/// How it draws its lines at the encoder's width (`render/line_width.rs`).
|
||||
line: LineRoute,
|
||||
/// The band its band variant pushes (`BindState::line_band`): its Vulkan viewport 0's half
|
||||
/// extent and the band's half width, in pixels.
|
||||
line_band: Option<[f32; 4]>,
|
||||
}
|
||||
|
||||
/// The render encoder state one draw takes, statically or as dynamic state, in Vulkan's terms
|
||||
@@ -7237,9 +7245,16 @@ impl RenderLowering {
|
||||
// (`render/restart.rs`).
|
||||
// A draw under the last provoking vertex is drawn as a list on a device without it
|
||||
// (`render/provoking.rs`).
|
||||
let provoking = self.provoking(call, &pipeline, assembly, &draw);
|
||||
// A line Apple's `setLineWidth:` widens is drawn by the device's lines or as the
|
||||
// pipeline's band, a strip or loop listed as its segments (`render/line_width.rs`); an
|
||||
// execution's command is the runtime's gap there.
|
||||
let line = (self.shape_inputs()).line_route(call, (&pipeline, assembly), false)?;
|
||||
if self.replaying && line != LineRoute::Plain {
|
||||
return Err(Error::NotImplemented(RuntimeGap::WideLines));
|
||||
}
|
||||
let provoking = self.provoking(call, &pipeline, (assembly, line.band()), &draw);
|
||||
let provoking_forms = provoking.forms(assembly, &pipeline);
|
||||
let restarted = self.restarted(assembly, &draw, provoking);
|
||||
let restarted = self.restarted(assembly, &draw, (provoking, line.band()));
|
||||
let private = match (assembly, restarted) {
|
||||
(Assembly::Private(program), _) => PrivateForm::of(&pipeline, program, &draw),
|
||||
(_, Some(_)) => PrivateForm::listed(&draw),
|
||||
@@ -7330,6 +7345,11 @@ impl RenderLowering {
|
||||
self.core.device().shared().counts.provoking_listed_draw()
|
||||
}
|
||||
}
|
||||
match settings.line {
|
||||
LineRoute::Plain => {}
|
||||
LineRoute::Device { .. } => self.core.device().shared().counts.device_wide_line_draw(),
|
||||
LineRoute::Band { .. } => self.core.device().shared().counts.line_band_draw(),
|
||||
}
|
||||
self.give_up_extended_shadows(&pipeline, &live.state);
|
||||
// The draw's primitive type: a vertex function that writes the primitive ID divides by its
|
||||
// vertices per primitive (`PushField::VerticesPerPrimitive`), and an indexed strip of it
|
||||
@@ -8412,7 +8432,12 @@ impl RenderLowering {
|
||||
Next::Current => &self.current,
|
||||
Next::New { instance, .. } => &**instance,
|
||||
};
|
||||
// The class's list topology where the pipeline makes the topology dynamic.
|
||||
// The class's list topology where the pipeline makes the topology dynamic; a band's
|
||||
// patches of each line's two vertices (`render/line_width.rs`).
|
||||
let (topology, primitive_restart) = match settings.line {
|
||||
LineRoute::Band { .. } => (metal2vulkan::vk::PrimitiveTopology::PATCH_LIST, false),
|
||||
_ => (topology, primitive_restart),
|
||||
};
|
||||
let (keyed_topology, keyed_restart) =
|
||||
super::pipeline::keyed_assembly(topology, primitive_restart, &graphics.dynamic_states);
|
||||
// A mesh draw's own complete key (its threadgroup size), else the plan's.
|
||||
@@ -9780,6 +9805,7 @@ impl RenderLowering {
|
||||
settings.written_clamp.map(|w| w.range),
|
||||
Option::is_some,
|
||||
);
|
||||
reshape.shaped(&mut state.line_band, settings.line_band, Option::is_some);
|
||||
let colors = &settings.routed_colors;
|
||||
reshape.field_from(&mut state.zeroed_colors, &colors.zeroed);
|
||||
reshape.field(&mut state.primitive_id_indices, primitive_id_indices);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
//! `WorkCounts::draw_shapes_reused` counts the draws that reused all three.
|
||||
|
||||
use super::draw_problem;
|
||||
use super::line_width::LineRoute;
|
||||
use super::provoking;
|
||||
use super::{Assembly, DrawSettings, DrawState, Routed, RoutedColors};
|
||||
use crate::amplification::Amplification;
|
||||
@@ -420,7 +421,21 @@ impl ShapeInputs<'_> {
|
||||
// range (`clamp_draw_depth`).
|
||||
let compensated = compensation.is_some_and(|c| c.depth.is_some());
|
||||
let native = native && !compensated;
|
||||
let provoking_last = provoking::natively_last(device, self.state, (pipeline, assembly));
|
||||
// How it draws its lines at the encoder's width, and a band's push: Vulkan viewport 0's
|
||||
// half extent, its height negative as the Y-flipped viewport's is, and the half width
|
||||
// (`render/line_width.rs`). A band takes its flat inputs from its first vertex.
|
||||
let line = self.line_route(call, (pipeline, assembly), announce)?;
|
||||
let line_band = match line {
|
||||
LineRoute::Band { half } => {
|
||||
let viewports =
|
||||
EncoderState::vk_viewports(&self.state.used_viewports(false)[..1], None, None);
|
||||
let v = viewports[0];
|
||||
Some([v.width / 2.0, v.height / 2.0, half, 0.0])
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let provoking_last =
|
||||
!line.band() && provoking::natively_last(device, self.state, (pipeline, assembly));
|
||||
Ok(DrawSettings {
|
||||
unsized_points,
|
||||
topology,
|
||||
@@ -436,6 +451,8 @@ impl ShapeInputs<'_> {
|
||||
routing,
|
||||
routed_colors,
|
||||
provoking_last,
|
||||
line,
|
||||
line_band,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -530,6 +547,7 @@ impl ShapeInputs<'_> {
|
||||
let bias_effect = settings.bias;
|
||||
let mut fixed = self.draw_fixed(graphics, failing, (shadow, tests))?;
|
||||
fixed.provoking_last = settings.provoking_last;
|
||||
settings.line.fix(&mut fixed);
|
||||
// The depth the draw renders against: the pass's attachment's, or the hidden one's,
|
||||
// which Metal biases as the 32-bit float depth it is.
|
||||
let depth_format = self
|
||||
|
||||
@@ -269,6 +269,7 @@
|
||||
//! the encoder's own draw reads such a buffer at stride 0 (`render/vertex_strides.rs`).
|
||||
|
||||
use super::bound::Bound;
|
||||
use super::line_width::LineRoute;
|
||||
use super::mesh::MeshGrid;
|
||||
use super::pass_start_reads::{PassStartReads, PassStartTables};
|
||||
use super::pass_steps::PassSteps;
|
||||
@@ -1857,6 +1858,11 @@ impl RenderLowering {
|
||||
) -> Result<SettledDraw, Error> {
|
||||
let assembly = Assembly::Primitives(primitive_type);
|
||||
let settings = self.draw_settings(CALL, state, assembly, false)?;
|
||||
// A command's lines at a width other than 1 are the runtime's gap (`render/line_width.rs`),
|
||||
// which its replay refuses: nothing to make for it.
|
||||
if settings.line != LineRoute::Plain {
|
||||
return Err(Error::NotImplemented(RuntimeGap::WideLines));
|
||||
}
|
||||
let mut argument_samplers = ArgumentSamplers::taken(self.core.device());
|
||||
let function_tables = state.function_tables();
|
||||
let live = Arc::clone(&self.live);
|
||||
|
||||
@@ -73,6 +73,7 @@ use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::super::bound::{Bound, Recorded};
|
||||
use super::super::line_width::LineRoute;
|
||||
use super::super::pass_start_reads::PassStartTables;
|
||||
use super::super::provoking::ProvokingForms;
|
||||
use super::super::{Assembly, DrawBuffers, PrivateForm, Recording, RenderLowering};
|
||||
@@ -700,6 +701,12 @@ impl RenderLowering {
|
||||
}
|
||||
let settings =
|
||||
self.draw_settings(CALL, state, Assembly::Primitives(primitive_type), false)?;
|
||||
// Lines at a width other than 1 are the host replay's to refuse (`render/line_width.rs`).
|
||||
if settings.line != LineRoute::Plain {
|
||||
return Ok(Err(HostStepCause::Rule(
|
||||
"the encoder's line width is not 1",
|
||||
)));
|
||||
}
|
||||
if *self.current.shape.locations != *settings.routing.locations {
|
||||
let rule = "the inherited state's color outputs go to other locations than the pass's";
|
||||
return Ok(Err(HostStepCause::Rule(rule)));
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
//! The line width: Apple's `setLineWidth:`.
|
||||
//!
|
||||
//! Measured on the Apple M3 Max with macOS 27.0.1 (the consumer's probes and
|
||||
//! `crates/metal2vulkan-conformance/probes/line_widths.m`, single-sampled, every pixel of a 16x16
|
||||
//! and a 32x32 target):
|
||||
//!
|
||||
//! - The width is the encoder's: each encoder starts at 1, and a width holds across draws and
|
||||
//! pipeline states until the next call or the encoder's end.
|
||||
//! - Metal draws `w' = floor(16 w) / 16`, clamped to `[0, 16]`: a negative width, `-0` and NaN
|
||||
//! draw as 0, and 16 and above, infinity among them, as 16 ([`LineWidth::of`]).
|
||||
//! - At `w' = 1` a line is Metal's ordinary line, the half-open diamond-exit rule (the runtime's
|
||||
//! Bresenham lines). At every other `w'`, below 1 too, it is the parallelogram Vulkan's
|
||||
//! non-strict wide lines may be: its major axis the larger of the segment's framebuffer extents,
|
||||
//! x on a tie; its two minor-axis edges through the endpoints, each `w'` long and centred on
|
||||
//! its endpoint; its other two edges parallel to the segment; the ends not extended; a pixel
|
||||
//! drawn where its centre lies inside, by the polygon rules' ties (top and left edges in). The
|
||||
//! width is not rounded to whole pixels. At `w' = 0` a line draws exactly the pixel centres on
|
||||
//! the segment, by the same end rule.
|
||||
//! - A strip or loop draws one parallelogram per segment, with no joins: where two overlap a pixel
|
||||
//! takes two fragments (at `w' = 1` a shared vertex is drawn once, as the diamond rule's).
|
||||
//! - Triangles whose fill mode is `Lines` draw their edges by the same rule; in fill mode `Fill`
|
||||
//! the width changes nothing, nor for points.
|
||||
//!
|
||||
//! Not measured: other Apple GPUs; what a band's fragments read (their varyings and depth across
|
||||
//! the width); a width finer than 1/16; multisampled targets beyond 4 samples at width 1; an
|
||||
//! execution of indirect render commands' lines; a rasterization-rate-mapped pass's.
|
||||
//!
|
||||
//! The runtime draws each draw of lines by a route ([`LineRoute`]):
|
||||
//!
|
||||
//! - **Plain** at `w' = 1`, and for draws that draw no lines: as every line the runtime draws.
|
||||
//! - **Device**: the device's own lines at `w'` (`lineWidth`), where it enables `wideLines` and
|
||||
//! `w'` lies in its `lineWidthRange` and above 0. Exact where they are Metal's parallelogram:
|
||||
//! `strictLines` unset, `nonStrictWideLinesUseParallelogram` set (Vulkan states the shape only
|
||||
//! for widths above 1), and `w'` on `lineWidthGranularity` from the range's bottom. Elsewhere
|
||||
//! the device's line differs (a strict device's rectangle covers the pixels within half the
|
||||
//! width of the segment across it, square ends; a Bresenham one's columns; a width rounded to
|
||||
//! the granularity): announced (`Degradation::DeviceWideLines`), or under
|
||||
//! `WideLinePolicy::Exact` the band below, where it can draw.
|
||||
//! - **Band**: the pipeline's band variant (`VariantKey::line_band`, the translator's
|
||||
//! `pipeline::link::band`), two triangles per line over Metal's parallelogram, through a
|
||||
//! tessellation control and evaluation stage (`tessellationShader`). It is every other width's
|
||||
//! route: no `wideLines` (MoltenVK), `w'` outside the range, and `w' = 0`, which the band draws
|
||||
//! at half a width of `2^-subPixelPrecisionBits` (a pixel centre on the segment inside, one
|
||||
//! off it by more than the rasterizer's snapping outside). A strip or a loop is drawn as the list
|
||||
//! of its segments (`render/restart.rs`); a flat input under the last provoking vertex reads the
|
||||
//! list led by each line's last vertex (`render/provoking.rs`), which covers the same pixels, as
|
||||
//! the parallelogram is the same either way. Refused (`Unsupported`, `Feature::WideLines`,
|
||||
//! needing `tessellationShader`) without it.
|
||||
//!
|
||||
//! Refused (`NotImplemented(RuntimeGap::WideLines)`) at a width other than 1: the band of a
|
||||
//! triangle's edges in fill mode `Lines`, and of a mesh draw's lines, where the device's own lines
|
||||
//! do not draw the width; any line drawn in a rasterization-rate-mapped pass or as an execution's
|
||||
//! command (unmeasured); and a band under vertex amplification above 1 (its viewports).
|
||||
//!
|
||||
//! A multisampled target is drawn by the same routes: the band's triangles cover Metal's
|
||||
//! parallelogram at each sample, as a non-strict device's lines do (the Vulkan specification's
|
||||
//! Basic Line Segment Rasterization). Metal's width-1 lines there (the parallelogram at the
|
||||
//! samples) are drawn as the runtime's plain lines.
|
||||
|
||||
use super::draw_shape::ShapeInputs;
|
||||
use super::{Assembly, RenderLowering};
|
||||
use crate::degradation::Degradation;
|
||||
use crate::error::{Error, RuntimeGap};
|
||||
use crate::pipeline::{FixedState, GraphicsState as DrawingState};
|
||||
use metal2vulkan::bind::RewriteProgram;
|
||||
use metal2vulkan::device::{VkFeature, WideLinePolicy};
|
||||
use metal2vulkan::error::{Capability, Feature, Unsupported};
|
||||
use metal2vulkan::metal::{PrimitiveType, TriangleFillMode};
|
||||
use metal2vulkan::pipeline::LineBandState;
|
||||
use metal2vulkan::vk;
|
||||
|
||||
/// Metal's width of a line, `w'`: in sixteenths of a pixel, 0 to 256 (the module docs).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct LineWidth(u16);
|
||||
|
||||
impl LineWidth {
|
||||
/// Metal's default, every encoder's at its start.
|
||||
pub(crate) const ONE: LineWidth = LineWidth(16);
|
||||
|
||||
/// The width Metal draws for `setLineWidth:`'s `width`: `floor(16 width) / 16` in `[0, 16]`,
|
||||
/// NaN and every width not above 0 as 0.
|
||||
pub(crate) fn of(width: f32) -> LineWidth {
|
||||
if width.is_nan() || width <= 0.0 {
|
||||
return LineWidth(0);
|
||||
}
|
||||
if width >= 16.0 {
|
||||
return LineWidth(256);
|
||||
}
|
||||
// In `(0, 256)`: the cast truncates the floor exactly.
|
||||
LineWidth((width * 16.0).floor() as u16)
|
||||
}
|
||||
|
||||
/// The width in framebuffer pixels.
|
||||
pub(crate) fn pixels(self) -> f32 {
|
||||
f32::from(self.0) / 16.0
|
||||
}
|
||||
}
|
||||
|
||||
/// How a draw draws its lines at the encoder's width (the module docs).
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(super) enum LineRoute {
|
||||
/// As every line the runtime draws: Metal's width 1, or a draw of no lines.
|
||||
Plain,
|
||||
/// The device's own lines `width` pixels wide (`lineWidth`).
|
||||
Device { width: f32 },
|
||||
/// The pipeline's band variant, `half` pixels to each side of the segment.
|
||||
Band { half: f32 },
|
||||
}
|
||||
|
||||
impl LineRoute {
|
||||
/// Whether the draw runs the band variant.
|
||||
pub(super) fn band(self) -> bool {
|
||||
matches!(self, LineRoute::Band { .. })
|
||||
}
|
||||
|
||||
/// `fixed` as the route draws: the device's lines at their width; a band's triangles filled,
|
||||
/// uncullable and front-facing, as a line is (`LineBandState`).
|
||||
pub(super) fn fix(self, fixed: &mut FixedState) {
|
||||
match self {
|
||||
LineRoute::Plain => {}
|
||||
LineRoute::Device { width } => fixed.line_width = width.to_bits(),
|
||||
LineRoute::Band { .. } => {
|
||||
fixed.cull_mode = vk::CullModeFlags::NONE;
|
||||
fixed.front_face = LineBandState::FRONT_FACE;
|
||||
fixed.polygon_mode = vk::PolygonMode::FILL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What of a draw the width changes.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
enum Drawn {
|
||||
/// Nothing: points, filled triangles, a draw that rasterizes nothing.
|
||||
Nothing,
|
||||
/// Line primitives, which the band draws.
|
||||
Lines,
|
||||
/// Lines the band does not draw: a triangle's edges in fill mode `Lines`, an emulated mesh's
|
||||
/// lines, and a mesh draw's (whose lines the runtime does not tell from its triangles).
|
||||
Other,
|
||||
}
|
||||
|
||||
/// What `assembly`, drawn by `pipeline` in fill mode `fill`, draws that the width changes.
|
||||
fn drawn(pipeline: &DrawingState, assembly: Assembly, fill: TriangleFillMode) -> Drawn {
|
||||
let graphics = &pipeline.base().graphics;
|
||||
if graphics.rasterizer_discard {
|
||||
return Drawn::Nothing;
|
||||
}
|
||||
let edges = match fill {
|
||||
TriangleFillMode::Lines => Drawn::Other,
|
||||
_ => Drawn::Nothing,
|
||||
};
|
||||
match assembly {
|
||||
Assembly::Primitives(PrimitiveType::Point) => Drawn::Nothing,
|
||||
Assembly::Primitives(PrimitiveType::Line | PrimitiveType::LineStrip)
|
||||
| Assembly::Private(RewriteProgram::LineLoop) => Drawn::Lines,
|
||||
Assembly::Primitives(PrimitiveType::Triangle | PrimitiveType::TriangleStrip)
|
||||
| Assembly::Private(_)
|
||||
| Assembly::Patches => edges,
|
||||
Assembly::Meshes => match graphics.mesh_records.as_ref().map(|r| r.corners) {
|
||||
Some(1) => Drawn::Nothing,
|
||||
Some(2) | None => Drawn::Other,
|
||||
Some(_) => edges,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
impl ShapeInputs<'_> {
|
||||
/// The route `call`'s draw of `pipeline` as `assembly` draws its lines by at the encoder's
|
||||
/// width (the module docs), announcing a device line that differs from Metal's where
|
||||
/// `announce`. Refused as the module docs say.
|
||||
pub(super) fn line_route(
|
||||
&self,
|
||||
call: &'static str,
|
||||
(pipeline, assembly): (&DrawingState, Assembly),
|
||||
announce: bool,
|
||||
) -> Result<LineRoute, Error> {
|
||||
let width = self.state.line_width();
|
||||
let drawn = drawn(pipeline, assembly, self.state.fill_mode());
|
||||
if width == LineWidth::ONE || drawn == Drawn::Nothing {
|
||||
return Ok(LineRoute::Plain);
|
||||
}
|
||||
if self.rate_map.is_some() {
|
||||
return Err(Error::NotImplemented(RuntimeGap::WideLines));
|
||||
}
|
||||
let device = self.device;
|
||||
let profile = device.compile_device().profile();
|
||||
let enabled = profile.enabled();
|
||||
let limits = profile.limits();
|
||||
let w = width.pixels();
|
||||
let [low, high] = limits.line_width_range_bits.map(f32::from_bits);
|
||||
let granularity = f32::from_bits(limits.line_width_granularity_bits);
|
||||
let drawable = enabled.features.contains(&VkFeature::WideLines)
|
||||
&& w > 0.0
|
||||
&& (low..=high).contains(&w);
|
||||
// On the granularity's grid from the range's bottom: the widths the device draws
|
||||
// without rounding.
|
||||
let on_grid = granularity > 0.0 && {
|
||||
let steps = (w - low) / granularity;
|
||||
steps == steps.round()
|
||||
};
|
||||
let exact = drawable
|
||||
&& !limits.strict_lines
|
||||
&& limits.non_strict_wide_lines_use_parallelogram
|
||||
&& w > 1.0
|
||||
&& on_grid;
|
||||
let tessellates = enabled.features.contains(&VkFeature::TessellationShader);
|
||||
// Where the band can draw the draw's lines.
|
||||
let band = drawn == Drawn::Lines && tessellates && !self.amplification.amplifies();
|
||||
let policy = device.compile_device().policy().wide_lines;
|
||||
if exact || (drawable && (policy == WideLinePolicy::Device || !band)) {
|
||||
if !exact && announce {
|
||||
announce_device_lines(device, call, w);
|
||||
}
|
||||
return Ok(LineRoute::Device { width: w });
|
||||
}
|
||||
if !band {
|
||||
return Err(match drawn == Drawn::Lines && !tessellates {
|
||||
true => Error::Unsupported(Unsupported::needs(
|
||||
Feature::WideLines,
|
||||
Capability::Feature(VkFeature::TessellationShader),
|
||||
)),
|
||||
false => Error::NotImplemented(RuntimeGap::WideLines),
|
||||
});
|
||||
}
|
||||
let half = match width.0 {
|
||||
0 => (-(limits.sub_pixel_precision_bits as f32)).exp2(),
|
||||
_ => w / 2.0,
|
||||
};
|
||||
Ok(LineRoute::Band { half })
|
||||
}
|
||||
}
|
||||
|
||||
/// Announce `call`'s draw of lines `w` pixels wide by the device's own lines, which differ from
|
||||
/// Metal's parallelogram there (the module docs).
|
||||
fn announce_device_lines(device: &crate::Device, call: &'static str, w: f32) {
|
||||
let limits = device.compile_device().profile().limits();
|
||||
let [low, high] = limits.line_width_range_bits.map(f32::from_bits);
|
||||
let granularity = f32::from_bits(limits.line_width_granularity_bits);
|
||||
let parallelogram = limits.non_strict_wide_lines_use_parallelogram;
|
||||
let shape = match (limits.strict_lines, parallelogram) {
|
||||
(true, _) => "strict lines, the rectangle the width spans across the segment",
|
||||
(false, true) if w < 1.0 => "lines, whose shape below a width of 1 Vulkan leaves to it",
|
||||
(false, true) => "lines, which round the width to their granularity",
|
||||
(false, false) => "lines, which Vulkan does not state as parallelograms",
|
||||
};
|
||||
device.degrade(Degradation::DeviceWideLines, || {
|
||||
(
|
||||
format!("{call}: a draw of lines at setLineWidth: {w}"),
|
||||
format!(
|
||||
"the device draws them as its own {shape} (lineWidthRange [{low}, {high}], \
|
||||
lineWidthGranularity {granularity}), where Metal draws the parallelogram whose \
|
||||
minor-axis edges pass through the endpoints"
|
||||
),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
impl RenderLowering {
|
||||
/// The lowering of `setLineWidth:`'s `width`: the encoder's draws from here draw lines
|
||||
/// `LineWidth::of(width)` wide (the module docs).
|
||||
pub(crate) fn set_encoder_line_width(&mut self, width: f32) {
|
||||
let width = LineWidth::of(width);
|
||||
// Only a change takes the state to a new version (`versioned.rs`), so the draws' memo
|
||||
// holds across a call that repeats the width.
|
||||
if self.state.line_width() != width {
|
||||
self.state.set_line_width(width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::LineWidth;
|
||||
|
||||
/// The widths Metal draws for the widths measured (the module docs): floored to sixteenths,
|
||||
/// clamped to `[0, 16]`, NaN and every width not above 0 as 0.
|
||||
#[test]
|
||||
fn the_widths_are_metal_s_measured_ones() {
|
||||
let cases: [(f32, f32); 22] = [
|
||||
(1.0, 1.0),
|
||||
(1.0625, 1.0625),
|
||||
(1.03125, 1.0),
|
||||
(1.000_061, 1.0),
|
||||
(0.999_939, 0.9375),
|
||||
(0.9375, 0.9375),
|
||||
(3.0, 3.0),
|
||||
(3.03125, 3.0),
|
||||
(3.0625, 3.0625),
|
||||
(2.96875, 2.9375),
|
||||
(15.9375, 15.9375),
|
||||
(15.96875, 15.9375),
|
||||
(16.0, 16.0),
|
||||
(17.0, 16.0),
|
||||
(1e30, 16.0),
|
||||
(f32::INFINITY, 16.0),
|
||||
(-0.0, 0.0),
|
||||
(-1.0, 0.0),
|
||||
(f32::NEG_INFINITY, 0.0),
|
||||
(f32::NAN, 0.0),
|
||||
(0.0625, 0.0625),
|
||||
(0.03125, 0.0),
|
||||
];
|
||||
for (given, drawn) in cases {
|
||||
assert_eq!(LineWidth::of(given).pixels(), drawn, "{given}");
|
||||
}
|
||||
assert_eq!(LineWidth::of(1.0), LineWidth::ONE);
|
||||
}
|
||||
}
|
||||
@@ -332,12 +332,15 @@ impl RenderLowering {
|
||||
|
||||
/// How `call`'s `draw` of `pipeline` as `assembly` takes the encoder's provoking vertex (the
|
||||
/// module docs), announcing what a listed draw cannot draw as Metal does. A draw that makes
|
||||
/// no primitive draws nothing, as on Metal, and announces nothing ([`makes_none`]).
|
||||
/// no primitive draws nothing, as on Metal, and announces nothing ([`makes_none`]). A draw of
|
||||
/// lines as bands (`band`, `render/line_width.rs`), whose every corner takes a flat input
|
||||
/// from its line's first vertex, takes Metal's last vertex from the list led by each line's
|
||||
/// last vertex on every device, silently: the band covers the same pixels drawn either way.
|
||||
pub(super) fn provoking(
|
||||
&self,
|
||||
call: &'static str,
|
||||
pipeline: &DrawingState,
|
||||
assembly: Assembly,
|
||||
(assembly, band): (Assembly, bool),
|
||||
draw: &DrawCall,
|
||||
) -> Provoking {
|
||||
if !self.state.provoking_last() || makes_none(assembly, draw) {
|
||||
@@ -353,6 +356,12 @@ impl RenderLowering {
|
||||
if !(flat || weights) {
|
||||
return Provoking::AsIs;
|
||||
}
|
||||
if band {
|
||||
return match flat {
|
||||
true => Provoking::Listed(RewriteOrder::LastFirst),
|
||||
false => Provoking::AsIs,
|
||||
};
|
||||
}
|
||||
let device = self.core.device();
|
||||
if native(device) {
|
||||
// A strip's primitive ID computed into a varying reads its last vertex's stream
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
//!
|
||||
//! Under Apple's last provoking vertex, a device without it draws a line or triangle draw whose
|
||||
//! pipeline reads its primitives' vertex order as a list too, of a strip's pieces as above
|
||||
//! (`render/provoking.rs`). Every list is written in the draw's order: Metal's at the encoder's
|
||||
//! (`render/provoking.rs`); so is a line strip drawn as bands at a width other than 1
|
||||
//! (`render/line_width.rs`). Every list is written in the draw's order: Metal's at the encoder's
|
||||
//! provoking vertex mode, or led by each primitive's last vertex.
|
||||
|
||||
use super::provoking::Provoking;
|
||||
@@ -62,6 +63,7 @@ pub(super) enum ListGap {
|
||||
RestartedStrip,
|
||||
PrivatePrimitives,
|
||||
ProvokingVertex,
|
||||
WideLines,
|
||||
}
|
||||
|
||||
impl ListGap {
|
||||
@@ -71,6 +73,7 @@ impl ListGap {
|
||||
ListGap::RestartedStrip => RuntimeGap::RestartedStrip,
|
||||
ListGap::PrivatePrimitives => RuntimeGap::PrivatePrimitives,
|
||||
ListGap::ProvokingVertex => RuntimeGap::ProvokingVertex,
|
||||
ListGap::WideLines => RuntimeGap::WideLines,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,13 +100,14 @@ impl RenderLowering {
|
||||
/// says, is drawn as a list: a draw of a private type, which restarts (a quad strip over
|
||||
/// indices) at the encoder's `k'`, or its index type's all-ones index without a call; an
|
||||
/// indexed strip the encoder's call restarts at another index than Vulkan would, `k'` not its
|
||||
/// index type's all-ones index; and a draw of lines or triangles `provoking` lists. `None` for
|
||||
/// every other draw.
|
||||
/// index type's all-ones index; a draw of lines or triangles `provoking` lists; and a line
|
||||
/// strip drawn as bands (`band`, `render/line_width.rs`), whose patches are each line's two
|
||||
/// vertices. `None` for every other draw.
|
||||
pub(super) fn restarted(
|
||||
&self,
|
||||
assembly: Assembly,
|
||||
draw: &DrawCall,
|
||||
provoking: Provoking,
|
||||
(provoking, band): (Provoking, bool),
|
||||
) -> Option<Restarted> {
|
||||
let wide = match *draw {
|
||||
DrawCall::Indexed { index_type, .. }
|
||||
@@ -140,6 +144,9 @@ impl RenderLowering {
|
||||
if let Provoking::Listed(_) = provoking {
|
||||
return listed(program, ListGap::ProvokingVertex);
|
||||
}
|
||||
if band && program == RewriteProgram::LineStrip {
|
||||
return listed(program, ListGap::WideLines);
|
||||
}
|
||||
if !program.restarts() {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ use super::degradation::Degradation;
|
||||
use super::depth_stencil::{DepthStencilState, DepthUse};
|
||||
use super::error::{internal, invalid, Error, Problem, RuntimeGap};
|
||||
use super::pipeline::{DepthRange, FixedState};
|
||||
use super::render::LineWidth;
|
||||
use super::render_values::{ScissorRect, Viewport};
|
||||
use super::Device;
|
||||
use ash::vk;
|
||||
@@ -210,6 +211,9 @@ pub(super) struct EncoderState {
|
||||
/// The mode is past 1, which Metal draws a third way, the runtime as mode 1 but for patches
|
||||
/// (`render/provoking.rs`).
|
||||
provoking_third: bool,
|
||||
/// Apple's `setLineWidth:`, as Metal quantizes it (`render/line_width.rs`). Metal's default,
|
||||
/// and every new encoder's, is 1.
|
||||
line_width: LineWidth,
|
||||
}
|
||||
|
||||
impl EncoderState {
|
||||
@@ -247,6 +251,7 @@ impl EncoderState {
|
||||
clip_mode: DepthClipMode::Clip,
|
||||
provoking_last: false,
|
||||
provoking_third: false,
|
||||
line_width: LineWidth::ONE,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +351,21 @@ impl EncoderState {
|
||||
self.provoking_third
|
||||
}
|
||||
|
||||
/// `setLineWidth:`, as Metal quantizes it (`render/line_width.rs`).
|
||||
pub(super) fn set_line_width(&mut self, width: LineWidth) {
|
||||
self.line_width = width;
|
||||
}
|
||||
|
||||
/// The width the encoder's lines are drawn at.
|
||||
pub(super) fn line_width(&self) -> LineWidth {
|
||||
self.line_width
|
||||
}
|
||||
|
||||
/// `setTriangleFillMode:`'s mode.
|
||||
pub(super) fn fill_mode(&self) -> TriangleFillMode {
|
||||
self.fill_mode
|
||||
}
|
||||
|
||||
pub(super) fn set_winding(&mut self, winding: Winding) {
|
||||
self.winding = winding;
|
||||
}
|
||||
@@ -1123,6 +1143,7 @@ impl EncoderState {
|
||||
depth_range: None,
|
||||
masks_color: false,
|
||||
provoking_last: false,
|
||||
line_width: 1.0_f32.to_bits(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{AppleOnly, AppleOnlyCall, DEFAULT_PROTECTION_OPTIONS};
|
||||
#[test]
|
||||
fn every_apple_only_call_answers_typed() {
|
||||
use AppleOnlyCall as C;
|
||||
let table: [(&str, AppleOnlyCall, Result<(), AppleOnly>); 28] = [
|
||||
let table: [(&str, AppleOnlyCall, Result<(), AppleOnly>); 30] = [
|
||||
// Compressed-texture controls: no compression is visible on Vulkan.
|
||||
(
|
||||
"invalidateCompressedTexture:",
|
||||
@@ -32,22 +32,14 @@ fn every_apple_only_call_answers_typed() {
|
||||
C::SetAlphaTestReferenceValue(0.5),
|
||||
Ok(()),
|
||||
),
|
||||
// Every width: the encoder's lines are drawn at Metal's quantized width
|
||||
// (`render/line_width.rs`).
|
||||
("setLineWidth:", C::SetLineWidth(1.0), Ok(())),
|
||||
(
|
||||
"setLineWidth:",
|
||||
C::SetLineWidth(2.0),
|
||||
Err(AppleOnly::LineWidth),
|
||||
),
|
||||
(
|
||||
"setLineWidth:",
|
||||
C::SetLineWidth(0.5),
|
||||
Err(AppleOnly::LineWidth),
|
||||
),
|
||||
(
|
||||
"setLineWidth:",
|
||||
C::SetLineWidth(f32::NAN),
|
||||
Err(AppleOnly::LineWidth),
|
||||
),
|
||||
("setLineWidth:", C::SetLineWidth(2.0), Ok(())),
|
||||
("setLineWidth:", C::SetLineWidth(0.5), Ok(())),
|
||||
("setLineWidth:", C::SetLineWidth(f32::NAN), Ok(())),
|
||||
("setLineWidth:", C::SetLineWidth(-1.0), Ok(())),
|
||||
("setLineWidth:", C::SetLineWidth(f32::INFINITY), Ok(())),
|
||||
("setPointSize:", C::SetPointSize(1.0), Ok(())),
|
||||
("setPointSize:", C::SetPointSize(f32::NAN), Ok(())),
|
||||
(
|
||||
@@ -173,7 +165,6 @@ fn each_apple_only_refusal_names_its_gap() {
|
||||
use crate::AppleOnlyGap::Unmeasured;
|
||||
let table = [
|
||||
(AppleOnly::ProtectedContent, Unmeasured),
|
||||
(AppleOnly::LineWidth, Unmeasured),
|
||||
(AppleOnly::ViewportTransformDisabled, Unmeasured),
|
||||
(AppleOnly::VertexAmplificationMode, Unmeasured),
|
||||
(AppleOnly::SurfaceClientDirection, Unmeasured),
|
||||
|
||||
@@ -238,6 +238,8 @@ pub(crate) struct Counters {
|
||||
two_plane_draws: AtomicU64,
|
||||
provoking_last_pipeline_draws: AtomicU64,
|
||||
provoking_listed_draws: AtomicU64,
|
||||
device_wide_line_draws: AtomicU64,
|
||||
line_band_draws: AtomicU64,
|
||||
gathered_draws: AtomicU64,
|
||||
bounded_run_draws: AtomicU64,
|
||||
bound_notices_made: AtomicU64,
|
||||
@@ -1702,6 +1704,18 @@ impl Counters {
|
||||
self.provoking_listed_draws.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// A draw of lines at a width other than 1 ran the device's own lines at it
|
||||
/// (`render/line_width.rs`).
|
||||
pub(crate) fn device_wide_line_draw(&self) {
|
||||
self.device_wide_line_draws.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// A draw of lines at a width other than 1 ran the pipeline's band variant
|
||||
/// (`render/line_width.rs`).
|
||||
pub(crate) fn line_band_draw(&self) {
|
||||
self.line_band_draws.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// A direct indexed draw drawn as a list joined a run of the index gather pass, which writes
|
||||
/// the run's lists by one dispatch (`index_rewrite.rs`).
|
||||
pub(crate) fn gathered_draw(&self) {
|
||||
@@ -4123,6 +4137,13 @@ pub struct WorkCounts {
|
||||
/// without it, which drew the list of their primitives a GPU pass (or the CPU) wrote, in
|
||||
/// Metal's mode-1 order or led by each primitive's last vertex.
|
||||
pub provoking_listed_draws: u64,
|
||||
/// Draws of lines at a width other than 1 (Apple's `setLineWidth:`) that ran the device's own
|
||||
/// lines at that width (`lineWidth`), a triangle's edges in fill mode `Lines` and mesh draws
|
||||
/// among them.
|
||||
pub device_wide_line_draws: u64,
|
||||
/// Draws of lines at a width other than 1 that ran the pipeline's band variant
|
||||
/// (`VariantKey::line_band`): each line two triangles over Metal's parallelogram.
|
||||
pub line_band_draws: u64,
|
||||
/// Draws drawn as a list (a restarted strip's, a private primitive type's, or one led by its
|
||||
/// primitives' last vertices) whose list a run wrote: the index gather pass's (one dispatch
|
||||
/// for a run of direct indexed draws over one index buffer, or of indirect draws after one
|
||||
@@ -5422,6 +5443,8 @@ impl Device {
|
||||
.provoking_last_pipeline_draws
|
||||
.load(Ordering::Relaxed),
|
||||
provoking_listed_draws: counters.provoking_listed_draws.load(Ordering::Relaxed),
|
||||
device_wide_line_draws: counters.device_wide_line_draws.load(Ordering::Relaxed),
|
||||
line_band_draws: counters.line_band_draws.load(Ordering::Relaxed),
|
||||
gathered_draws: counters.gathered_draws.load(Ordering::Relaxed),
|
||||
bounded_run_draws: counters.bounded_run_draws.load(Ordering::Relaxed),
|
||||
bound_notices_made: counters.bound_notices_made.load(Ordering::Relaxed),
|
||||
|
||||
@@ -747,6 +747,8 @@
|
||||
"VkPhysicalDeviceProperties.limits.framebufferDepthSampleCounts",
|
||||
"VkPhysicalDeviceProperties.limits.framebufferNoAttachmentsSampleCounts",
|
||||
"VkPhysicalDeviceProperties.limits.framebufferStencilSampleCounts",
|
||||
"VkPhysicalDeviceProperties.limits.lineWidthGranularity",
|
||||
"VkPhysicalDeviceProperties.limits.lineWidthRange",
|
||||
"VkPhysicalDeviceProperties.limits.maxBoundDescriptorSets",
|
||||
"VkPhysicalDeviceProperties.limits.maxClipDistances",
|
||||
"VkPhysicalDeviceProperties.limits.maxCombinedClipAndCullDistances",
|
||||
@@ -789,6 +791,8 @@
|
||||
"VkPhysicalDeviceProperties.limits.minUniformBufferOffsetAlignment",
|
||||
"VkPhysicalDeviceProperties.limits.pointSizeRange",
|
||||
"VkPhysicalDeviceProperties.limits.storageImageSampleCounts",
|
||||
"VkPhysicalDeviceProperties.limits.strictLines",
|
||||
"VkPhysicalDeviceProperties.limits.subPixelPrecisionBits",
|
||||
"VkPhysicalDeviceVulkan11Properties.maxMemoryAllocationSize",
|
||||
"VkPhysicalDeviceVulkan11Properties.subgroupQuadOperationsInAllStages",
|
||||
"VkPhysicalDeviceVulkan12Properties.filterMinmaxSingleComponentFormats",
|
||||
@@ -2149,7 +2153,14 @@
|
||||
"pointSizeRange": [
|
||||
1.0,
|
||||
1.0
|
||||
]
|
||||
],
|
||||
"subPixelPrecisionBits": 4,
|
||||
"lineWidthRange": [
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"lineWidthGranularity": 0.0,
|
||||
"strictLines": false
|
||||
}
|
||||
},
|
||||
"VkPhysicalDeviceVulkan11Properties": {
|
||||
|
||||
@@ -1 +1 @@
|
||||
4fc5e9992a8fdf723b09b2c84b083b895fe8fa573fcda6d6674fc51995d9f6c4
|
||||
9ef7ac7badae9922b7538d34d11f1d7352aac0c5e430747f7a8bf70ce9f895a0
|
||||
@@ -1,47 +1,47 @@
|
||||
amd-780m-hawkpoint-radv device Stated 38f88d9d902bd817a24401fc6b9b4cd6eb5ca198fc38cf2f0f9c2ba77745956b members=148 extensions=50
|
||||
amd-780m-hawkpoint-radv device RobustnessOff 33935c8b0dafd696fa851fc9c2ba059d305cf506ab77c9db73e84315f20c14d0 members=144 extensions=50
|
||||
amd-780m-hawkpoint-radv restricted Stated 4930beacd926d90c600829175acf16cdb52bdf0e7eccf049029b78c19aad07f7 members=146 extensions=31
|
||||
amd-780m-hawkpoint-radv restricted RobustnessOff 605df746487d4c7acc3d8273217ce5d6bb2388f537e460455020c963956d0eeb members=142 extensions=31
|
||||
amd-780m-radv device Stated 38f88d9d902bd817a24401fc6b9b4cd6eb5ca198fc38cf2f0f9c2ba77745956b members=148 extensions=50
|
||||
amd-780m-radv device RobustnessOff 33935c8b0dafd696fa851fc9c2ba059d305cf506ab77c9db73e84315f20c14d0 members=144 extensions=50
|
||||
amd-780m-radv restricted Stated 4930beacd926d90c600829175acf16cdb52bdf0e7eccf049029b78c19aad07f7 members=146 extensions=31
|
||||
amd-780m-radv restricted RobustnessOff 605df746487d4c7acc3d8273217ce5d6bb2388f537e460455020c963956d0eeb members=142 extensions=31
|
||||
amd-rdna2-apu-radv device Stated 48bff6519545e5f753e291218562e14baa1e1b72deae8ba2a9aa1d274c055faf members=149 extensions=50
|
||||
amd-rdna2-apu-radv device RobustnessOff 336783642e0a4b71fb9c918e0b7f933f6f3562a48ff55daaed7b8461adf0edb9 members=145 extensions=50
|
||||
amd-rdna2-apu-radv restricted Stated 391e40db0eacf3012a43e0ddaeac81bf8e98bc79ccc172688b8dfd72c283d207 members=147 extensions=31
|
||||
amd-rdna2-apu-radv restricted RobustnessOff 054d93cec67456a8cb405a60865da2b3c179a9d0a5cb2906dd427c2c3327999d members=143 extensions=31
|
||||
amd-rdna3-radv device Stated 38f88d9d902bd817a24401fc6b9b4cd6eb5ca198fc38cf2f0f9c2ba77745956b members=148 extensions=50
|
||||
amd-rdna3-radv device RobustnessOff 33935c8b0dafd696fa851fc9c2ba059d305cf506ab77c9db73e84315f20c14d0 members=144 extensions=50
|
||||
amd-rdna3-radv restricted Stated 4930beacd926d90c600829175acf16cdb52bdf0e7eccf049029b78c19aad07f7 members=146 extensions=31
|
||||
amd-rdna3-radv restricted RobustnessOff 605df746487d4c7acc3d8273217ce5d6bb2388f537e460455020c963956d0eeb members=142 extensions=31
|
||||
gate-lavapipe device Stated 10d0c6ed616b56f6ae033e125db467bf52ef73eff121fb6da6a0ab6209cbb9b0 members=147 extensions=47
|
||||
gate-lavapipe device RobustnessOff 8f16dd46b82ac7024a1786a742663a80551b2c1e29ca6ce3ea2dde5a3d3b3088 members=143 extensions=47
|
||||
gate-lavapipe restricted Stated 55aa96698948ef8c873ae7910f74859eab4a70958b9a7d5e8268b2bdc5903368 members=145 extensions=28
|
||||
gate-lavapipe restricted RobustnessOff 8671ec23724098c215eba1398aa009f349d354643e3cee8944ce6793c0608724 members=141 extensions=28
|
||||
gate-lavapipe-x86_64 device Stated 10d0c6ed616b56f6ae033e125db467bf52ef73eff121fb6da6a0ab6209cbb9b0 members=147 extensions=47
|
||||
gate-lavapipe-x86_64 device RobustnessOff 8f16dd46b82ac7024a1786a742663a80551b2c1e29ca6ce3ea2dde5a3d3b3088 members=143 extensions=47
|
||||
gate-lavapipe-x86_64 restricted Stated 55aa96698948ef8c873ae7910f74859eab4a70958b9a7d5e8268b2bdc5903368 members=145 extensions=28
|
||||
gate-lavapipe-x86_64 restricted RobustnessOff 8671ec23724098c215eba1398aa009f349d354643e3cee8944ce6793c0608724 members=141 extensions=28
|
||||
intel-arl-anv device Stated 2a0a53459bc5a6413ad13df70289ace76ac2cb12dab14033523f1d2511299b6c members=146 extensions=48
|
||||
intel-arl-anv device RobustnessOff c7b1000f92a25fb08a48a090cf4669b6309055e649bb853eb87a45dad28bc9a5 members=142 extensions=48
|
||||
intel-arl-anv restricted Stated e1da92ab1b87f1f109371a0392444d267bfd180f61e0488b722d10e8ef1bcd8e members=144 extensions=29
|
||||
intel-arl-anv restricted RobustnessOff e40db0bb37973b43c21176b816f3e13291dbc7726f6831f4d12e65b61902a0fa members=140 extensions=29
|
||||
intel-irisxe-anv device Stated 205001cb11946f7627adbf2564fbf8e194ec457f30fdabd4badd47736308825f members=132 extensions=43
|
||||
intel-irisxe-anv device RobustnessOff 4fca69a1a25167deb5bb7c236a076075924336d0c8b1060695e4e8f15045857f members=128 extensions=43
|
||||
intel-irisxe-anv restricted Stated d465c6e4b1bde8420a0b22105e3950d56241bc3c46c54e1804dc84abeb577f12 members=130 extensions=24
|
||||
intel-irisxe-anv restricted RobustnessOff 5b84a110f2cf7489d01cf80ca59b5c08e3ecb12fe5f60efa59a9932d042b7472 members=126 extensions=24
|
||||
intel-irisxe-rplp-anv device Stated 205001cb11946f7627adbf2564fbf8e194ec457f30fdabd4badd47736308825f members=132 extensions=43
|
||||
intel-irisxe-rplp-anv device RobustnessOff 4fca69a1a25167deb5bb7c236a076075924336d0c8b1060695e4e8f15045857f members=128 extensions=43
|
||||
intel-irisxe-rplp-anv restricted Stated d465c6e4b1bde8420a0b22105e3950d56241bc3c46c54e1804dc84abeb577f12 members=130 extensions=24
|
||||
intel-irisxe-rplp-anv restricted RobustnessOff 5b84a110f2cf7489d01cf80ca59b5c08e3ecb12fe5f60efa59a9932d042b7472 members=126 extensions=24
|
||||
intel-uhd770-rpls-anv device Stated 205001cb11946f7627adbf2564fbf8e194ec457f30fdabd4badd47736308825f members=132 extensions=43
|
||||
intel-uhd770-rpls-anv device RobustnessOff 4fca69a1a25167deb5bb7c236a076075924336d0c8b1060695e4e8f15045857f members=128 extensions=43
|
||||
intel-uhd770-rpls-anv restricted Stated d465c6e4b1bde8420a0b22105e3950d56241bc3c46c54e1804dc84abeb577f12 members=130 extensions=24
|
||||
intel-uhd770-rpls-anv restricted RobustnessOff 5b84a110f2cf7489d01cf80ca59b5c08e3ecb12fe5f60efa59a9932d042b7472 members=126 extensions=24
|
||||
lavapipe device Stated 10d0c6ed616b56f6ae033e125db467bf52ef73eff121fb6da6a0ab6209cbb9b0 members=147 extensions=47
|
||||
lavapipe device RobustnessOff 8f16dd46b82ac7024a1786a742663a80551b2c1e29ca6ce3ea2dde5a3d3b3088 members=143 extensions=47
|
||||
lavapipe restricted Stated 55aa96698948ef8c873ae7910f74859eab4a70958b9a7d5e8268b2bdc5903368 members=145 extensions=28
|
||||
lavapipe restricted RobustnessOff 8671ec23724098c215eba1398aa009f349d354643e3cee8944ce6793c0608724 members=141 extensions=28
|
||||
amd-780m-hawkpoint-radv device Stated e1a77bbde2484e1a70b811c315b822fb2e689e8ddee2c10df542812139d89d9b members=149 extensions=50
|
||||
amd-780m-hawkpoint-radv device RobustnessOff 5b791cc1d16490dc58303f55cd9eb69f1523714e5bbb7bb7d02fb2eb8cbc4a44 members=145 extensions=50
|
||||
amd-780m-hawkpoint-radv restricted Stated 3081c6b9e62f49655d461eb16da6adfb3e5d2df70065278cfb386108b8fbd8bd members=147 extensions=31
|
||||
amd-780m-hawkpoint-radv restricted RobustnessOff 8d64c167ae96ccfe09a248c76d6b4c54abb5c72f5c22a3db3a1d31e202510dc0 members=143 extensions=31
|
||||
amd-780m-radv device Stated e1a77bbde2484e1a70b811c315b822fb2e689e8ddee2c10df542812139d89d9b members=149 extensions=50
|
||||
amd-780m-radv device RobustnessOff 5b791cc1d16490dc58303f55cd9eb69f1523714e5bbb7bb7d02fb2eb8cbc4a44 members=145 extensions=50
|
||||
amd-780m-radv restricted Stated 3081c6b9e62f49655d461eb16da6adfb3e5d2df70065278cfb386108b8fbd8bd members=147 extensions=31
|
||||
amd-780m-radv restricted RobustnessOff 8d64c167ae96ccfe09a248c76d6b4c54abb5c72f5c22a3db3a1d31e202510dc0 members=143 extensions=31
|
||||
amd-rdna2-apu-radv device Stated 8b96ad6184f54d7ae31cfe4676969f59f9663ab7f280cb9d6fb9b67b3646396b members=150 extensions=50
|
||||
amd-rdna2-apu-radv device RobustnessOff b0dd1d62542d0bf067e5c474446bd6194f925064a882f66e4c811e400db981f0 members=146 extensions=50
|
||||
amd-rdna2-apu-radv restricted Stated 20522afb81322bd408f7638449089b4c8ceacd7ade646f86872be31ee0662f75 members=148 extensions=31
|
||||
amd-rdna2-apu-radv restricted RobustnessOff e0b92e2e5dad46fdfa0a12fa0d770997a3fc7438b377d10d5d0638f3d8b23e18 members=144 extensions=31
|
||||
amd-rdna3-radv device Stated e1a77bbde2484e1a70b811c315b822fb2e689e8ddee2c10df542812139d89d9b members=149 extensions=50
|
||||
amd-rdna3-radv device RobustnessOff 5b791cc1d16490dc58303f55cd9eb69f1523714e5bbb7bb7d02fb2eb8cbc4a44 members=145 extensions=50
|
||||
amd-rdna3-radv restricted Stated 3081c6b9e62f49655d461eb16da6adfb3e5d2df70065278cfb386108b8fbd8bd members=147 extensions=31
|
||||
amd-rdna3-radv restricted RobustnessOff 8d64c167ae96ccfe09a248c76d6b4c54abb5c72f5c22a3db3a1d31e202510dc0 members=143 extensions=31
|
||||
gate-lavapipe device Stated 4f19925a3151c375f27de951de23a3b73de6efe353de934a712ca8f1ec50f6b4 members=148 extensions=47
|
||||
gate-lavapipe device RobustnessOff ac50e6fdc85116973dc6fef970e1d65bfbe938fb89e12bdace8fb9c04394acc0 members=144 extensions=47
|
||||
gate-lavapipe restricted Stated 261c049bb141cd8633aaa29c3f9e493e8ecd10f89677a1757f45c682ef761ac9 members=146 extensions=28
|
||||
gate-lavapipe restricted RobustnessOff ee644cbad16b1e04b502fa3c29fc8b34b8b796bf95d4c6afee476677b4ba2c04 members=142 extensions=28
|
||||
gate-lavapipe-x86_64 device Stated 4f19925a3151c375f27de951de23a3b73de6efe353de934a712ca8f1ec50f6b4 members=148 extensions=47
|
||||
gate-lavapipe-x86_64 device RobustnessOff ac50e6fdc85116973dc6fef970e1d65bfbe938fb89e12bdace8fb9c04394acc0 members=144 extensions=47
|
||||
gate-lavapipe-x86_64 restricted Stated 261c049bb141cd8633aaa29c3f9e493e8ecd10f89677a1757f45c682ef761ac9 members=146 extensions=28
|
||||
gate-lavapipe-x86_64 restricted RobustnessOff ee644cbad16b1e04b502fa3c29fc8b34b8b796bf95d4c6afee476677b4ba2c04 members=142 extensions=28
|
||||
intel-arl-anv device Stated 7792a2eb1eb6ee22ac2403b846458ceafee33469b2506145fc0163b4b755ebd6 members=147 extensions=48
|
||||
intel-arl-anv device RobustnessOff a6a2c2b943c1476aad999f5a7127c3e8ecc3dd4ee744b3c4378db351deb8b08c members=143 extensions=48
|
||||
intel-arl-anv restricted Stated 2edaabe9604d3bcf9421f1af63c8344193df6dac67f7528d5963909a4a420b76 members=145 extensions=29
|
||||
intel-arl-anv restricted RobustnessOff c25c29e3bfbe31a7f0324e5ab877a568ad5e6dec33c5256beb0731a9d824b098 members=141 extensions=29
|
||||
intel-irisxe-anv device Stated f156ba94479745028f0ba3fa016e362bac711a26beefa2431a3924bdf187d138 members=133 extensions=43
|
||||
intel-irisxe-anv device RobustnessOff 12d95ebaa04673f1c556eb988b9181e7140535be808a6ca3d544c96cf8e4d8ff members=129 extensions=43
|
||||
intel-irisxe-anv restricted Stated aef3e72e97297df5beb069fa2194ee3c2d8bec68dadcef673503bc24f84d98dc members=131 extensions=24
|
||||
intel-irisxe-anv restricted RobustnessOff 7c3f2767059e8cc8909e6e05e9bd31caba318584bddb73e098c92cb7a598460d members=127 extensions=24
|
||||
intel-irisxe-rplp-anv device Stated f156ba94479745028f0ba3fa016e362bac711a26beefa2431a3924bdf187d138 members=133 extensions=43
|
||||
intel-irisxe-rplp-anv device RobustnessOff 12d95ebaa04673f1c556eb988b9181e7140535be808a6ca3d544c96cf8e4d8ff members=129 extensions=43
|
||||
intel-irisxe-rplp-anv restricted Stated aef3e72e97297df5beb069fa2194ee3c2d8bec68dadcef673503bc24f84d98dc members=131 extensions=24
|
||||
intel-irisxe-rplp-anv restricted RobustnessOff 7c3f2767059e8cc8909e6e05e9bd31caba318584bddb73e098c92cb7a598460d members=127 extensions=24
|
||||
intel-uhd770-rpls-anv device Stated f156ba94479745028f0ba3fa016e362bac711a26beefa2431a3924bdf187d138 members=133 extensions=43
|
||||
intel-uhd770-rpls-anv device RobustnessOff 12d95ebaa04673f1c556eb988b9181e7140535be808a6ca3d544c96cf8e4d8ff members=129 extensions=43
|
||||
intel-uhd770-rpls-anv restricted Stated aef3e72e97297df5beb069fa2194ee3c2d8bec68dadcef673503bc24f84d98dc members=131 extensions=24
|
||||
intel-uhd770-rpls-anv restricted RobustnessOff 7c3f2767059e8cc8909e6e05e9bd31caba318584bddb73e098c92cb7a598460d members=127 extensions=24
|
||||
lavapipe device Stated 4f19925a3151c375f27de951de23a3b73de6efe353de934a712ca8f1ec50f6b4 members=148 extensions=47
|
||||
lavapipe device RobustnessOff ac50e6fdc85116973dc6fef970e1d65bfbe938fb89e12bdace8fb9c04394acc0 members=144 extensions=47
|
||||
lavapipe restricted Stated 261c049bb141cd8633aaa29c3f9e493e8ecd10f89677a1757f45c682ef761ac9 members=146 extensions=28
|
||||
lavapipe restricted RobustnessOff ee644cbad16b1e04b502fa3c29fc8b34b8b796bf95d4c6afee476677b4ba2c04 members=142 extensions=28
|
||||
lunarg-desktop-baseline-2023 device Stated 825caf82dbbe0316e466c6cc23baffcdef5844139a8af05f5722227f4f60ac3c members=52 extensions=4
|
||||
lunarg-desktop-baseline-2023 device RobustnessOff d0ecb668ab43ce73a07b7daf16a212cd4a96a4da5b4bcbf874e2c662d0a4961f members=49 extensions=4
|
||||
lunarg-desktop-baseline-2023 restricted Stated 825caf82dbbe0316e466c6cc23baffcdef5844139a8af05f5722227f4f60ac3c members=52 extensions=4
|
||||
@@ -50,18 +50,18 @@ moltenvk-m3 device Stated fba1f14799f8de2f3fce11270bfe5acfe70a9181fba05b39b03ca5
|
||||
moltenvk-m3 device RobustnessOff 0c0bcc4fe361e6c079eb1f7fb909f5041de30f9487e7350be2aed9287311f5f8 members=107 extensions=35
|
||||
moltenvk-m3 restricted Stated 29f45720a234e7d9a6d6539d970e098623a37105073f268b6c3f7d4d5e654e1f members=108 extensions=15
|
||||
moltenvk-m3 restricted RobustnessOff 53e3278fa6fb800af482ed20ad381506a95cad11f63a4b077db30d6fa9308e39 members=105 extensions=15
|
||||
nvidia-pascal-linux device Stated c7674b4d71e6f863769e9d37007b01e083fc8658de929d6f99d8131cdc40d14d members=136 extensions=39
|
||||
nvidia-pascal-linux device RobustnessOff 8e52f2a4cc133988dfd398498632fbe37cb4c05bd1c9c26ad7eb65956a3a4187 members=132 extensions=39
|
||||
nvidia-pascal-linux restricted Stated af2fe188ab5942d36181f9ac0c41e09891ee4fce4880eade674ff06bd962c8c2 members=134 extensions=20
|
||||
nvidia-pascal-linux restricted RobustnessOff 79068aee84c5416b1c9630f23e3d7a1ebd57a96ea8537d410d8d059dab2a194c members=130 extensions=20
|
||||
nvidia-rtx50-linux device Stated 5819497e11141f4fa9ff3c9dda0d22a5f536ef2b4174f09f077189caedd816f2 members=149 extensions=48
|
||||
nvidia-rtx50-linux device RobustnessOff 07ceaed8168a866dd0a57deec5ec5aeb384299ede39dfbb29fc78677887792cd members=145 extensions=48
|
||||
nvidia-rtx50-linux restricted Stated c052db07b32101a157f114cbba9a4324312868b75b67c1853b2ea17d3168c3e1 members=147 extensions=29
|
||||
nvidia-rtx50-linux restricted RobustnessOff 5c28a35d9e55428d74d8c6d82aabbf6729d64507cc41ee296587eac91e7de8c3 members=143 extensions=29
|
||||
nvidia-rtx5080-laptop device Stated 5819497e11141f4fa9ff3c9dda0d22a5f536ef2b4174f09f077189caedd816f2 members=149 extensions=48
|
||||
nvidia-rtx5080-laptop device RobustnessOff 07ceaed8168a866dd0a57deec5ec5aeb384299ede39dfbb29fc78677887792cd members=145 extensions=48
|
||||
nvidia-rtx5080-laptop restricted Stated c052db07b32101a157f114cbba9a4324312868b75b67c1853b2ea17d3168c3e1 members=147 extensions=29
|
||||
nvidia-rtx5080-laptop restricted RobustnessOff 5c28a35d9e55428d74d8c6d82aabbf6729d64507cc41ee296587eac91e7de8c3 members=143 extensions=29
|
||||
nvidia-pascal-linux device Stated 1ffe49b24502ec4bbf0ccdfbb84df366e61ea211b6a4b73ed6ef15d7bcf68024 members=137 extensions=39
|
||||
nvidia-pascal-linux device RobustnessOff 745991f4596a452f1df8ccf8f0f39b86c30aa860e5b8f888d311aa5b62c60338 members=133 extensions=39
|
||||
nvidia-pascal-linux restricted Stated ede644dba9a24a39976abf0a1ef05d71d99d7dd40523776de805c60bbb0612da members=135 extensions=20
|
||||
nvidia-pascal-linux restricted RobustnessOff c4218df17379d9cb9846174ef8a3a43c46795971eb053a0dda4ef480a0e9eb1d members=131 extensions=20
|
||||
nvidia-rtx50-linux device Stated c7772dd00c45d678cd39db5da4df11e004c4c6178a51286cc9788b3d34e62894 members=150 extensions=48
|
||||
nvidia-rtx50-linux device RobustnessOff dccc2d07c832839d14d6a0934230e09b6a0a01e7376de7f814efa7263b206878 members=146 extensions=48
|
||||
nvidia-rtx50-linux restricted Stated efa6a839a46c06d08ddfba1057190964e0346617779eaa63776dbb958c6c9280 members=148 extensions=29
|
||||
nvidia-rtx50-linux restricted RobustnessOff 0cd54b7bd80b37926c5ac25af4378694d9cdbaea43eb43ed88d1eeacc5788a85 members=144 extensions=29
|
||||
nvidia-rtx5080-laptop device Stated c7772dd00c45d678cd39db5da4df11e004c4c6178a51286cc9788b3d34e62894 members=150 extensions=48
|
||||
nvidia-rtx5080-laptop device RobustnessOff dccc2d07c832839d14d6a0934230e09b6a0a01e7376de7f814efa7263b206878 members=146 extensions=48
|
||||
nvidia-rtx5080-laptop restricted Stated efa6a839a46c06d08ddfba1057190964e0346617779eaa63776dbb958c6c9280 members=148 extensions=29
|
||||
nvidia-rtx5080-laptop restricted RobustnessOff 0cd54b7bd80b37926c5ac25af4378694d9cdbaea43eb43ed88d1eeacc5788a85 members=144 extensions=29
|
||||
roadmap-2022 device Stated f48b79c1c1cad271b4d28c86ed33b4b13e27a57c82615c68cb67c414aa7ffcd7 members=36 extensions=0
|
||||
roadmap-2022 device RobustnessOff 0bc8d68f81264767ba268cf3f276d82e0e695410ddd1cc93c9ca320c46b137e7 members=35 extensions=0
|
||||
roadmap-2022 restricted Stated fb16ead2e3ac58c5cba2f78babc11edde10e14091bd31e6a1dfd04999c7ec8b0 members=44 extensions=0
|
||||
|
||||
@@ -913,7 +913,8 @@ enum Bound {
|
||||
Implies,
|
||||
/// A `VkShaderFloatControlsIndependence`: no more independent than the device's.
|
||||
Independence,
|
||||
/// Describes execution, not capacity (the subgroup size): not compared.
|
||||
/// Describes execution, not capacity (the subgroup size; how lines rasterize, which the
|
||||
/// runtime reads to choose how it draws a wide line and never to refuse one): not compared.
|
||||
Execution,
|
||||
/// A size-control bound that a device without subgroup size control reports as 0 (no value):
|
||||
/// the profile's range must lie within the device's.
|
||||
@@ -964,6 +965,11 @@ fn bound(path: &[String]) -> Option<Bound> {
|
||||
fn limit_bound(name: &str) -> Option<Bound> {
|
||||
Some(match name {
|
||||
"min_interpolation_offset_bits" => Bound::FloatAtLeast,
|
||||
"line_width_range_bits"
|
||||
| "line_width_granularity_bits"
|
||||
| "strict_lines"
|
||||
| "non_strict_wide_lines_use_parallelogram"
|
||||
| "sub_pixel_precision_bits" => Bound::Execution,
|
||||
"min_texel_offset" | "min_texel_gather_offset" => Bound::AtLeast,
|
||||
"supports_non_zero_first_instance"
|
||||
| "independent_resolve_none"
|
||||
|
||||
@@ -565,6 +565,8 @@ mod level_sizes;
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
mod level_writes_by_usage;
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
mod line_widths;
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
mod linear_attachments;
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
mod linked_functions;
|
||||
|
||||
@@ -184,6 +184,7 @@ use super::indirect_dispatches::INDIRECT_DISPATCHES;
|
||||
use super::indirect_executions::{NIL_OFFSETS, RELEASED_STATES};
|
||||
use super::indirect_host_steps::HOST_STEPS;
|
||||
use super::kept_buffer_bytes::KEPT_BYTES;
|
||||
use super::line_widths::WIDE_LINES;
|
||||
use super::linear_attachments::{CHOSEN_COPIES, LINEAR_COPIES};
|
||||
use super::memoryless::MEMORYLESS_TEXEL_BUFFERS;
|
||||
use super::mesh_draws::EMULATED_MESH;
|
||||
@@ -518,6 +519,7 @@ fn every_kind_has_a_site_a_lane_test_takes() {
|
||||
&MIXED_RESOLVES,
|
||||
&EMULATED_MESH,
|
||||
&PROVOKING,
|
||||
&WIDE_LINES,
|
||||
&CAPPED_ANISOTROPY,
|
||||
&NOT_MIPMAPPED_ANISOTROPY,
|
||||
&IN_PLACE,
|
||||
|
||||
@@ -0,0 +1,945 @@
|
||||
//! Device tests of Apple's `setLineWidth:` (the runtime's `render/line_width.rs`) on the device the
|
||||
//! cfg selects, under the validation layer, against what plain Metal drew for
|
||||
//! `crates/metal2vulkan-conformance/probes/line_widths.m` on the Apple M3 Max, macOS 27.0.1: the
|
||||
//! probe's output, [`MEASURED`], pixel for pixel.
|
||||
//!
|
||||
//! Each case is one of the probe's, drawn as the probe draws it: the owned fixture
|
||||
//! `rt6_provoking`'s `pv_vertex_smooth` places each point at the clip-space position the probe's
|
||||
//! vertex function computes from its pixel coordinates (`(x / (S / 2) - 1, 1 - y / (S / 2))`, the
|
||||
//! same two `f32` operations), and `a2_front_facing`'s fragment function writes one color for a
|
||||
//! front-facing fragment and another for a back-facing one, into an `RGBA8Unorm` target: white,
|
||||
//! or `1/255` added for each fragment where the probe counts them. The map of what drew is printed
|
||||
//! as the probe prints it and compared with its map, and every fragment must be front-facing, as
|
||||
//! a line's is. The cases: the lane's 16x16 list of two lines and three-vertex strip at widths 0,
|
||||
//! 0.5, 1, 2, 3.5 and 8; the widths Metal quantizes; the width's encoder state; the band's edges
|
||||
//! and ends; width 0; strips' overlaps counted; filled triangles; and 4 samples at widths 0.5
|
||||
//! and 2.
|
||||
//!
|
||||
//! The work counts show which route each draw took (`WorkCounts::line_band_draws`,
|
||||
//! `device_wide_line_draws`): every draw at a width other than 1 takes one of the two, and on a
|
||||
//! device without `wideLines` the band. A draw the device's own lines draw otherwise than Metal is
|
||||
//! announced (`device-wide-lines`, at every occurrence here) and left unchecked; under
|
||||
//! `DevicePolicy::exact_answers()` no line draw is, where the device has `tessellationShader`.
|
||||
//! What the runtime refuses at a width other than 1 (a triangle's edges in fill mode `Lines` the
|
||||
//! device's lines do not draw; a line without `tessellationShader` or `wideLines`) is checked as
|
||||
//! refused. Not covered: Metal's width-1 lines on 4 samples (the probe's `msaa` width 1 and
|
||||
//! diagonal cases) where the device's lines are not Metal's own.
|
||||
|
||||
use super::{layer_reported_nothing_at_all, validated_device_with, Messages, ScratchCache, WAIT};
|
||||
use crate::air_library::AirLibrary;
|
||||
use crate::gpu::TEST_DEVICE;
|
||||
use metal2vulkan::device::{DevicePolicy, VkFeature};
|
||||
use metal2vulkan::error::{Capability, Feature, Needs};
|
||||
use metal2vulkan::metal::{BlendFactor, TriangleFillMode};
|
||||
use metal2vulkan::metal::{PixelFormat, PrimitiveType, TextureType, TextureUsage};
|
||||
use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource};
|
||||
use metal2vulkan_devtools::{engine_dir, llvm_assemble};
|
||||
use metal2vulkan_runtime::{
|
||||
ClearColor, CommandBufferStatus, CommandQueue, Degradation, Device, Error, Library, LoadAction,
|
||||
PipelineOptions, Region, RenderPassDescriptor, RenderPipelineState, ResourceOptions,
|
||||
RuntimeGap, StoreAction, TextureDescriptor,
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// What plain Metal drew for the probe, case by case (its output, as the probe prints it).
|
||||
const MEASURED: &str = include_str!("line_widths_m3_max.txt");
|
||||
|
||||
/// The kind the lane's runs take: a draw of lines at a width other than 1 that the device's own
|
||||
/// lines draw otherwise than Metal's parallelogram.
|
||||
pub(super) const WIDE_LINES: [Degradation; 1] = [Degradation::DeviceWideLines];
|
||||
|
||||
/// The probe's widths of the lane's draws.
|
||||
const LANE_WIDTHS: [f32; 6] = [0.0, 0.5, 1.0, 2.0, 3.5, 8.0];
|
||||
|
||||
/// How a case's fragments shade.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
enum Shade {
|
||||
/// Written whole: a pixel any fragment covered.
|
||||
White,
|
||||
/// `1/255` added for each fragment.
|
||||
Count,
|
||||
}
|
||||
|
||||
/// One draw of an encoder: its primitive type, its points in pixel coordinates (y down), the
|
||||
/// width set before it (`None`: none), its triangle fill mode, and whether it sets the other of
|
||||
/// the probe's two pipeline states first.
|
||||
#[derive(Clone, Debug)]
|
||||
struct Draw {
|
||||
primitive: PrimitiveType,
|
||||
points: Vec<[f32; 2]>,
|
||||
width: Option<f32>,
|
||||
fill: TriangleFillMode,
|
||||
other_pipeline: bool,
|
||||
}
|
||||
|
||||
impl Draw {
|
||||
fn line(primitive: PrimitiveType, points: &[f32], width: f32) -> Draw {
|
||||
Draw {
|
||||
primitive,
|
||||
points: points.chunks(2).map(|p| [p[0], p[1]]).collect(),
|
||||
width: Some(width),
|
||||
fill: TriangleFillMode::Fill,
|
||||
other_pipeline: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the draw draws lines at a width other than Metal's 1 (`floor(16 w) / 16` in
|
||||
/// `[0, 16]`, the probe's measured rule, written apart from the runtime's).
|
||||
fn wide(&self, width: f32) -> bool {
|
||||
let drawn = if width.is_nan() || width <= 0.0 {
|
||||
0.0
|
||||
} else {
|
||||
((width * 16.0).floor() / 16.0).min(16.0)
|
||||
};
|
||||
let lines = matches!(
|
||||
self.primitive,
|
||||
PrimitiveType::Line | PrimitiveType::LineStrip
|
||||
) || self.fill == TriangleFillMode::Lines;
|
||||
drawn != 1.0 && lines
|
||||
}
|
||||
}
|
||||
|
||||
/// One of the probe's renders: an `S x S` target of `samples` samples, cleared to zero, and the
|
||||
/// draws of each of its encoders, in one command buffer.
|
||||
#[derive(Clone, Debug)]
|
||||
struct Shot {
|
||||
side: u64,
|
||||
samples: u32,
|
||||
shade: Shade,
|
||||
encoders: Vec<Vec<Draw>>,
|
||||
}
|
||||
|
||||
impl Shot {
|
||||
fn one(side: u64, samples: u32, shade: Shade, draw: Draw) -> Shot {
|
||||
Shot {
|
||||
side,
|
||||
samples,
|
||||
shade,
|
||||
encoders: vec![vec![draw]],
|
||||
}
|
||||
}
|
||||
|
||||
/// The draws at a width other than 1, the encoder's width carried from draw to draw and
|
||||
/// reset to 1 at each encoder (the probe's `state` case).
|
||||
fn wide_draws(&self) -> u64 {
|
||||
let mut wide = 0;
|
||||
for draws in &self.encoders {
|
||||
let mut width = 1.0;
|
||||
for draw in draws {
|
||||
width = draw.width.unwrap_or(width);
|
||||
wide += u64::from(draw.wide(width));
|
||||
}
|
||||
}
|
||||
wide
|
||||
}
|
||||
}
|
||||
|
||||
/// The probe's cell for a pixel of red `v`: `.` none, `#` white, a digit the fragments counted or
|
||||
/// the samples covered.
|
||||
fn cell(v: u8, shade: Shade, samples: u32) -> char {
|
||||
if v == 0 {
|
||||
return '.';
|
||||
}
|
||||
if shade == Shade::Count {
|
||||
return match v {
|
||||
1..=9 => char::from(b'0' + v),
|
||||
_ => '*',
|
||||
};
|
||||
}
|
||||
if samples > 1 {
|
||||
let k = (f64::from(v) * f64::from(samples) / 255.0).round() as u8;
|
||||
return char::from(b'0' + k);
|
||||
}
|
||||
match v {
|
||||
255 => '#',
|
||||
_ => '?',
|
||||
}
|
||||
}
|
||||
|
||||
/// The probe's `MAP` block of `red`: its title and covered pixels, then each row any pixel of
|
||||
/// which is covered.
|
||||
fn map(title: &str, side: usize, red: &[u8], shade: Shade, samples: u32) -> String {
|
||||
let covered = red.iter().filter(|&&v| v != 0).count();
|
||||
let mut out = format!("MAP {title} ({covered} pixels)\n");
|
||||
for (y, row) in red.chunks(side).enumerate() {
|
||||
if row.iter().all(|&v| v == 0) {
|
||||
continue;
|
||||
}
|
||||
out.push_str(&format!("{y:3} "));
|
||||
out.extend(row.iter().map(|&v| cell(v, shade, samples)));
|
||||
out.push('\n');
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// The probe's `LANE` block of `red`: every row.
|
||||
fn lane_block(name: &str, width: f32, red: &[u8]) -> String {
|
||||
let mut out = format!("LANE {name} {width}\n");
|
||||
for row in red.chunks(16) {
|
||||
out.push_str(" \"");
|
||||
out.extend(row.iter().map(|&v| cell(v, Shade::White, 1)));
|
||||
out.push_str("\",\n");
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// [`MEASURED`]'s blocks: each `MAP` by its title (without its count), each `LANE` by its name and
|
||||
/// width, each with its lines; and each `QUANTIZE` line's rows by the width's bits.
|
||||
fn measured() -> (BTreeMap<String, String>, BTreeMap<u32, String>) {
|
||||
let mut blocks = BTreeMap::new();
|
||||
let mut quantized = BTreeMap::new();
|
||||
let mut open: Option<(String, String)> = None;
|
||||
for line in MEASURED.lines().filter(|l| !l.starts_with('#')) {
|
||||
if let Some(rest) = line.strip_prefix("QUANTIZE ") {
|
||||
let bits = rest.split("(bits ").nth(1).unwrap().get(..8).unwrap();
|
||||
let rows = rest.split("): ").nth(1).unwrap();
|
||||
quantized.insert(u32::from_str_radix(bits, 16).unwrap(), rows.to_owned());
|
||||
continue;
|
||||
}
|
||||
let key = match (line.strip_prefix("MAP "), line.strip_prefix("LANE ")) {
|
||||
(Some(title), _) => Some(title.rsplit_once(" (").unwrap().0.to_owned()),
|
||||
(_, Some(lane)) => Some(format!("LANE {lane}")),
|
||||
_ => None,
|
||||
};
|
||||
match key {
|
||||
Some(key) => {
|
||||
if let Some((k, text)) = open.take() {
|
||||
blocks.insert(k, text);
|
||||
}
|
||||
open = Some((key, format!("{line}\n")));
|
||||
}
|
||||
None => {
|
||||
let (_, text) = open.as_mut().expect("a row inside a block");
|
||||
text.push_str(line);
|
||||
text.push('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some((k, text)) = open {
|
||||
blocks.insert(k, text);
|
||||
}
|
||||
(blocks, quantized)
|
||||
}
|
||||
|
||||
/// The probe's `MAP` cases, each by its title: `ties`, `zero`, `strips`, `fill`, `msaa` and
|
||||
/// `state`, geometry for geometry.
|
||||
fn map_cases() -> Vec<(String, Shot)> {
|
||||
use PrimitiveType::{Line, LineStrip, Triangle};
|
||||
let mut out = Vec::new();
|
||||
let mut one = |title: &str, side, samples, shade, draw| {
|
||||
out.push((title.to_owned(), Shot::one(side, samples, shade, draw)));
|
||||
};
|
||||
let ties: [(&str, u64, [f32; 4], f32); 14] = [
|
||||
("horizontal y=16 width 3", 32, [4.0, 16.0, 28.0, 16.0], 3.0),
|
||||
(
|
||||
"horizontal y=16 width 0.5",
|
||||
32,
|
||||
[4.0, 16.0, 28.0, 16.0],
|
||||
0.5,
|
||||
),
|
||||
(
|
||||
"horizontal y=16.5 width 0.5",
|
||||
32,
|
||||
[4.0, 16.5, 28.0, 16.5],
|
||||
0.5,
|
||||
),
|
||||
(
|
||||
"horizontal y=16 width 3.5",
|
||||
32,
|
||||
[4.0, 16.0, 28.0, 16.0],
|
||||
3.5,
|
||||
),
|
||||
(
|
||||
"horizontal y=16.5 width 3.5",
|
||||
32,
|
||||
[4.0, 16.5, 28.0, 16.5],
|
||||
3.5,
|
||||
),
|
||||
(
|
||||
"ends on centres x 4.5 to 27.5 width 2",
|
||||
32,
|
||||
[4.5, 10.0, 27.5, 10.0],
|
||||
2.0,
|
||||
),
|
||||
(
|
||||
"ends on centres x 27.5 to 4.5 width 2",
|
||||
32,
|
||||
[27.5, 10.0, 4.5, 10.0],
|
||||
2.0,
|
||||
),
|
||||
(
|
||||
"ends on centres y 4.5 to 27.5 width 2",
|
||||
32,
|
||||
[10.0, 4.5, 10.0, 27.5],
|
||||
2.0,
|
||||
),
|
||||
(
|
||||
"ends on centres y 27.5 to 4.5 width 2",
|
||||
32,
|
||||
[10.0, 27.5, 10.0, 4.5],
|
||||
2.0,
|
||||
),
|
||||
(
|
||||
"45 degrees down-right width 4",
|
||||
24,
|
||||
[4.0, 4.0, 20.0, 20.0],
|
||||
4.0,
|
||||
),
|
||||
(
|
||||
"45 degrees up-left width 4",
|
||||
24,
|
||||
[20.0, 20.0, 4.0, 4.0],
|
||||
4.0,
|
||||
),
|
||||
(
|
||||
"45 degrees up-right width 4",
|
||||
24,
|
||||
[4.0, 20.0, 20.0, 4.0],
|
||||
4.0,
|
||||
),
|
||||
("x-major diagonal width 8", 32, [2.0, 6.0, 30.0, 20.0], 8.0),
|
||||
("y-major width 3.5", 32, [8.0, 4.0, 20.0, 28.0], 3.5),
|
||||
];
|
||||
for (title, side, points, width) in ties {
|
||||
one(
|
||||
title,
|
||||
side,
|
||||
1,
|
||||
Shade::White,
|
||||
Draw::line(Line, &points, width),
|
||||
);
|
||||
}
|
||||
let zero: [(&str, [f32; 4], f32); 11] = [
|
||||
(
|
||||
"horizontal y=16.5 x 4.5 to 27.5 width 0",
|
||||
[4.5, 16.5, 27.5, 16.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"horizontal y=16.5 x 27.5 to 4.5 width 0",
|
||||
[27.5, 16.5, 4.5, 16.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"vertical x=16.5 y 4.5 to 27.5 width 0",
|
||||
[16.5, 4.5, 16.5, 27.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"diagonal through centres width 0",
|
||||
[4.5, 4.5, 28.5, 16.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"diagonal through centres reversed width 0",
|
||||
[28.5, 16.5, 4.5, 4.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"45 degrees through centres width 0",
|
||||
[4.5, 4.5, 20.5, 20.5],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"diagonal through centres width -3",
|
||||
[4.5, 4.5, 28.5, 16.5],
|
||||
-3.0,
|
||||
),
|
||||
(
|
||||
"diagonal through centres width NaN",
|
||||
[4.5, 4.5, 28.5, 16.5],
|
||||
f32::NAN,
|
||||
),
|
||||
(
|
||||
"diagonal through centres width 0.0625",
|
||||
[4.5, 4.5, 28.5, 16.5],
|
||||
0.0625,
|
||||
),
|
||||
(
|
||||
"horizontal y=16 width 0 (through no centre)",
|
||||
[4.0, 16.0, 28.0, 16.0],
|
||||
0.0,
|
||||
),
|
||||
(
|
||||
"horizontal y=16.5 x 4 to 28 width 0",
|
||||
[4.0, 16.5, 28.0, 16.5],
|
||||
0.0,
|
||||
),
|
||||
];
|
||||
for (title, points, width) in zero {
|
||||
one(title, 32, 1, Shade::White, Draw::line(Line, &points, width));
|
||||
}
|
||||
let corner = [4.0, 8.5, 24.5, 8.5, 24.5, 28.0];
|
||||
let peak = [4.0, 28.0, 16.0, 4.0, 28.0, 28.0];
|
||||
for width in [1.0f32, 3.5, 8.0, 0.0] {
|
||||
for (name, points) in [("L", &corner), ("peak", &peak)] {
|
||||
let title = format!("strip {name} width {width}, fragments");
|
||||
one(
|
||||
&title,
|
||||
32,
|
||||
1,
|
||||
Shade::Count,
|
||||
Draw::line(LineStrip, points, width),
|
||||
);
|
||||
}
|
||||
}
|
||||
let triangle = [4.0, 4.0, 28.0, 4.0, 16.0, 28.0];
|
||||
for (fill, width, title) in [
|
||||
(
|
||||
TriangleFillMode::Lines,
|
||||
1.0,
|
||||
"triangle fill Lines width 1, fragments",
|
||||
),
|
||||
(
|
||||
TriangleFillMode::Lines,
|
||||
4.0,
|
||||
"triangle fill Lines width 4, fragments",
|
||||
),
|
||||
(
|
||||
TriangleFillMode::Lines,
|
||||
0.0,
|
||||
"triangle fill Lines width 0, fragments",
|
||||
),
|
||||
(
|
||||
TriangleFillMode::Fill,
|
||||
4.0,
|
||||
"triangle fill Fill width 4, fragments",
|
||||
),
|
||||
] {
|
||||
let mut draw = Draw::line(Triangle, &triangle, width);
|
||||
draw.fill = fill;
|
||||
one(title, 32, 1, Shade::Count, draw);
|
||||
}
|
||||
let horizontal = [4.0, 16.0, 28.0, 16.0];
|
||||
for width in [0.5f32, 2.0] {
|
||||
let title = format!("4 samples horizontal y=16 width {width}, samples");
|
||||
one(
|
||||
&title,
|
||||
32,
|
||||
4,
|
||||
Shade::White,
|
||||
Draw::line(Line, &horizontal, width),
|
||||
);
|
||||
}
|
||||
// `state`: width 4 before the first draw, none before the second, of the other pipeline
|
||||
// state; then width 4 in a first encoder, none in a second.
|
||||
let upper = Draw::line(Line, &[4.0, 8.0, 28.0, 8.0], 4.0);
|
||||
let unset = |points: &[f32]| Draw {
|
||||
width: None,
|
||||
..Draw::line(Line, points, 1.0)
|
||||
};
|
||||
let lower = Draw {
|
||||
other_pipeline: true,
|
||||
..unset(&[4.0, 20.0, 28.0, 20.0])
|
||||
};
|
||||
out.push((
|
||||
"width 4, then a draw of another pipeline state with no width set".to_owned(),
|
||||
Shot {
|
||||
side: 32,
|
||||
samples: 1,
|
||||
shade: Shade::White,
|
||||
encoders: vec![vec![upper.clone(), lower]],
|
||||
},
|
||||
));
|
||||
out.push((
|
||||
"width 4 in encoder 0; encoder 1 sets none".to_owned(),
|
||||
Shot {
|
||||
side: 32,
|
||||
samples: 1,
|
||||
shade: Shade::White,
|
||||
encoders: vec![vec![upper], vec![unset(&[4.0, 14.0, 28.0, 14.0])]],
|
||||
},
|
||||
));
|
||||
out
|
||||
}
|
||||
|
||||
/// The lane's device, queue and the probe's two pipeline states of each shade and sample count.
|
||||
struct Lane {
|
||||
device: Device,
|
||||
queue: CommandQueue,
|
||||
vertex: Library,
|
||||
fragment: Library,
|
||||
pipelines: BTreeMap<(Shade, u32), [RenderPipelineState; 2]>,
|
||||
}
|
||||
|
||||
/// What a shot drew: each pixel's red (front-facing fragments) and green (back-facing ones).
|
||||
struct Drawn {
|
||||
red: Vec<u8>,
|
||||
green: Vec<u8>,
|
||||
}
|
||||
|
||||
impl Lane {
|
||||
fn new(device: Device) -> Lane {
|
||||
let library = |name: &str| {
|
||||
let bitcode = llvm_assemble(&engine_dir().join(name)).unwrap();
|
||||
device.new_library_with_air(&bitcode).unwrap()
|
||||
};
|
||||
Lane {
|
||||
queue: device.new_command_queue().unwrap(),
|
||||
vertex: library("rt6_provoking.ll"),
|
||||
fragment: library("a2_front_facing.ll"),
|
||||
pipelines: BTreeMap::new(),
|
||||
device,
|
||||
}
|
||||
}
|
||||
|
||||
/// The probe's two pipeline states of `shade` and `samples` (alike, as the probe's `a` and
|
||||
/// `b` are).
|
||||
fn pipelines(&mut self, shade: Shade, samples: u32) -> [RenderPipelineState; 2] {
|
||||
let function = |library: &Library, name| {
|
||||
StageSource::Function(
|
||||
library
|
||||
.new_function_with_name(name)
|
||||
.unwrap()
|
||||
.function_descriptor(),
|
||||
)
|
||||
};
|
||||
let mut descriptor =
|
||||
RenderPipelineDescriptor::new(function(&self.vertex, "pv_vertex_smooth"));
|
||||
descriptor.fragment = Some(function(&self.fragment, "a2_front_facing"));
|
||||
descriptor.raster_sample_count = samples;
|
||||
let mut color = ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm);
|
||||
if shade == Shade::Count {
|
||||
color.blending_enabled = true;
|
||||
color.destination_rgb_blend_factor = BlendFactor::One;
|
||||
color.destination_alpha_blend_factor = BlendFactor::One;
|
||||
}
|
||||
descriptor.color_attachments[0] = Some(color);
|
||||
let device = &self.device;
|
||||
self.pipelines
|
||||
.entry((shade, samples))
|
||||
.or_insert_with(|| {
|
||||
[0, 1].map(|_| {
|
||||
device
|
||||
.new_render_pipeline_state(&descriptor, &PipelineOptions::default())
|
||||
.unwrap()
|
||||
})
|
||||
})
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// `shot` drawn, or the first refusal of its calls.
|
||||
fn draw(&mut self, shot: &Shot) -> Result<Drawn, Error> {
|
||||
let [a, b] = self.pipelines(shot.shade, shot.samples);
|
||||
let side = shot.side;
|
||||
let mut t = TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, side, side, false);
|
||||
t.usage = TextureUsage::RENDER_TARGET;
|
||||
t.resource_options = ResourceOptions::shared();
|
||||
let resolved = self.device.new_texture(&t).unwrap();
|
||||
let target = match shot.samples {
|
||||
1 => resolved.clone(),
|
||||
n => {
|
||||
t.texture_type = TextureType::Type2DMultisample;
|
||||
t.sample_count = u64::from(n);
|
||||
t.resource_options = ResourceOptions::private();
|
||||
self.device.new_texture(&t).unwrap()
|
||||
}
|
||||
};
|
||||
// A front-facing fragment writes red, a back-facing one green: white or one count each.
|
||||
let unit = match shot.shade {
|
||||
Shade::White => 1.0,
|
||||
Shade::Count => 1.0 / 255.0,
|
||||
};
|
||||
let colors: Vec<u8> = [unit, 0.0, 0.0, unit, 0.0, unit, 0.0, unit]
|
||||
.iter()
|
||||
.flat_map(|v: &f32| v.to_le_bytes())
|
||||
.collect();
|
||||
let half_side = side as f32 / 2.0;
|
||||
let command_buffer = self.queue.command_buffer()?;
|
||||
let mut index = 0;
|
||||
for (e, draws) in shot.encoders.iter().enumerate() {
|
||||
let mut pass = RenderPassDescriptor::new();
|
||||
let color = &mut pass.color_attachments[0];
|
||||
color.texture = Some(target.clone());
|
||||
color.load_action = match e {
|
||||
0 => LoadAction::Clear,
|
||||
_ => LoadAction::Load,
|
||||
};
|
||||
color.clear_color = ClearColor::new(0.0, 0.0, 0.0, 0.0);
|
||||
match shot.samples {
|
||||
1 => color.store_action = StoreAction::Store,
|
||||
_ => {
|
||||
color.resolve_texture = Some(resolved.clone());
|
||||
color.store_action = StoreAction::MultisampleResolve;
|
||||
}
|
||||
}
|
||||
let mut encoder = command_buffer.render_command_encoder(&pass)?;
|
||||
let drawn = (|| {
|
||||
encoder.set_render_pipeline_state(&a)?;
|
||||
encoder.set_fragment_bytes(&colors, 0)?;
|
||||
for draw in draws {
|
||||
if let Some(width) = draw.width {
|
||||
encoder.set_line_width(width)?;
|
||||
}
|
||||
if draw.other_pipeline {
|
||||
encoder.set_render_pipeline_state(if index & 1 == 1 { &b } else { &a })?;
|
||||
}
|
||||
encoder.set_triangle_fill_mode(draw.fill)?;
|
||||
// The probe's vertex function's arithmetic, in the same `f32` operations.
|
||||
let positions: Vec<u8> = draw
|
||||
.points
|
||||
.iter()
|
||||
.flat_map(|&[x, y]| [x / half_side - 1.0, 1.0 - y / half_side, 0.0, 1.0])
|
||||
.flat_map(f32::to_le_bytes)
|
||||
.collect();
|
||||
encoder.set_vertex_bytes(&positions, 0)?;
|
||||
encoder.draw_primitives(draw.primitive, 0, draw.points.len() as u32, 1, 0)?;
|
||||
index += 1;
|
||||
}
|
||||
Ok(())
|
||||
})();
|
||||
let ended = encoder.end_encoding();
|
||||
drawn.and(ended)?;
|
||||
}
|
||||
command_buffer.commit()?;
|
||||
command_buffer.wait_until_completed_for(WAIT).unwrap();
|
||||
assert_eq!(
|
||||
command_buffer.status(),
|
||||
CommandBufferStatus::Completed,
|
||||
"{shot:?}: {:?}",
|
||||
command_buffer.error()
|
||||
);
|
||||
let mut rgba = vec![0u8; (side * side * 4) as usize];
|
||||
resolved
|
||||
.get_bytes(
|
||||
&mut rgba,
|
||||
side * 4,
|
||||
0,
|
||||
Region::new_2d(0, 0, side, side),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
.unwrap();
|
||||
Ok(Drawn {
|
||||
red: rgba.chunks(4).map(|p| p[0]).collect(),
|
||||
green: rgba.chunks(4).map(|p| p[1]).collect(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// What a run found.
|
||||
#[derive(Debug, Default)]
|
||||
struct Found {
|
||||
/// Cases run: the lane's, the maps' and the quantized widths'.
|
||||
cases: usize,
|
||||
/// Of them, the cases that draw a triangle's edges at a width other than 1.
|
||||
edges: usize,
|
||||
/// Cases drawn as Metal drew them, pixel for pixel.
|
||||
matched: usize,
|
||||
/// Cases a device line drew otherwise than Metal, announced: left unchecked.
|
||||
announced: usize,
|
||||
/// Of them, the cases of a triangle's edges, which the band does not draw.
|
||||
announced_edges: usize,
|
||||
/// Cases refused, each as the runtime's docs say.
|
||||
refused: usize,
|
||||
/// Whether the device enables `tessellationShader`.
|
||||
tessellates: bool,
|
||||
}
|
||||
|
||||
/// The kinds of `messages`' notices since the last take, `DeviceWideLines` counted.
|
||||
fn announced_device_lines(messages: &Messages) -> usize {
|
||||
messages
|
||||
.take_notices()
|
||||
.iter()
|
||||
.filter_map(|m| m.degradation.as_ref())
|
||||
.filter(|notice| notice.degradation == Degradation::DeviceWideLines)
|
||||
.count()
|
||||
}
|
||||
|
||||
/// Every case of [`MEASURED`] on the cfg's device under `policy`: drawn as Metal drew it, or
|
||||
/// announced, or refused as the runtime's docs say; and each draw at a width other than 1 counted
|
||||
/// by a route.
|
||||
fn run(policy: DevicePolicy) -> Found {
|
||||
let cache = ScratchCache::new().unwrap();
|
||||
let messages = Messages::default();
|
||||
let mut found = Found::default();
|
||||
{
|
||||
let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), |options| {
|
||||
options.policy = policy;
|
||||
options.announce_each = WIDE_LINES.into_iter().collect();
|
||||
})
|
||||
.unwrap();
|
||||
let has = |feature| {
|
||||
device
|
||||
.compile_device()
|
||||
.profile()
|
||||
.enabled()
|
||||
.features
|
||||
.contains(&feature)
|
||||
};
|
||||
let (wide_lines, tessellates) = (
|
||||
has(VkFeature::WideLines),
|
||||
has(VkFeature::TessellationShader),
|
||||
);
|
||||
found.tessellates = tessellates;
|
||||
let name = device.name().to_owned();
|
||||
let mut lane = Lane::new(device);
|
||||
let (blocks, quantized) = measured();
|
||||
let mut cases: Vec<(String, Shot, Option<f32>)> = Vec::new();
|
||||
let lines = [1.0, 3.0, 15.0, 3.0, 1.0, 8.0, 15.0, 15.0];
|
||||
let strip = [3.5, 1.0, 3.5, 9.5, 13.5, 14.5];
|
||||
for (lane_name, primitive, points) in [
|
||||
("lines", PrimitiveType::Line, &lines[..]),
|
||||
("strip", PrimitiveType::LineStrip, &strip[..]),
|
||||
] {
|
||||
for width in LANE_WIDTHS {
|
||||
let draw = Draw::line(primitive, points, width);
|
||||
let key = format!("LANE {lane_name} {width}");
|
||||
cases.push((key, Shot::one(16, 1, Shade::White, draw), Some(width)));
|
||||
}
|
||||
}
|
||||
cases.extend(
|
||||
map_cases()
|
||||
.into_iter()
|
||||
.map(|(title, shot)| (title, shot, None)),
|
||||
);
|
||||
let mut bands = 0;
|
||||
let mut device_lines = 0;
|
||||
let mut wide = 0;
|
||||
let mut checked = std::collections::BTreeSet::new();
|
||||
for (key, shot, lane_width) in &cases {
|
||||
let edges = shot.encoders[0][0].fill == TriangleFillMode::Lines;
|
||||
found.edges += usize::from(edges && shot.wide_draws() > 0);
|
||||
let before = lane.device.work_counts();
|
||||
let drawn = lane.draw(shot);
|
||||
let after = lane.device.work_counts();
|
||||
let (band, own) = (
|
||||
after.line_band_draws - before.line_band_draws,
|
||||
after.device_wide_line_draws - before.device_wide_line_draws,
|
||||
);
|
||||
bands += band;
|
||||
device_lines += own;
|
||||
let announced = announced_device_lines(&messages);
|
||||
let drawn = match drawn {
|
||||
Ok(drawn) => drawn,
|
||||
Err(error) => {
|
||||
// A triangle's edges the device's lines do not draw; a line without
|
||||
// `tessellationShader` where the device's lines do not draw the width.
|
||||
match &error {
|
||||
Error::NotImplemented(RuntimeGap::WideLines) if edges => {}
|
||||
Error::Unsupported(u)
|
||||
if !tessellates && u.feature == Feature::WideLines => {}
|
||||
_ => panic!("{name}: {key}: {error}"),
|
||||
}
|
||||
found.refused += 1;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
assert_eq!(
|
||||
band + own,
|
||||
shot.wide_draws(),
|
||||
"{name}: {key}: a wide draw took no route"
|
||||
);
|
||||
wide += shot.wide_draws();
|
||||
if !wide_lines {
|
||||
assert_eq!(own, 0, "{name}: {key}: device lines without wideLines");
|
||||
}
|
||||
assert!(
|
||||
drawn.green.iter().all(|&g| g == 0),
|
||||
"{name}: {key}: back-facing fragments"
|
||||
);
|
||||
if announced > 0 {
|
||||
found.announced += 1;
|
||||
found.announced_edges += usize::from(edges);
|
||||
continue;
|
||||
}
|
||||
let side = shot.side as usize;
|
||||
let ours = match lane_width {
|
||||
Some(width) => lane_block(key.split(' ').nth(1).unwrap(), *width, &drawn.red),
|
||||
None => map(key, side, &drawn.red, shot.shade, shot.samples),
|
||||
};
|
||||
let metal = blocks
|
||||
.get(key)
|
||||
.unwrap_or_else(|| panic!("{key}: not among Metal's answers"));
|
||||
assert_eq!(&ours, metal, "{name}: {key}: drawn otherwise than Metal");
|
||||
checked.insert(key.clone());
|
||||
found.matched += 1;
|
||||
}
|
||||
// The quantized widths: the rows a horizontal line at y = 32 covers in column 32 of a
|
||||
// 64x64 target, and a vertical one at x = 16.5 in column 16 of a 32x32 one.
|
||||
for (bits, rows) in &quantized {
|
||||
let width = f32::from_bits(*bits);
|
||||
let mut first_last = Vec::new();
|
||||
for (side, points, column) in [
|
||||
(64, [4.0, 32.0, 60.0, 32.0], 32),
|
||||
(32, [16.5, 4.0, 16.5, 28.0], 16),
|
||||
] {
|
||||
let shot = Shot::one(
|
||||
side,
|
||||
1,
|
||||
Shade::White,
|
||||
Draw::line(PrimitiveType::Line, &points, width),
|
||||
);
|
||||
let drawn = lane
|
||||
.draw(&shot)
|
||||
.unwrap_or_else(|e| panic!("{name}: width {width}: {e}"));
|
||||
let covered: Vec<usize> = (0..side as usize)
|
||||
.filter(|y| drawn.red[y * side as usize + column] != 0)
|
||||
.collect();
|
||||
let (first, last) = match (covered.first(), covered.last()) {
|
||||
(Some(&f), Some(&l)) => (f as i64, l as i64),
|
||||
_ => (-1, -1),
|
||||
};
|
||||
first_last.push((first, last));
|
||||
}
|
||||
if announced_device_lines(&messages) > 0 {
|
||||
found.announced += 1;
|
||||
continue;
|
||||
}
|
||||
let [(hf, hl), (vf, vl)] = [first_last[0], first_last[1]];
|
||||
let ours = format!("horizontal y=32 rows {hf}..{hl}, vertical x=16.5 rows {vf}..{vl}");
|
||||
assert_eq!(&ours, rows, "{name}: width {width} ({bits:08x})");
|
||||
found.matched += 1;
|
||||
}
|
||||
found.cases = cases.len() + quantized.len();
|
||||
assert_eq!(
|
||||
found.matched + found.announced + found.refused,
|
||||
found.cases,
|
||||
"{found:?}"
|
||||
);
|
||||
// Every measured map was drawn or accounted for.
|
||||
assert!(
|
||||
checked.len() + found.announced + found.refused >= blocks.len() - 2,
|
||||
"{found:?}"
|
||||
);
|
||||
eprintln!(
|
||||
"{name} (wideLines {wide_lines}, tessellationShader {tessellates}, {policy:?}): {found:?}; \
|
||||
{bands} draws as bands, {device_lines} by the device's lines"
|
||||
);
|
||||
// The routes ran: every wide draw drawn took one, a band wherever the device has no
|
||||
// wide lines.
|
||||
assert!(
|
||||
wide > 0 && bands + device_lines == wide,
|
||||
"{bands} {device_lines} {wide}"
|
||||
);
|
||||
if !wide_lines {
|
||||
assert_eq!(bands, wide);
|
||||
}
|
||||
}
|
||||
layer_reported_nothing_at_all(&messages);
|
||||
found
|
||||
}
|
||||
|
||||
/// Every case under the default policy: the device's own lines where they draw the width,
|
||||
/// announced where they draw it otherwise than Metal, else the band.
|
||||
#[test]
|
||||
fn wide_lines_draw_metal_s_parallelograms() {
|
||||
let found = run(DevicePolicy::default());
|
||||
// Width 1 draws as Metal's on every device; on one whose own lines differ from Metal's at
|
||||
// no width drawn, every case but the edges does.
|
||||
assert!(found.matched > 0, "{found:?}");
|
||||
if found.tessellates && found.announced == found.announced_edges {
|
||||
assert_eq!(found.matched, found.cases - found.edges, "{found:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Every case under `DevicePolicy::exact_answers()`: the band wherever the device's lines differ
|
||||
/// from Metal's, so no draw of lines is announced on a device with `tessellationShader`.
|
||||
#[test]
|
||||
fn wide_lines_draw_metal_s_parallelograms_under_exact_answers() {
|
||||
let found = run(DevicePolicy::default().exact_answers());
|
||||
assert!(found.matched > 0, "{found:?}");
|
||||
// Edges aside, which the band does not draw: drawn by the device's lines (announced) where
|
||||
// they draw the width, else refused.
|
||||
if found.tessellates {
|
||||
assert_eq!(found.announced, found.announced_edges, "{found:?}");
|
||||
assert_eq!(found.matched, found.cases - found.edges, "{found:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The lane's maps Metal drew at each width, the list's and the strip's together, differ from
|
||||
/// every other width's (the strip alone draws alike at 0 and 0.5, through pixel centres): the
|
||||
/// comparison tells the widths apart, so a draw at another width than the case's fails it.
|
||||
#[test]
|
||||
fn the_lane_s_maps_tell_the_widths_apart() {
|
||||
let (blocks, _) = measured();
|
||||
let maps: Vec<[&str; 2]> = LANE_WIDTHS
|
||||
.iter()
|
||||
.map(|w| {
|
||||
["lines", "strip"].map(|name| {
|
||||
let block = blocks[&format!("LANE {name} {w}")].as_str();
|
||||
block.split_once('\n').unwrap().1
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
for (i, a) in maps.iter().enumerate() {
|
||||
for (j, b) in maps.iter().enumerate().skip(i + 1) {
|
||||
assert_ne!(a, b, "widths {} and {}", LANE_WIDTHS[i], LANE_WIDTHS[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Without `tessellationShader` a line at a width the device's lines do not draw is refused,
|
||||
/// needing it, where Metal draws it; at width 1 it draws as Metal's. Each encoder starts at 1.
|
||||
#[test]
|
||||
fn a_band_needs_tessellation() {
|
||||
let cache = ScratchCache::new().unwrap();
|
||||
let messages = Messages::default();
|
||||
{
|
||||
let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), |options| {
|
||||
options
|
||||
.withheld_features
|
||||
.insert(VkFeature::TessellationShader);
|
||||
})
|
||||
.unwrap();
|
||||
let name = device.name().to_owned();
|
||||
let wide_lines = device
|
||||
.compile_device()
|
||||
.profile()
|
||||
.enabled()
|
||||
.features
|
||||
.contains(&VkFeature::WideLines);
|
||||
let mut lane = Lane::new(device);
|
||||
let points = [1.0, 3.0, 15.0, 3.0, 1.0, 8.0, 15.0, 15.0];
|
||||
let (blocks, _) = measured();
|
||||
// Width 0 no device's lines draw.
|
||||
let refused = lane
|
||||
.draw(&Shot::one(
|
||||
16,
|
||||
1,
|
||||
Shade::White,
|
||||
Draw::line(PrimitiveType::Line, &points, 0.0),
|
||||
))
|
||||
.err()
|
||||
.unwrap_or_else(|| panic!("{name}: width 0 drawn without tessellationShader"));
|
||||
match refused {
|
||||
Error::Unsupported(u) => {
|
||||
assert_eq!(u.feature, Feature::WideLines, "{name}");
|
||||
assert_eq!(
|
||||
u.needs,
|
||||
Needs::AnyOf(vec![vec![Capability::Feature(
|
||||
VkFeature::TessellationShader
|
||||
)]]),
|
||||
"{name}"
|
||||
);
|
||||
}
|
||||
other => panic!("{name}: {other}"),
|
||||
}
|
||||
if !wide_lines {
|
||||
assert!(
|
||||
lane.draw(&Shot::one(
|
||||
16,
|
||||
1,
|
||||
Shade::White,
|
||||
Draw::line(PrimitiveType::Line, &points, 2.0)
|
||||
))
|
||||
.is_err(),
|
||||
"{name}: width 2 drawn without wideLines or tessellationShader"
|
||||
);
|
||||
}
|
||||
let drawn = lane
|
||||
.draw(&Shot::one(
|
||||
16,
|
||||
1,
|
||||
Shade::White,
|
||||
Draw::line(PrimitiveType::Line, &points, 1.0),
|
||||
))
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
lane_block("lines", 1.0, &drawn.red),
|
||||
blocks["LANE lines 1"],
|
||||
"{name}"
|
||||
);
|
||||
}
|
||||
layer_reported_nothing_at_all(&messages);
|
||||
}
|
||||
@@ -0,0 +1,832 @@
|
||||
# What plain Metal drew for crates/metal2vulkan-conformance/probes/line_widths.m on the Apple M3 Max,
|
||||
# macOS 27.0.1, one case a process (lane, quantize, state, ties, zero, strips, fill, msaa), read by
|
||||
# runtime_lane::line_widths. Generated by the probe; do not edit.
|
||||
LANE lines 0
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
LANE lines 0.5
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
".#..............",
|
||||
"...#............",
|
||||
".....#..........",
|
||||
".......#........",
|
||||
".........#......",
|
||||
"...........#....",
|
||||
".............#..",
|
||||
"................",
|
||||
LANE lines 1
|
||||
"................",
|
||||
"................",
|
||||
".##############.",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
".##.............",
|
||||
"...##...........",
|
||||
".....##.........",
|
||||
".......##.......",
|
||||
".........##.....",
|
||||
"...........##...",
|
||||
".............##.",
|
||||
"................",
|
||||
LANE lines 2
|
||||
"................",
|
||||
"................",
|
||||
".##############.",
|
||||
".##############.",
|
||||
"................",
|
||||
"................",
|
||||
"................",
|
||||
".#..............",
|
||||
".###............",
|
||||
"..####..........",
|
||||
"....####........",
|
||||
"......####......",
|
||||
"........####....",
|
||||
"..........####..",
|
||||
"............###.",
|
||||
"..............#.",
|
||||
LANE lines 3.5
|
||||
"................",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
"................",
|
||||
"................",
|
||||
".##.............",
|
||||
".####...........",
|
||||
".######.........",
|
||||
"..#######.......",
|
||||
"....#######.....",
|
||||
"......#######...",
|
||||
"........#######.",
|
||||
"..........#####.",
|
||||
"............###.",
|
||||
LANE lines 8
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".##############.",
|
||||
".#######........",
|
||||
".#########......",
|
||||
".###########....",
|
||||
".#############..",
|
||||
".##############.",
|
||||
"..#############.",
|
||||
"....###########.",
|
||||
"......#########.",
|
||||
"........#######.",
|
||||
LANE strip 0
|
||||
"................",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
".....#..........",
|
||||
".......#........",
|
||||
".........#......",
|
||||
"...........#....",
|
||||
"................",
|
||||
"................",
|
||||
LANE strip 0.5
|
||||
"................",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
".....#..........",
|
||||
".......#........",
|
||||
".........#......",
|
||||
"...........#....",
|
||||
"................",
|
||||
"................",
|
||||
LANE strip 1
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"...#............",
|
||||
"....##..........",
|
||||
"......##........",
|
||||
"........##......",
|
||||
"..........##....",
|
||||
"............#...",
|
||||
"................",
|
||||
LANE strip 2
|
||||
"................",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"..##............",
|
||||
"...##...........",
|
||||
"...####.........",
|
||||
".....####.......",
|
||||
".......####.....",
|
||||
".........####...",
|
||||
"...........##...",
|
||||
"................",
|
||||
LANE strip 3.5
|
||||
"................",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"..###...........",
|
||||
"...####.........",
|
||||
"...######.......",
|
||||
"....#######.....",
|
||||
"......#######...",
|
||||
"........#####...",
|
||||
"..........###...",
|
||||
"............#...",
|
||||
LANE strip 8
|
||||
"................",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#######.........",
|
||||
"#########.......",
|
||||
"...########.....",
|
||||
"...##########...",
|
||||
"...##########...",
|
||||
"...##########...",
|
||||
"...##########...",
|
||||
".....########...",
|
||||
".......######...",
|
||||
QUANTIZE width 1.25 (bits 3fa00000): horizontal y=32 rows 31..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.75 (bits 3f400000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.125 (bits 3f900000): horizontal y=32 rows 31..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.875 (bits 3f600000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.0625 (bits 3f880000): horizontal y=32 rows 31..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.9375 (bits 3f700000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.03125 (bits 3f840000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.96875 (bits 3f780000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.015625 (bits 3f820000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.984375 (bits 3f7c0000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.0078125 (bits 3f810000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.9921875 (bits 3f7e0000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00390625 (bits 3f808000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.99609375 (bits 3f7f0000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00195312 (bits 3f804000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.998046875 (bits 3f7f8000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00097656 (bits 3f802000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.999023438 (bits 3f7fc000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00048828 (bits 3f801000): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.999511719 (bits 3f7fe000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00024414 (bits 3f800800): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.999755859 (bits 3f7ff000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00012207 (bits 3f800400): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.99987793 (bits 3f7ff800): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00006104 (bits 3f800200): horizontal y=32 rows 31..31, vertical x=16.5 rows 3..26
|
||||
QUANTIZE width 0.999938965 (bits 3f7ffc00): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 3 (bits 40400000): horizontal y=32 rows 30..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 3.03125 (bits 40420000): horizontal y=32 rows 30..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 3.0625 (bits 40440000): horizontal y=32 rows 30..33, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 3.09375 (bits 40460000): horizontal y=32 rows 30..33, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 2.9375 (bits 403c0000): horizontal y=32 rows 31..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 2.96875 (bits 403e0000): horizontal y=32 rows 31..32, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 15.9375 (bits 417f0000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 15.96875 (bits 417f8000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 16 (bits 41800000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 16.03125 (bits 41804000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 16.0625 (bits 41808000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 17 (bits 41880000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 100 (bits 42c80000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 1.00000002e+30 (bits 7149f2ca): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width inf (bits 7f800000): horizontal y=32 rows 24..39, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width -0 (bits 80000000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width -1 (bits bf800000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width -inf (bits ff800000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width nan (bits 7fc00000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.03125 (bits 3d000000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.0625 (bits 3d800000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.09375 (bits 3dc00000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
QUANTIZE width 0.125 (bits 3e000000): horizontal y=32 rows -1..-1, vertical x=16.5 rows 4..27
|
||||
MAP width 4, then a draw of another pipeline state with no width set (192 pixels)
|
||||
6 ....########################....
|
||||
7 ....########################....
|
||||
8 ....########################....
|
||||
9 ....########################....
|
||||
18 ....########################....
|
||||
19 ....########################....
|
||||
20 ....########################....
|
||||
21 ....########################....
|
||||
MAP width 4 in encoder 0; encoder 1 sets none (120 pixels)
|
||||
6 ....########################....
|
||||
7 ....########################....
|
||||
8 ....########################....
|
||||
9 ....########################....
|
||||
13 ....########################....
|
||||
MAP horizontal y=16 width 3 (72 pixels)
|
||||
14 ....########################....
|
||||
15 ....########################....
|
||||
16 ....########################....
|
||||
MAP horizontal y=16 width 0.5 (0 pixels)
|
||||
MAP horizontal y=16.5 width 0.5 (24 pixels)
|
||||
16 ....########################....
|
||||
MAP horizontal y=16 width 3.5 (96 pixels)
|
||||
14 ....########################....
|
||||
15 ....########################....
|
||||
16 ....########################....
|
||||
17 ....########################....
|
||||
MAP horizontal y=16.5 width 3.5 (72 pixels)
|
||||
15 ....########################....
|
||||
16 ....########################....
|
||||
17 ....########################....
|
||||
MAP ends on centres x 4.5 to 27.5 width 2 (46 pixels)
|
||||
9 ....#######################.....
|
||||
10 ....#######################.....
|
||||
MAP ends on centres x 27.5 to 4.5 width 2 (46 pixels)
|
||||
9 ....#######################.....
|
||||
10 ....#######################.....
|
||||
MAP ends on centres y 4.5 to 27.5 width 2 (46 pixels)
|
||||
4 .........##.....................
|
||||
5 .........##.....................
|
||||
6 .........##.....................
|
||||
7 .........##.....................
|
||||
8 .........##.....................
|
||||
9 .........##.....................
|
||||
10 .........##.....................
|
||||
11 .........##.....................
|
||||
12 .........##.....................
|
||||
13 .........##.....................
|
||||
14 .........##.....................
|
||||
15 .........##.....................
|
||||
16 .........##.....................
|
||||
17 .........##.....................
|
||||
18 .........##.....................
|
||||
19 .........##.....................
|
||||
20 .........##.....................
|
||||
21 .........##.....................
|
||||
22 .........##.....................
|
||||
23 .........##.....................
|
||||
24 .........##.....................
|
||||
25 .........##.....................
|
||||
26 .........##.....................
|
||||
MAP ends on centres y 27.5 to 4.5 width 2 (46 pixels)
|
||||
4 .........##.....................
|
||||
5 .........##.....................
|
||||
6 .........##.....................
|
||||
7 .........##.....................
|
||||
8 .........##.....................
|
||||
9 .........##.....................
|
||||
10 .........##.....................
|
||||
11 .........##.....................
|
||||
12 .........##.....................
|
||||
13 .........##.....................
|
||||
14 .........##.....................
|
||||
15 .........##.....................
|
||||
16 .........##.....................
|
||||
17 .........##.....................
|
||||
18 .........##.....................
|
||||
19 .........##.....................
|
||||
20 .........##.....................
|
||||
21 .........##.....................
|
||||
22 .........##.....................
|
||||
23 .........##.....................
|
||||
24 .........##.....................
|
||||
25 .........##.....................
|
||||
26 .........##.....................
|
||||
MAP 45 degrees down-right width 4 (64 pixels)
|
||||
3 ....#...................
|
||||
4 ....##..................
|
||||
5 ....###.................
|
||||
6 ....####................
|
||||
7 .....####...............
|
||||
8 ......####..............
|
||||
9 .......####.............
|
||||
10 ........####............
|
||||
11 .........####...........
|
||||
12 ..........####..........
|
||||
13 ...........####.........
|
||||
14 ............####........
|
||||
15 .............####.......
|
||||
16 ..............####......
|
||||
17 ...............####.....
|
||||
18 ................####....
|
||||
19 .................###....
|
||||
20 ..................##....
|
||||
21 ...................#....
|
||||
MAP 45 degrees up-left width 4 (64 pixels)
|
||||
3 ....#...................
|
||||
4 ....##..................
|
||||
5 ....###.................
|
||||
6 ....####................
|
||||
7 .....####...............
|
||||
8 ......####..............
|
||||
9 .......####.............
|
||||
10 ........####............
|
||||
11 .........####...........
|
||||
12 ..........####..........
|
||||
13 ...........####.........
|
||||
14 ............####........
|
||||
15 .............####.......
|
||||
16 ..............####......
|
||||
17 ...............####.....
|
||||
18 ................####....
|
||||
19 .................###....
|
||||
20 ..................##....
|
||||
21 ...................#....
|
||||
MAP 45 degrees up-right width 4 (64 pixels)
|
||||
2 ...................#....
|
||||
3 ..................##....
|
||||
4 .................###....
|
||||
5 ................####....
|
||||
6 ...............####.....
|
||||
7 ..............####......
|
||||
8 .............####.......
|
||||
9 ............####........
|
||||
10 ...........####.........
|
||||
11 ..........####..........
|
||||
12 .........####...........
|
||||
13 ........####............
|
||||
14 .......####.............
|
||||
15 ......####..............
|
||||
16 .....####...............
|
||||
17 ....####................
|
||||
18 ....###.................
|
||||
19 ....##..................
|
||||
20 ....#...................
|
||||
MAP x-major diagonal width 8 (224 pixels)
|
||||
2 ..#.............................
|
||||
3 ..###...........................
|
||||
4 ..#####.........................
|
||||
5 ..#######.......................
|
||||
6 ..#########.....................
|
||||
7 ..###########...................
|
||||
8 ..#############.................
|
||||
9 ..###############...............
|
||||
10 ...################.............
|
||||
11 .....################...........
|
||||
12 .......################.........
|
||||
13 .........################.......
|
||||
14 ...........################.....
|
||||
15 .............################...
|
||||
16 ...............###############..
|
||||
17 .................#############..
|
||||
18 ...................###########..
|
||||
19 .....................#########..
|
||||
20 .......................#######..
|
||||
21 .........................#####..
|
||||
22 ...........................###..
|
||||
23 .............................#..
|
||||
MAP y-major width 3.5 (84 pixels)
|
||||
4 ......####......................
|
||||
5 .......###......................
|
||||
6 .......####.....................
|
||||
7 ........###.....................
|
||||
8 ........####....................
|
||||
9 .........###....................
|
||||
10 .........####...................
|
||||
11 ..........###...................
|
||||
12 ..........####..................
|
||||
13 ...........###..................
|
||||
14 ...........####.................
|
||||
15 ............###.................
|
||||
16 ............####................
|
||||
17 .............###................
|
||||
18 .............####...............
|
||||
19 ..............###...............
|
||||
20 ..............####..............
|
||||
21 ...............###..............
|
||||
22 ...............####.............
|
||||
23 ................###.............
|
||||
24 ................####............
|
||||
25 .................###............
|
||||
26 .................####...........
|
||||
27 ..................###...........
|
||||
MAP horizontal y=16.5 x 4.5 to 27.5 width 0 (23 pixels)
|
||||
16 ....#######################.....
|
||||
MAP horizontal y=16.5 x 27.5 to 4.5 width 0 (23 pixels)
|
||||
16 ....#######################.....
|
||||
MAP vertical x=16.5 y 4.5 to 27.5 width 0 (23 pixels)
|
||||
4 ................#...............
|
||||
5 ................#...............
|
||||
6 ................#...............
|
||||
7 ................#...............
|
||||
8 ................#...............
|
||||
9 ................#...............
|
||||
10 ................#...............
|
||||
11 ................#...............
|
||||
12 ................#...............
|
||||
13 ................#...............
|
||||
14 ................#...............
|
||||
15 ................#...............
|
||||
16 ................#...............
|
||||
17 ................#...............
|
||||
18 ................#...............
|
||||
19 ................#...............
|
||||
20 ................#...............
|
||||
21 ................#...............
|
||||
22 ................#...............
|
||||
23 ................#...............
|
||||
24 ................#...............
|
||||
25 ................#...............
|
||||
26 ................#...............
|
||||
MAP diagonal through centres width 0 (12 pixels)
|
||||
4 ....#...........................
|
||||
5 ......#.........................
|
||||
6 ........#.......................
|
||||
7 ..........#.....................
|
||||
8 ............#...................
|
||||
9 ..............#.................
|
||||
10 ................#...............
|
||||
11 ..................#.............
|
||||
12 ....................#...........
|
||||
13 ......................#.........
|
||||
14 ........................#.......
|
||||
15 ..........................#.....
|
||||
MAP diagonal through centres reversed width 0 (12 pixels)
|
||||
4 ....#...........................
|
||||
5 ......#.........................
|
||||
6 ........#.......................
|
||||
7 ..........#.....................
|
||||
8 ............#...................
|
||||
9 ..............#.................
|
||||
10 ................#...............
|
||||
11 ..................#.............
|
||||
12 ....................#...........
|
||||
13 ......................#.........
|
||||
14 ........................#.......
|
||||
15 ..........................#.....
|
||||
MAP 45 degrees through centres width 0 (16 pixels)
|
||||
4 ....#...........................
|
||||
5 .....#..........................
|
||||
6 ......#.........................
|
||||
7 .......#........................
|
||||
8 ........#.......................
|
||||
9 .........#......................
|
||||
10 ..........#.....................
|
||||
11 ...........#....................
|
||||
12 ............#...................
|
||||
13 .............#..................
|
||||
14 ..............#.................
|
||||
15 ...............#................
|
||||
16 ................#...............
|
||||
17 .................#..............
|
||||
18 ..................#.............
|
||||
19 ...................#............
|
||||
MAP diagonal through centres width -3 (12 pixels)
|
||||
4 ....#...........................
|
||||
5 ......#.........................
|
||||
6 ........#.......................
|
||||
7 ..........#.....................
|
||||
8 ............#...................
|
||||
9 ..............#.................
|
||||
10 ................#...............
|
||||
11 ..................#.............
|
||||
12 ....................#...........
|
||||
13 ......................#.........
|
||||
14 ........................#.......
|
||||
15 ..........................#.....
|
||||
MAP diagonal through centres width NaN (12 pixels)
|
||||
4 ....#...........................
|
||||
5 ......#.........................
|
||||
6 ........#.......................
|
||||
7 ..........#.....................
|
||||
8 ............#...................
|
||||
9 ..............#.................
|
||||
10 ................#...............
|
||||
11 ..................#.............
|
||||
12 ....................#...........
|
||||
13 ......................#.........
|
||||
14 ........................#.......
|
||||
15 ..........................#.....
|
||||
MAP diagonal through centres width 0.0625 (12 pixels)
|
||||
4 ....#...........................
|
||||
5 ......#.........................
|
||||
6 ........#.......................
|
||||
7 ..........#.....................
|
||||
8 ............#...................
|
||||
9 ..............#.................
|
||||
10 ................#...............
|
||||
11 ..................#.............
|
||||
12 ....................#...........
|
||||
13 ......................#.........
|
||||
14 ........................#.......
|
||||
15 ..........................#.....
|
||||
MAP horizontal y=16 width 0 (through no centre) (0 pixels)
|
||||
MAP horizontal y=16.5 x 4 to 28 width 0 (24 pixels)
|
||||
16 ....########################....
|
||||
MAP strip L width 1, fragments (39 pixels)
|
||||
8 ....111111111111111111111.......
|
||||
9 ........................1.......
|
||||
10 ........................1.......
|
||||
11 ........................1.......
|
||||
12 ........................1.......
|
||||
13 ........................1.......
|
||||
14 ........................1.......
|
||||
15 ........................1.......
|
||||
16 ........................1.......
|
||||
17 ........................1.......
|
||||
18 ........................1.......
|
||||
19 ........................1.......
|
||||
20 ........................1.......
|
||||
21 ........................1.......
|
||||
22 ........................1.......
|
||||
23 ........................1.......
|
||||
24 ........................1.......
|
||||
25 ........................1.......
|
||||
26 ........................1.......
|
||||
MAP strip peak width 1, fragments (48 pixels)
|
||||
4 ...............11...............
|
||||
5 ...............11...............
|
||||
6 ..............1..1..............
|
||||
7 ..............1..1..............
|
||||
8 .............1....1.............
|
||||
9 .............1....1.............
|
||||
10 ............1......1............
|
||||
11 ............1......1............
|
||||
12 ...........1........1...........
|
||||
13 ...........1........1...........
|
||||
14 ..........1..........1..........
|
||||
15 ..........1..........1..........
|
||||
16 .........1............1.........
|
||||
17 .........1............1.........
|
||||
18 ........1..............1........
|
||||
19 ........1..............1........
|
||||
20 .......1................1.......
|
||||
21 .......1................1.......
|
||||
22 ......1..................1......
|
||||
23 ......1..................1......
|
||||
24 .....1....................1.....
|
||||
25 .....1....................1.....
|
||||
26 ....1......................1....
|
||||
27 ....1......................1....
|
||||
MAP strip L width 3.5, fragments (118 pixels)
|
||||
7 ....11111111111111111111........
|
||||
8 ....1111111111111111111211......
|
||||
9 ....1111111111111111111211......
|
||||
10 .......................111......
|
||||
11 .......................111......
|
||||
12 .......................111......
|
||||
13 .......................111......
|
||||
14 .......................111......
|
||||
15 .......................111......
|
||||
16 .......................111......
|
||||
17 .......................111......
|
||||
18 .......................111......
|
||||
19 .......................111......
|
||||
20 .......................111......
|
||||
21 .......................111......
|
||||
22 .......................111......
|
||||
23 .......................111......
|
||||
24 .......................111......
|
||||
25 .......................111......
|
||||
26 .......................111......
|
||||
27 .......................111......
|
||||
MAP strip peak width 3.5, fragments (162 pixels)
|
||||
4 ..............2221..............
|
||||
5 .............11221..............
|
||||
6 .............112111.............
|
||||
7 ............1111111.............
|
||||
8 ............111.1111............
|
||||
9 ...........1111..111............
|
||||
10 ...........111...1111...........
|
||||
11 ..........1111....111...........
|
||||
12 ..........111.....1111..........
|
||||
13 .........1111......111..........
|
||||
14 .........111.......1111.........
|
||||
15 ........1111........111.........
|
||||
16 ........111.........1111........
|
||||
17 .......1111..........111........
|
||||
18 .......111...........1111.......
|
||||
19 ......1111............111.......
|
||||
20 ......111.............1111......
|
||||
21 .....1111..............111......
|
||||
22 .....111...............1111.....
|
||||
23 ....1111................111.....
|
||||
24 ....111.................1111....
|
||||
25 ...1111..................111....
|
||||
26 ...111...................1111...
|
||||
27 ..1111....................111...
|
||||
MAP strip L width 8, fragments (304 pixels)
|
||||
4 ....11111111111111111111........
|
||||
5 ....11111111111111111111........
|
||||
6 ....11111111111111111111........
|
||||
7 ....11111111111111111111........
|
||||
8 ....111111111111111122221111....
|
||||
9 ....111111111111111122221111....
|
||||
10 ....111111111111111122221111....
|
||||
11 ....111111111111111122221111....
|
||||
12 ....................11111111....
|
||||
13 ....................11111111....
|
||||
14 ....................11111111....
|
||||
15 ....................11111111....
|
||||
16 ....................11111111....
|
||||
17 ....................11111111....
|
||||
18 ....................11111111....
|
||||
19 ....................11111111....
|
||||
20 ....................11111111....
|
||||
21 ....................11111111....
|
||||
22 ....................11111111....
|
||||
23 ....................11111111....
|
||||
24 ....................11111111....
|
||||
25 ....................11111111....
|
||||
26 ....................11111111....
|
||||
27 ....................11111111....
|
||||
MAP strip peak width 8, fragments (352 pixels)
|
||||
4 ............22222222............
|
||||
5 ...........1122222211...........
|
||||
6 ...........1122222211...........
|
||||
7 ..........111122221111..........
|
||||
8 ..........111122221111..........
|
||||
9 .........11111122111111.........
|
||||
10 .........11111122111111.........
|
||||
11 ........1111111111111111........
|
||||
12 ........1111111111111111........
|
||||
13 .......11111111..11111111.......
|
||||
14 .......11111111..11111111.......
|
||||
15 ......11111111....11111111......
|
||||
16 ......11111111....11111111......
|
||||
17 .....11111111......11111111.....
|
||||
18 .....11111111......11111111.....
|
||||
19 ....11111111........11111111....
|
||||
20 ....11111111........11111111....
|
||||
21 ...11111111..........11111111...
|
||||
22 ...11111111..........11111111...
|
||||
23 ..11111111............11111111..
|
||||
24 ..11111111............11111111..
|
||||
25 .11111111..............11111111.
|
||||
26 .11111111..............11111111.
|
||||
27 11111111................11111111
|
||||
MAP strip L width 0, fragments (40 pixels)
|
||||
8 ....111111111111111111111.......
|
||||
9 ........................1.......
|
||||
10 ........................1.......
|
||||
11 ........................1.......
|
||||
12 ........................1.......
|
||||
13 ........................1.......
|
||||
14 ........................1.......
|
||||
15 ........................1.......
|
||||
16 ........................1.......
|
||||
17 ........................1.......
|
||||
18 ........................1.......
|
||||
19 ........................1.......
|
||||
20 ........................1.......
|
||||
21 ........................1.......
|
||||
22 ........................1.......
|
||||
23 ........................1.......
|
||||
24 ........................1.......
|
||||
25 ........................1.......
|
||||
26 ........................1.......
|
||||
27 ........................1.......
|
||||
MAP strip peak width 0, fragments (0 pixels)
|
||||
MAP triangle fill Lines width 1, fragments (72 pixels)
|
||||
3 ....111111111111111111111111....
|
||||
4 ....1......................1....
|
||||
5 ....1......................1....
|
||||
6 .....1....................1.....
|
||||
7 .....1....................1.....
|
||||
8 ......1..................1......
|
||||
9 ......1..................1......
|
||||
10 .......1................1.......
|
||||
11 .......1................1.......
|
||||
12 ........1..............1........
|
||||
13 ........1..............1........
|
||||
14 .........1............1.........
|
||||
15 .........1............1.........
|
||||
16 ..........1..........1..........
|
||||
17 ..........1..........1..........
|
||||
18 ...........1........1...........
|
||||
19 ...........1........1...........
|
||||
20 ............1......1............
|
||||
21 ............1......1............
|
||||
22 .............1....1.............
|
||||
23 .............1....1.............
|
||||
24 ..............1..1..............
|
||||
25 ..............1..1..............
|
||||
26 ...............11...............
|
||||
27 ...............11...............
|
||||
MAP triangle fill Lines width 4, fragments (270 pixels)
|
||||
2 ....111111111111111111111111....
|
||||
3 ....111111111111111111111111....
|
||||
4 ..1122111111111111111111112211..
|
||||
5 ...12221111111111111111112221...
|
||||
6 ...1111..................1111...
|
||||
7 ....1111................1111....
|
||||
8 ....1111................1111....
|
||||
9 .....1111..............1111.....
|
||||
10 .....1111..............1111.....
|
||||
11 ......1111............1111......
|
||||
12 ......1111............1111......
|
||||
13 .......1111..........1111.......
|
||||
14 .......1111..........1111.......
|
||||
15 ........1111........1111........
|
||||
16 ........1111........1111........
|
||||
17 .........1111......1111.........
|
||||
18 .........1111......1111.........
|
||||
19 ..........1111....1111..........
|
||||
20 ..........1111....1111..........
|
||||
21 ...........1111..1111...........
|
||||
22 ...........1111..1111...........
|
||||
23 ............11111111............
|
||||
24 ............11111111............
|
||||
25 .............112211.............
|
||||
26 .............112211.............
|
||||
27 ..............2222..............
|
||||
MAP triangle fill Lines width 0, fragments (0 pixels)
|
||||
MAP triangle fill Fill width 4, fragments (288 pixels)
|
||||
4 ....111111111111111111111111....
|
||||
5 .....1111111111111111111111.....
|
||||
6 .....1111111111111111111111.....
|
||||
7 ......11111111111111111111......
|
||||
8 ......11111111111111111111......
|
||||
9 .......111111111111111111.......
|
||||
10 .......111111111111111111.......
|
||||
11 ........1111111111111111........
|
||||
12 ........1111111111111111........
|
||||
13 .........11111111111111.........
|
||||
14 .........11111111111111.........
|
||||
15 ..........111111111111..........
|
||||
16 ..........111111111111..........
|
||||
17 ...........1111111111...........
|
||||
18 ...........1111111111...........
|
||||
19 ............11111111............
|
||||
20 ............11111111............
|
||||
21 .............111111.............
|
||||
22 .............111111.............
|
||||
23 ..............1111..............
|
||||
24 ..............1111..............
|
||||
25 ...............11...............
|
||||
26 ...............11...............
|
||||
MAP 4 samples horizontal y=16 width 0.5, samples (48 pixels)
|
||||
15 ....111111111111111111111111....
|
||||
16 ....111111111111111111111111....
|
||||
MAP 4 samples horizontal y=16 width 1, samples (48 pixels)
|
||||
15 ....222222222222222222222222....
|
||||
16 ....222222222222222222222222....
|
||||
MAP 4 samples horizontal y=16 width 2, samples (48 pixels)
|
||||
15 ....444444444444444444444444....
|
||||
16 ....444444444444444444444444....
|
||||
MAP 4 samples diagonal width 1, samples (48 pixels)
|
||||
3 ....1...........................
|
||||
4 ....32..........................
|
||||
5 .....231........................
|
||||
6 ......132.......................
|
||||
7 ........231.....................
|
||||
8 .........132....................
|
||||
9 ...........231..................
|
||||
10 ............132.................
|
||||
11 ..............231...............
|
||||
12 ...............132..............
|
||||
13 .................231............
|
||||
14 ..................132...........
|
||||
15 ....................231.........
|
||||
16 .....................132........
|
||||
17 .......................231......
|
||||
18 ........................132.....
|
||||
19 ..........................23....
|
||||
20 ...........................1....
|
||||
@@ -1472,8 +1472,10 @@ fn passes_and_draws_are_refused_as_metal_refuses_them() {
|
||||
// The render encoder's Apple-only setters (step 12's table): Metal's defaults are accepted.
|
||||
let apple = |feature| Err(Error::AppleOnly(feature));
|
||||
assert_eq!(encoder.set_alpha_test_reference_value(0.5), Ok(()));
|
||||
// Every width is accepted (`runtime_lane::line_widths` draws them); the encoder's width is
|
||||
// set back to Metal's default for the draws below.
|
||||
assert_eq!(encoder.set_line_width(2.0), Ok(()));
|
||||
assert_eq!(encoder.set_line_width(1.0), Ok(()));
|
||||
assert_eq!(encoder.set_line_width(2.0), apple(AppleOnly::LineWidth));
|
||||
// `setPointSize:` changes nothing Metal draws, at every size (088029d75).
|
||||
assert_eq!(encoder.set_point_size(4.0), Ok(()));
|
||||
// Every mode is drawn, as Metal draws every one; a mode past 1, which Metal draws a third
|
||||
|
||||
Vendored
+1
-1
@@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 480;
|
||||
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
|
||||
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 1710;
|
||||
pub const RUNTIME_VERSION: u32 = 1712;
|
||||
|
||||
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
|
||||
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles
|
||||
|
||||
@@ -68,6 +68,7 @@ pub use metal::{MetalDeviceProperties, SimdSupport, StageSimd};
|
||||
pub use policy::{
|
||||
BatchOrderPolicy, CompletionPolicy, ContainmentPolicy, DevicePolicy, HalfChainPolicy,
|
||||
HeapCompressionPolicy, HostPageTexturePolicy, PipelineWaitPolicy, RenderLoweringPolicy,
|
||||
WideLinePolicy,
|
||||
};
|
||||
pub(crate) use profile::whole_point_size;
|
||||
pub use profile::{DeviceProfile, SpirvValidation};
|
||||
|
||||
@@ -6,12 +6,13 @@ use std::time::Duration;
|
||||
|
||||
/// Policy inputs of `Device::new`. Every field but `heap_compression`, `completion`,
|
||||
/// `batch_order`, `render_lowering`, `host_page_textures`, `pipeline_waits`,
|
||||
/// `pipeline_creation_wait` and `pipeline_commit_wait` can change emitted code, so the profile
|
||||
/// carries it (containment as the encoding it selects) and its fingerprint covers it; those eight
|
||||
/// are the runtime's alone (a heap's compressed texture's image, when the host sees a command
|
||||
/// buffer complete, how a batch begins after the earlier ones of its queue, where a render
|
||||
/// encoder's calls are lowered, what holds a sampled texture over host pages, and whether and how
|
||||
/// long a pipeline the driver is still making is waited for), and no profile carries them.
|
||||
/// `pipeline_creation_wait`, `pipeline_commit_wait` and `wide_lines` can change emitted code, so
|
||||
/// the profile carries it (containment as the encoding it selects) and its fingerprint covers it;
|
||||
/// those nine are the runtime's alone (a heap's compressed texture's image, when the host sees a
|
||||
/// command buffer complete, how a batch begins after the earlier ones of its queue, where a render
|
||||
/// encoder's calls are lowered, what holds a sampled texture over host pages, whether and how
|
||||
/// long a pipeline the driver is still making is waited for, and which lines draw a wide line),
|
||||
/// and no profile carries them.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
@@ -74,6 +75,12 @@ pub struct DevicePolicy {
|
||||
/// each such command records as nothing. 4.5 s by default (as the creation wait, above). Unread
|
||||
/// under `Exact`. The runtime's alone: no emitted code changes.
|
||||
pub pipeline_commit_wait: Duration,
|
||||
/// Whether a line Apple's `setLineWidth:` widens, at a width the device's own lines draw
|
||||
/// otherwise than Metal (strict lines, lines that are not parallelograms, a width off the
|
||||
/// device's granularity or below 1), is the device's own line at that width (the default) or
|
||||
/// the pipeline's band variant, two triangles that cover Metal's parallelogram. The runtime's
|
||||
/// choice alone: no emitted code of a pipeline changes, the band being a variant of its own.
|
||||
pub wide_lines: WideLinePolicy,
|
||||
}
|
||||
|
||||
impl DevicePolicy {
|
||||
@@ -81,8 +88,9 @@ impl DevicePolicy {
|
||||
/// compressed image of a heap's texture Metal keeps compressed, command buffers ready together
|
||||
/// in one kernel submission, batches of one queue ordered by their ends where the driver runs
|
||||
/// them one after another, and a sampled
|
||||
/// texture over host pages in place where the device's check passed, and a pipeline still
|
||||
/// being made waited for a bound (4.5 s at a state's creation, and 4.5 s from a commit).
|
||||
/// texture over host pages in place where the device's check passed, a pipeline still
|
||||
/// being made waited for a bound (4.5 s at a state's creation, and 4.5 s from a commit), and
|
||||
/// a wide line the device's own wherever it draws the width.
|
||||
pub const UNTRUSTED: DevicePolicy = DevicePolicy {
|
||||
pointer_domain: PointerDomain::ResidentTable,
|
||||
handle_domain: HandleDomain::Table,
|
||||
@@ -97,6 +105,7 @@ impl DevicePolicy {
|
||||
pipeline_waits: PipelineWaitPolicy::Bounded,
|
||||
pipeline_creation_wait: Duration::from_millis(4500),
|
||||
pipeline_commit_wait: Duration::from_millis(4500),
|
||||
wide_lines: WideLinePolicy::Device,
|
||||
};
|
||||
|
||||
/// This policy with Metal's answer wherever the choices offer it: a heap's texture whose bytes
|
||||
@@ -109,8 +118,10 @@ impl DevicePolicy {
|
||||
/// ([`RenderLoweringPolicy::AtCall`]), every texture over host pages a shadow, whose
|
||||
/// copies touch its texels alone ([`HostPageTexturePolicy::Shadow`]), each `half`
|
||||
/// operation rounded on a device without `shaderFloat16` ([`HalfChainPolicy::EachOperation`]),
|
||||
/// and a render state's predicted pipeline made at its creation, each draw's pipeline waited
|
||||
/// for until it is made ([`PipelineWaitPolicy::Exact`]). Every other field is kept.
|
||||
/// a render state's predicted pipeline made at its creation, each draw's pipeline waited
|
||||
/// for until it is made ([`PipelineWaitPolicy::Exact`]), and every wide line Metal's
|
||||
/// parallelogram where the device's own line differs ([`WideLinePolicy::Exact`]). Every other
|
||||
/// field is kept.
|
||||
pub const fn exact_answers(self) -> DevicePolicy {
|
||||
DevicePolicy {
|
||||
heap_compression: HeapCompressionPolicy::Uncompressed,
|
||||
@@ -120,6 +131,7 @@ impl DevicePolicy {
|
||||
host_page_textures: HostPageTexturePolicy::Shadow,
|
||||
half_chains: HalfChainPolicy::EachOperation,
|
||||
pipeline_waits: PipelineWaitPolicy::Exact,
|
||||
wide_lines: WideLinePolicy::Exact,
|
||||
..self
|
||||
}
|
||||
}
|
||||
@@ -338,3 +350,26 @@ pub enum PipelineWaitPolicy {
|
||||
/// dispatches' pipelines until it is made: no command is dropped for its making's time.
|
||||
Exact,
|
||||
}
|
||||
|
||||
/// Which lines draw a line Apple's `setLineWidth:` widens (a width other than 1, quantized as
|
||||
/// Metal quantizes it), where the device's own lines draw that width otherwise than Metal's
|
||||
/// parallelogram: its lines are strict (rectangles), or not parallelograms
|
||||
/// (`nonStrictWideLinesUseParallelogram` unset or unknown), or the width is off the device's
|
||||
/// `lineWidthGranularity` (which rounds it) or below 1 (where Vulkan promises no shape). Where the
|
||||
/// device's lines draw the width as Metal does, they draw it under either value; where they cannot
|
||||
/// draw it at all (no `wideLines`, or a width outside `lineWidthRange`), and at width 0, the band
|
||||
/// draws it under either value. The runtime's choice alone: no emitted code changes.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum WideLinePolicy {
|
||||
/// The device's own line at the width (the default): its rectangle, its Bresenham columns, or
|
||||
/// its width rounded to the granularity, which can cover pixels Metal's parallelogram does not
|
||||
/// and miss others. Announced `device-wide-lines` at the first such draw.
|
||||
#[default]
|
||||
Device,
|
||||
/// The pipeline's band variant (needs `tessellationShader`): each line two triangles over
|
||||
/// Metal's parallelogram. On a device without `tessellationShader`, the device's own line,
|
||||
/// announced as under `Device`.
|
||||
Exact,
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
use crate::device::{
|
||||
BatchOrderPolicy, CompletionPolicy, DevicePolicy, HalfChainPolicy, HeapCompressionPolicy,
|
||||
HostPageTexturePolicy, PipelineWaitPolicy, RenderLoweringPolicy,
|
||||
HostPageTexturePolicy, PipelineWaitPolicy, RenderLoweringPolicy, WideLinePolicy,
|
||||
};
|
||||
use crate::pipeline::PrecisionNote;
|
||||
use std::collections::BTreeSet;
|
||||
@@ -59,9 +59,9 @@ fn choices() -> Vec<Choice> {
|
||||
// The accuracy choices, below.
|
||||
// The runtime's: a heap's compressed texture's image, when the host sees a command buffer
|
||||
// complete, how a batch begins after the earlier ones of its queue, where a render
|
||||
// encoder's calls are lowered, what holds a sampled texture over host pages, and whether and
|
||||
// encoder's calls are lowered, what holds a sampled texture over host pages, whether and
|
||||
// how long a pipeline being made is waited for (the bounds' values:
|
||||
// `the_ledger_states_the_pipeline_wait_bounds`).
|
||||
// `the_ledger_states_the_pipeline_wait_bounds`), and which lines draw a wide line.
|
||||
heap_compression: _,
|
||||
completion: _,
|
||||
batch_order: _,
|
||||
@@ -70,6 +70,7 @@ fn choices() -> Vec<Choice> {
|
||||
pipeline_waits: _,
|
||||
pipeline_creation_wait: _,
|
||||
pipeline_commit_wait: _,
|
||||
wide_lines: _,
|
||||
// The translator's: how a `half` chain rounds without `shaderFloat16`.
|
||||
half_chains: _,
|
||||
} = p;
|
||||
@@ -81,6 +82,7 @@ fn choices() -> Vec<Choice> {
|
||||
choice!(p.host_page_textures: HostPageTexturePolicy { InPlace, Shadow }),
|
||||
choice!(p.half_chains: HalfChainPolicy { AtExits, EachOperation }),
|
||||
choice!(p.pipeline_waits: PipelineWaitPolicy { Bounded, Exact }),
|
||||
choice!(p.wide_lines: WideLinePolicy { Device, Exact }),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -502,6 +504,35 @@ fn exact_answers_wait_for_every_pipeline() {
|
||||
);
|
||||
}
|
||||
|
||||
/// The runtime's choice of which lines draw a wide line (`wide_lines`) moves no committed
|
||||
/// profile's fingerprint: no profile carries it, so no translation follows it.
|
||||
#[test]
|
||||
fn the_runtime_s_wide_lines_choice_keys_no_profile() {
|
||||
use crate::spirv::testing::committed_profiles_with;
|
||||
let device = committed_profiles_with(DevicePolicy::UNTRUSTED).expect("profiles");
|
||||
let exact = committed_profiles_with(DevicePolicy {
|
||||
wide_lines: WideLinePolicy::Exact,
|
||||
..DevicePolicy::UNTRUSTED
|
||||
})
|
||||
.expect("profiles");
|
||||
assert_eq!(device.len(), exact.len());
|
||||
for ((stem, d), (other, e)) in device.iter().zip(&exact) {
|
||||
assert_eq!(stem, other);
|
||||
assert_eq!(d.fingerprint(), e.fingerprint(), "{stem}");
|
||||
}
|
||||
}
|
||||
|
||||
/// `DevicePolicy::exact_answers()` draws a wide line as Metal's parallelogram where the device's
|
||||
/// own line differs, and the default draws the device's own.
|
||||
#[test]
|
||||
fn exact_answers_draw_wide_lines_as_metal_s_parallelogram() {
|
||||
assert_eq!(DevicePolicy::UNTRUSTED.wide_lines, WideLinePolicy::Device);
|
||||
assert_eq!(
|
||||
DevicePolicy::UNTRUSTED.exact_answers().wide_lines,
|
||||
WideLinePolicy::Exact
|
||||
);
|
||||
}
|
||||
|
||||
/// The ledger's row of the pipeline waits states each bound as the default policy sets it, as
|
||||
/// `field = N s`: a changed bound changes its row.
|
||||
#[test]
|
||||
|
||||
@@ -470,6 +470,9 @@ assoc-const metal2vulkan::pipeline::CommandWrites::STAGE_IN_REGION pub const STA
|
||||
assoc-const metal2vulkan::pipeline::CommandWrites::THREADGROUP_MEMORY pub const THREADGROUP_MEMORY: u32
|
||||
assoc-const metal2vulkan::pipeline::FunctionHandle::NULL_WORD pub const NULL_WORD: u32
|
||||
assoc-const metal2vulkan::pipeline::FunctionHandle::RESERVED_WORD pub const RESERVED_WORD: u32
|
||||
assoc-const metal2vulkan::pipeline::LineBandState::FRONT_FACE pub const FRONT_FACE: vk::FrontFace
|
||||
assoc-const metal2vulkan::pipeline::LineBandState::PATCH_CONTROL_POINTS pub const PATCH_CONTROL_POINTS: u32
|
||||
assoc-const metal2vulkan::pipeline::LineBandState::PUSH_BYTES pub const PUSH_BYTES: u32
|
||||
assoc-const metal2vulkan::vk::ComponentMapping::IDENTITY pub const IDENTITY: ComponentMapping
|
||||
assoc-const-value metal2vulkan-air::bitcode::EnumAttrs::MAX_KIND 127
|
||||
assoc-const-value metal2vulkan-air::bitcode::EnumAttrs::MUST_PROGRESS 70
|
||||
@@ -936,6 +939,9 @@ assoc-const-value metal2vulkan::pipeline::CommandWrites::STAGE_IN_REGION 1 <<11
|
||||
assoc-const-value metal2vulkan::pipeline::CommandWrites::THREADGROUP_MEMORY 1 <<10
|
||||
assoc-const-value metal2vulkan::pipeline::FunctionHandle::NULL_WORD 0
|
||||
assoc-const-value metal2vulkan::pipeline::FunctionHandle::RESERVED_WORD 1
|
||||
assoc-const-value metal2vulkan::pipeline::LineBandState::FRONT_FACE crate::pipeline::link::band::LineBand::FRONT_FACE
|
||||
assoc-const-value metal2vulkan::pipeline::LineBandState::PATCH_CONTROL_POINTS crate::pipeline::link::band::LineBand::PATCH_CONTROL_POINTS
|
||||
assoc-const-value metal2vulkan::pipeline::LineBandState::PUSH_BYTES crate::pipeline::link::band::LineBand::PUSH_BYTES
|
||||
assoc-const-value metal2vulkan::vk::ComponentMapping::IDENTITY ComponentMapping
|
||||
const metal2vulkan-air::bitstream::BLOCKINFO_BLOCK_ID pub const BLOCKINFO_BLOCK_ID: u32
|
||||
const metal2vulkan-air::bitstream::TOP_LEVEL_ABBREV_WIDTH pub const TOP_LEVEL_ABBREV_WIDTH: u32
|
||||
@@ -1406,6 +1412,7 @@ enum metal2vulkan::device::VkExtension #[cfg_attr(feature = "serde", derive(serd
|
||||
enum metal2vulkan::device::VkFeature #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum VkFeature
|
||||
enum metal2vulkan::device::VkLimit #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum VkLimit
|
||||
enum metal2vulkan::device::VkProperty #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum VkProperty
|
||||
enum metal2vulkan::device::WideLinePolicy #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum WideLinePolicy
|
||||
enum metal2vulkan::error::AbiError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum AbiError
|
||||
enum metal2vulkan::error::Attachment #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum Attachment
|
||||
enum metal2vulkan::error::BindError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum BindError
|
||||
@@ -2522,6 +2529,7 @@ field metal2vulkan-runtime::WorkCounts.descriptor_keys_built pub descriptor_keys
|
||||
field metal2vulkan-runtime::WorkCounts.detached_storage_reaches pub detached_storage_reaches: u64
|
||||
field metal2vulkan-runtime::WorkCounts.device_copy_textures pub device_copy_textures: u64
|
||||
field metal2vulkan-runtime::WorkCounts.device_memory_allocated pub device_memory_allocated: u64
|
||||
field metal2vulkan-runtime::WorkCounts.device_wide_line_draws pub device_wide_line_draws: u64
|
||||
field metal2vulkan-runtime::WorkCounts.dirty_copies_in_gated pub dirty_copies_in_gated: u64
|
||||
field metal2vulkan-runtime::WorkCounts.dirty_copies_in_skipped pub dirty_copies_in_skipped: u64
|
||||
field metal2vulkan-runtime::WorkCounts.dirty_copies_in_whole pub dirty_copies_in_whole: u64
|
||||
@@ -2695,6 +2703,7 @@ field metal2vulkan-runtime::WorkCounts.instance_splits_visibility pub instance_s
|
||||
field metal2vulkan-runtime::WorkCounts.internal_submissions pub internal_submissions: u64
|
||||
field metal2vulkan-runtime::WorkCounts.kept_backings_made pub kept_backings_made: u64
|
||||
field metal2vulkan-runtime::WorkCounts.kept_bytes_passes pub kept_bytes_passes: u64
|
||||
field metal2vulkan-runtime::WorkCounts.line_band_draws pub line_band_draws: u64
|
||||
field metal2vulkan-runtime::WorkCounts.linear_passes_in_place pub linear_passes_in_place: u64
|
||||
field metal2vulkan-runtime::WorkCounts.linear_passes_through_copies pub linear_passes_through_copies: u64
|
||||
field metal2vulkan-runtime::WorkCounts.linked_use_questions_asked pub linked_use_questions_asked: u64
|
||||
@@ -2982,6 +2991,7 @@ field metal2vulkan::bind::BindShape.function_tables pub function_tables: Functio
|
||||
field metal2vulkan::bind::BindShape.imageblock_size pub imageblock_size: ImageblockSize
|
||||
field metal2vulkan::bind::BindShape.interlocked_colors pub interlocked_colors: BTreeSet<u32>
|
||||
field metal2vulkan::bind::BindShape.kept_imageblock_bytes pub kept_imageblock_bytes: Option<u32>
|
||||
field metal2vulkan::bind::BindShape.line_band pub line_band: bool
|
||||
field metal2vulkan::bind::BindShape.mesh_last_first pub mesh_last_first: bool
|
||||
field metal2vulkan::bind::BindShape.primitive_id_indices pub primitive_id_indices: Option<metal::IndexType>
|
||||
field metal2vulkan::bind::BindShape.private_list pub private_list: bool
|
||||
@@ -3012,6 +3022,7 @@ field metal2vulkan::bind::BindState.heap_placement pub heap_placement: HeapPlace
|
||||
field metal2vulkan::bind::BindState.imageblock_size pub imageblock_size: ImageblockSize
|
||||
field metal2vulkan::bind::BindState.interlocked_colors pub interlocked_colors: BTreeSet<u32>
|
||||
field metal2vulkan::bind::BindState.kept_imageblock_bytes pub kept_imageblock_bytes: Option<u32>
|
||||
field metal2vulkan::bind::BindState.line_band pub line_band: Option<[f32; 4]>
|
||||
field metal2vulkan::bind::BindState.mesh_last_first pub mesh_last_first: bool
|
||||
field metal2vulkan::bind::BindState.primitive_id_indices pub primitive_id_indices: Option<metal::IndexType>
|
||||
field metal2vulkan::bind::BindState.primitive_type pub primitive_type: Option<metal::PrimitiveType>
|
||||
@@ -3608,6 +3619,7 @@ field metal2vulkan::cache::VariantKey.flat_grid pub flat_grid: bool
|
||||
field metal2vulkan::cache::VariantKey.folded_groups pub folded_groups: bool
|
||||
field metal2vulkan::cache::VariantKey.interlocked_colors pub interlocked_colors: BTreeSet<u32>
|
||||
field metal2vulkan::cache::VariantKey.kept_imageblock_bytes pub kept_imageblock_bytes: Option<u32>
|
||||
field metal2vulkan::cache::VariantKey.line_band pub line_band: bool
|
||||
field metal2vulkan::cache::VariantKey.merged_draws pub merged_draws: bool
|
||||
field metal2vulkan::cache::VariantKey.mesh_last_first pub mesh_last_first: bool
|
||||
field metal2vulkan::cache::VariantKey.primitive_id_indices pub primitive_id_indices: Option<crate::metal::IndexType>
|
||||
@@ -3683,6 +3695,7 @@ field metal2vulkan::device::DevicePolicy.pipeline_creation_wait pub pipeline_cre
|
||||
field metal2vulkan::device::DevicePolicy.pipeline_waits pub pipeline_waits: PipelineWaitPolicy
|
||||
field metal2vulkan::device::DevicePolicy.pointer_domain pub pointer_domain: PointerDomain
|
||||
field metal2vulkan::device::DevicePolicy.render_lowering pub render_lowering: RenderLoweringPolicy
|
||||
field metal2vulkan::device::DevicePolicy.wide_lines pub wide_lines: WideLinePolicy
|
||||
field metal2vulkan::device::DriverDiagnostic.id pub id: i32
|
||||
field metal2vulkan::device::DriverDiagnostic.id_name pub id_name: &'static str
|
||||
field metal2vulkan::device::DriverDiagnostic.text pub text: Cow<'static, str>
|
||||
@@ -3754,6 +3767,8 @@ field metal2vulkan::device::Limits.framebuffer_no_attachments_sample_counts pub
|
||||
field metal2vulkan::device::Limits.framebuffer_stencil_sample_counts pub framebuffer_stencil_sample_counts: vk::SampleCountFlags
|
||||
field metal2vulkan::device::Limits.independent_resolve pub independent_resolve: bool
|
||||
field metal2vulkan::device::Limits.independent_resolve_none pub independent_resolve_none: bool
|
||||
field metal2vulkan::device::Limits.line_width_granularity_bits pub line_width_granularity_bits: u32
|
||||
field metal2vulkan::device::Limits.line_width_range_bits pub line_width_range_bits: [u32; 2]
|
||||
field metal2vulkan::device::Limits.max_bound_descriptor_sets pub max_bound_descriptor_sets: u32
|
||||
field metal2vulkan::device::Limits.max_clip_distances pub max_clip_distances: u32
|
||||
field metal2vulkan::device::Limits.max_color_attachments pub max_color_attachments: u32
|
||||
@@ -3833,9 +3848,12 @@ field metal2vulkan::device::Limits.min_texel_gather_offset pub min_texel_gather_
|
||||
field metal2vulkan::device::Limits.min_texel_offset pub min_texel_offset: i32
|
||||
field metal2vulkan::device::Limits.min_uniform_buffer_offset_alignment pub min_uniform_buffer_offset_alignment: u64
|
||||
field metal2vulkan::device::Limits.min_vertex_input_binding_stride_alignment pub min_vertex_input_binding_stride_alignment: Option<u32>
|
||||
field metal2vulkan::device::Limits.non_strict_wide_lines_use_parallelogram pub non_strict_wide_lines_use_parallelogram: bool
|
||||
field metal2vulkan::device::Limits.provoking_vertex_mode_per_pipeline pub provoking_vertex_mode_per_pipeline: bool
|
||||
field metal2vulkan::device::Limits.sample_location_sample_counts pub sample_location_sample_counts: vk::SampleCountFlags
|
||||
field metal2vulkan::device::Limits.storage_image_sample_counts pub storage_image_sample_counts: vk::SampleCountFlags
|
||||
field metal2vulkan::device::Limits.strict_lines pub strict_lines: bool
|
||||
field metal2vulkan::device::Limits.sub_pixel_precision_bits pub sub_pixel_precision_bits: u32
|
||||
field metal2vulkan::device::Limits.supported_depth_resolve_modes pub supported_depth_resolve_modes: vk::ResolveModeFlags
|
||||
field metal2vulkan::device::Limits.supported_stencil_resolve_modes pub supported_stencil_resolve_modes: vk::ResolveModeFlags
|
||||
field metal2vulkan::device::Limits.supports_non_zero_first_instance pub supports_non_zero_first_instance: bool
|
||||
@@ -4105,6 +4123,7 @@ field metal2vulkan::pipeline::GraphicsState.flat_fragment_inputs pub flat_fragme
|
||||
field metal2vulkan::pipeline::GraphicsState.fragment_imageblock pub fragment_imageblock: Option<FragmentImageblock>
|
||||
field metal2vulkan::pipeline::GraphicsState.fragment_writes_memory pub fragment_writes_memory: bool
|
||||
field metal2vulkan::pipeline::GraphicsState.input_attachments pub input_attachments: Vec<InputAttachmentUse>
|
||||
field metal2vulkan::pipeline::GraphicsState.line_band pub line_band: Option<LineBandState>
|
||||
field metal2vulkan::pipeline::GraphicsState.logic_op pub logic_op: Option<vk::LogicOp>
|
||||
field metal2vulkan::pipeline::GraphicsState.max_vertex_amplification_count pub max_vertex_amplification_count: u32
|
||||
field metal2vulkan::pipeline::GraphicsState.mesh_records pub mesh_records: Option<MeshRecords>
|
||||
@@ -4137,6 +4156,7 @@ field metal2vulkan::pipeline::ImageHandleClass.sampled_type pub sampled_type: Sa
|
||||
field metal2vulkan::pipeline::InputAttachmentUse.color_index pub color_index: u32
|
||||
field metal2vulkan::pipeline::InputAttachmentUse.format_class pub format_class: SampledType
|
||||
field metal2vulkan::pipeline::InputAttachmentUse.input_attachment_index pub input_attachment_index: u32
|
||||
field metal2vulkan::pipeline::LineBandState.push_offset pub push_offset: u32
|
||||
field metal2vulkan::pipeline::LinkedFunction.constants pub constants: FunctionConstantValues
|
||||
field metal2vulkan::pipeline::LinkedFunction.function pub function: Function
|
||||
field metal2vulkan::pipeline::LinkedFunction.precompiled pub precompiled: bool
|
||||
@@ -4945,6 +4965,7 @@ macro-member metal2vulkan-runtime::Degradation::DeviceSignedZeroInfNan DeviceSig
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceTexelConversion DeviceTexelConversion = "device-texel-conversion";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceTranscendentals DeviceTranscendentals = "device-transcendentals";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceVertexConversion DeviceVertexConversion = "device-vertex-conversion";
|
||||
macro-member metal2vulkan-runtime::Degradation::DeviceWideLines DeviceWideLines = "device-wide-lines", Precision,
|
||||
macro-member metal2vulkan-runtime::Degradation::DiscardDropsSimdgroupStores DiscardDropsSimdgroupStores = "discard-drops-simdgroup-stores";
|
||||
macro-member metal2vulkan-runtime::Degradation::DispatchDroppedStillMaking DispatchDroppedStillMaking = "dispatch-dropped-still-making", Precision,
|
||||
macro-member metal2vulkan-runtime::Degradation::DontCareLoadTiles DontCareLoadTiles = "dont-care-load-tiles", Precision,
|
||||
@@ -9660,6 +9681,7 @@ struct metal2vulkan::pipeline::FunctionHandle #[cfg_attr(feature = "serde", deri
|
||||
struct metal2vulkan::pipeline::GraphicsState #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct GraphicsState
|
||||
struct metal2vulkan::pipeline::ImageHandleClass #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub struct ImageHandleClass
|
||||
struct metal2vulkan::pipeline::InputAttachmentUse #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct InputAttachmentUse
|
||||
struct metal2vulkan::pipeline::LineBandState #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct LineBandState
|
||||
struct metal2vulkan::pipeline::LinkedFunction #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub struct LinkedFunction
|
||||
struct metal2vulkan::pipeline::LinkedFunctions #[derive(Clone, Debug, Default, PartialEq, Eq)] #[non_exhaustive] pub struct LinkedFunctions
|
||||
struct metal2vulkan::pipeline::LinkedSource #[derive(Clone, Copy, Debug)] pub struct LinkedSource<'a>
|
||||
@@ -10995,7 +11017,6 @@ variant metal2vulkan-air::tensor_ops::TensorSpace::Threadgroup Threadgroup
|
||||
variant metal2vulkan-runtime::AddressPlacement::Any Any
|
||||
variant metal2vulkan-runtime::AddressPlacement::At At(GpuAddress)
|
||||
variant metal2vulkan-runtime::AddressPlacement::Outside Outside
|
||||
variant metal2vulkan-runtime::AppleOnly::LineWidth LineWidth
|
||||
variant metal2vulkan-runtime::AppleOnly::ProtectedContent ProtectedContent
|
||||
variant metal2vulkan-runtime::AppleOnly::SurfaceClientDirection SurfaceClientDirection
|
||||
variant metal2vulkan-runtime::AppleOnly::VertexAmplificationMode VertexAmplificationMode
|
||||
@@ -11875,6 +11896,7 @@ variant metal2vulkan-runtime::RuntimeGap::TileAndFragmentImageblocks TileAndFrag
|
||||
variant metal2vulkan-runtime::RuntimeGap::TileAtSampleCount TileAtSampleCount
|
||||
variant metal2vulkan-runtime::RuntimeGap::VertexFetchPast4GiB VertexFetchPast4GiB { buffer_index: u32, reach: u64 }
|
||||
variant metal2vulkan-runtime::RuntimeGap::ViewportDepthRange ViewportDepthRange
|
||||
variant metal2vulkan-runtime::RuntimeGap::WideLines WideLines
|
||||
variant metal2vulkan-runtime::RuntimeGap::WriteSwizzle WriteSwizzle
|
||||
variant metal2vulkan-runtime::SemaphoreProblem::Null Null
|
||||
variant metal2vulkan-runtime::SemaphoreProblem::Timeline Timeline
|
||||
@@ -12738,6 +12760,7 @@ variant metal2vulkan::device::VkFeature::VertexAttributeInstanceRateZeroDivisor
|
||||
variant metal2vulkan::device::VkFeature::VertexPipelineStoresAndAtomics VertexPipelineStoresAndAtomics
|
||||
variant metal2vulkan::device::VkFeature::VulkanMemoryModel VulkanMemoryModel
|
||||
variant metal2vulkan::device::VkFeature::VulkanMemoryModelDeviceScope VulkanMemoryModelDeviceScope
|
||||
variant metal2vulkan::device::VkFeature::WideLines WideLines
|
||||
variant metal2vulkan::device::VkFeature::WorkgroupMemoryExplicitLayout WorkgroupMemoryExplicitLayout
|
||||
variant metal2vulkan::device::VkFeature::WorkgroupMemoryExplicitLayout16BitAccess WorkgroupMemoryExplicitLayout16BitAccess
|
||||
variant metal2vulkan::device::VkFeature::WorkgroupMemoryExplicitLayout8BitAccess WorkgroupMemoryExplicitLayout8BitAccess
|
||||
@@ -12894,6 +12917,8 @@ variant metal2vulkan::device::VkProperty::SubgroupOperation SubgroupOperation(Su
|
||||
variant metal2vulkan::device::VkProperty::SubgroupQuadOperationsInAllStages SubgroupQuadOperationsInAllStages
|
||||
variant metal2vulkan::device::VkProperty::SubgroupStage SubgroupStage(Stage)
|
||||
variant metal2vulkan::device::VkProperty::VariableSampleLocations VariableSampleLocations
|
||||
variant metal2vulkan::device::WideLinePolicy::Device Device
|
||||
variant metal2vulkan::device::WideLinePolicy::Exact Exact
|
||||
variant metal2vulkan::error::AbiError::BadSamplerState BadSamplerState
|
||||
variant metal2vulkan::error::AbiError::BadValue BadValue
|
||||
variant metal2vulkan::error::AbiError::ContainerMismatch ContainerMismatch
|
||||
@@ -13179,6 +13204,7 @@ variant metal2vulkan::error::Feature::VertexAmplification VertexAmplification
|
||||
variant metal2vulkan::error::Feature::ViewFormatReinterpretation ViewFormatReinterpretation
|
||||
variant metal2vulkan::error::Feature::ViewportDepthRange ViewportDepthRange
|
||||
variant metal2vulkan::error::Feature::VulkanVersion VulkanVersion
|
||||
variant metal2vulkan::error::Feature::WideLines WideLines
|
||||
variant metal2vulkan::error::Feature::WideSwitchLiteral WideSwitchLiteral
|
||||
variant metal2vulkan::error::InputErrorKind::Abi Abi(AbiError)
|
||||
variant metal2vulkan::error::InputErrorKind::Bitcode Bitcode(BitcodeError)
|
||||
@@ -13560,6 +13586,7 @@ variant metal2vulkan::pipeline::PushField::ExecutionStatusAddress ExecutionStatu
|
||||
variant metal2vulkan::pipeline::PushField::HalfBlendColor HalfBlendColor
|
||||
variant metal2vulkan::pipeline::PushField::IndexCapacity IndexCapacity
|
||||
variant metal2vulkan::pipeline::PushField::InstanceCount InstanceCount(SlotRef)
|
||||
variant metal2vulkan::pipeline::PushField::LineBand LineBand
|
||||
variant metal2vulkan::pipeline::PushField::MergedDrawAddress MergedDrawAddress
|
||||
variant metal2vulkan::pipeline::PushField::PatchIndexBound PatchIndexBound
|
||||
variant metal2vulkan::pipeline::PushField::PatchIndexOffset PatchIndexOffset
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -231,6 +231,7 @@ surface! {
|
||||
enum HostPageTexturePolicy N;
|
||||
enum HalfChainPolicy N;
|
||||
enum PipelineWaitPolicy N;
|
||||
enum WideLinePolicy N;
|
||||
struct DeviceProfile O;
|
||||
struct SpirvValidation N;
|
||||
struct EnabledCaps N;
|
||||
@@ -362,6 +363,7 @@ surface! {
|
||||
struct GraphicsState N;
|
||||
enum ImageblockMechanism N;
|
||||
struct InputAttachmentUse N;
|
||||
struct LineBandState N;
|
||||
struct ShaderTestsUse N;
|
||||
struct ShadowStencilUse N;
|
||||
struct StandInUse N;
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
# A cell is the first 64 bits of SHA-256 over the final SPIR-V of its subject, or its
|
||||
# refusal class. A cell that changes under an unchanged fixture source and profile
|
||||
# fingerprint needs cache::SEMANTICS_VERSION above its value at the last bless.
|
||||
profile amd-780m-hawkpoint-radv 3c24c32b02cd2efc
|
||||
profile amd-780m-radv 3c24c32b02cd2efc
|
||||
profile amd-rdna2-apu-radv d5fcc109ebb6097a
|
||||
profile amd-rdna3-radv be1ee9e20062c089
|
||||
profile gate-lavapipe 6a4db7a3051c5beb
|
||||
profile gate-lavapipe-x86_64 6d7f64e0dc48fcd4
|
||||
profile intel-arl-anv 528ecd9706b94d80
|
||||
profile intel-irisxe-anv c38b3a39b4a13b0f
|
||||
profile intel-irisxe-rplp-anv a82a856b3168d166
|
||||
profile intel-uhd770-rpls-anv a82a856b3168d166
|
||||
profile lavapipe 4774192cae9c7ab7
|
||||
profile lunarg-desktop-baseline-2023 c2734d88fdb9d4a1
|
||||
profile moltenvk-m3 71511e8bcedca3ec
|
||||
profile nvidia-pascal-linux 8f2f348b92d5bd60
|
||||
profile nvidia-rtx50-linux 82264a848258790f
|
||||
profile nvidia-rtx5080-laptop 2688922d4dfa2447
|
||||
profile roadmap-2022 f3613aa6054f8ba9
|
||||
profile swiftshader 1450b9482bf9a3d3
|
||||
profile vk12-floor 94e5ca70deff1bcf
|
||||
profile amd-780m-hawkpoint-radv 7727546221d66804
|
||||
profile amd-780m-radv 7727546221d66804
|
||||
profile amd-rdna2-apu-radv 2eaec7f74d7ae1ae
|
||||
profile amd-rdna3-radv 82e44878fda35a52
|
||||
profile gate-lavapipe a4112918cfcda63c
|
||||
profile gate-lavapipe-x86_64 880ba0551ea9c098
|
||||
profile intel-arl-anv 94903f08b2a35b88
|
||||
profile intel-irisxe-anv c282a0672d635c51
|
||||
profile intel-irisxe-rplp-anv c57b380689e33e05
|
||||
profile intel-uhd770-rpls-anv c57b380689e33e05
|
||||
profile lavapipe 8b0e38e4b195da6b
|
||||
profile lunarg-desktop-baseline-2023 a4079dbb79661db5
|
||||
profile moltenvk-m3 a8346c150d88a6cd
|
||||
profile nvidia-pascal-linux ffe884de52decdda
|
||||
profile nvidia-rtx50-linux 55dfd90c715d7263
|
||||
profile nvidia-rtx5080-laptop c017cadc61d61b42
|
||||
profile roadmap-2022 095e57d5877e6575
|
||||
profile swiftshader 6fbafde669fc11ea
|
||||
profile vk12-floor 930de7cb317e4829
|
||||
fixture source subject amd-780m-hawkpoint-radv amd-780m-radv amd-rdna2-apu-radv amd-rdna3-radv gate-lavapipe gate-lavapipe-x86_64 intel-arl-anv intel-irisxe-anv intel-irisxe-rplp-anv intel-uhd770-rpls-anv lavapipe lunarg-desktop-baseline-2023 moltenvk-m3 nvidia-pascal-linux nvidia-rtx50-linux nvidia-rtx5080-laptop roadmap-2022 swiftshader vk12-floor
|
||||
engine/a1_bool_from_float.air.ll 67a41b1383f5ed2f a1_bool_from_float af0c282104a088f0 af0c282104a088f0 af0c282104a088f0 af0c282104a088f0 30e9ebcd8a67f0e7 30e9ebcd8a67f0e7 8598fc0e2dade22f 8598fc0e2dade22f 8598fc0e2dade22f 8598fc0e2dade22f 30e9ebcd8a67f0e7 ef45878e34cce8d3 30e9ebcd8a67f0e7 ef45878e34cce8d3 30e9ebcd8a67f0e7 30e9ebcd8a67f0e7 ef45878e34cce8d3 ef45878e34cce8d3 ef45878e34cce8d3
|
||||
engine/a1_bool_from_float.ll 965508e37289a775 a1_bool_from_float af0c282104a088f0 af0c282104a088f0 af0c282104a088f0 af0c282104a088f0 30e9ebcd8a67f0e7 30e9ebcd8a67f0e7 8598fc0e2dade22f 8598fc0e2dade22f 8598fc0e2dade22f 8598fc0e2dade22f 30e9ebcd8a67f0e7 ef45878e34cce8d3 30e9ebcd8a67f0e7 ef45878e34cce8d3 30e9ebcd8a67f0e7 30e9ebcd8a67f0e7 ef45878e34cce8d3 ef45878e34cce8d3 ef45878e34cce8d3
|
||||
|
||||
|
Can't render this file because it is too large.
|
+20
-2
@@ -100,8 +100,8 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
with their bounds. On MoltenVK on an Apple GPU, whose sampler and `float` functions are Metal's
|
||||
own, most of them change nothing.
|
||||
- `DevicePolicy::exact_answers()` selects Metal's answer for each of the runtime's choices that
|
||||
offers one (the batch order and render lowering below, the heap texture compression, command
|
||||
buffer completion and textures over host pages) and the AIR's rounding of each `half` operation
|
||||
offers one (the batch order, render lowering and wide lines below, the heap texture
|
||||
compression, command buffer completion and textures over host pages) and the AIR's rounding of each `half` operation
|
||||
on a device without `shaderFloat16` (below), each listed in [FAST-PATHS.md](FAST-PATHS.md)
|
||||
with its bound and the measured cost of its exact form.
|
||||
- **`half` chains held at `float` precision without `shaderFloat16`** (`HalfChainPolicy::AtExits`,
|
||||
@@ -193,6 +193,15 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
recording. `pipeline_waits = PipelineWaitPolicy::Exact`, which `exact_answers()` selects, makes
|
||||
the predicted pipeline before the creation returns, as Metal compiles there, and waits for
|
||||
every draw's and dispatch's until made.
|
||||
- **A wide line the device's own** (`WideLinePolicy::Device`, the default; the runtime's choice,
|
||||
no pipeline's code differs). A line Apple's `setLineWidth:` widens is drawn by the device's own
|
||||
lines wherever it draws the width (`wideLines`, inside `lineWidthRange`), exact where they are
|
||||
Metal's parallelogram (`strictLines` unset, `nonStrictWideLinesUseParallelogram` set, the width
|
||||
on `lineWidthGranularity` and above 1), announced `device-wide-lines` where not.
|
||||
`wide_lines = WideLinePolicy::Exact`, which `exact_answers()` selects, draws those as the
|
||||
pipeline's band variant instead (section 4), two triangles over Metal's parallelogram, on a
|
||||
device with `tessellationShader`. Every other width other than 1 is the band under either value
|
||||
(the runtime's README, line widths).
|
||||
|
||||
Loops run as written: no execution bound is translated in.
|
||||
|
||||
@@ -2705,6 +2714,15 @@ bound.
|
||||
direct draw, an indirect one, or an indirect command's in an execution. Cost: the points rasterize
|
||||
nothing, the vertex function run for each, where what Metal draws is undefined: most of its draws
|
||||
draw nothing, and some a few of the points or a box.
|
||||
- `metal2vulkan-degrade-device-wide-lines` (precision). `DeviceWideLines`: A draw of lines at a
|
||||
width other than 1 (Apple's `setLineWidth:`), or of a triangle's edges in fill mode `Lines` or of
|
||||
a mesh draw, drawn by the device's own lines where they are not Metal's parallelogram: strict
|
||||
lines (the rectangle the width spans across the segment, square ends), lines Vulkan does not
|
||||
state as parallelograms (`nonStrictWideLinesUseParallelogram` unset, or a width below 1), or a
|
||||
width off the device's `lineWidthGranularity`, which rounds it. Under `WideLinePolicy::Exact` a
|
||||
draw of lines takes the band variant there instead, on a device with `tessellationShader`.
|
||||
Cost: the lines can cover pixels Metal's parallelogram does not, and miss others, at each end
|
||||
and along each edge.
|
||||
- `metal2vulkan-degrade-provoking-vertex-lines` (precision). `ProvokingVertexLines`: A draw of
|
||||
lines, or an emulated mesh draw of lines, under Apple's last provoking vertex
|
||||
(`setProvokingVertexMode:` 1), of a pipeline state that reads it (a flat input, or a slice or
|
||||
|
||||
@@ -39,6 +39,7 @@ three consumer pipelines: A2X (`a2x-s4`, `a2x-s96`), Xgc14 (`xgc14-bgra8`) and X
|
||||
| A chain of `half` additions, subtractions and products on a device without `shaderFloat16` (vk12-floor, SwiftShader, Pascal; capability emulation: the module computes each in `float` and rounds it by the device's `OpQuantizeToF16`): an operation whose flags hold `contract` and `reassoc` and whose result only such operations read is held at `float` precision unrounded, so the chain rounds where a value leaves it (a store, an output, a conversion, a comparison, a call, a phi, a vector move, an operation without both flags), one quantize per exit instead of one per operation (`lower::arith::half_chain`). A device with `shaderFloat16` computes `half` alike under either value. | `half_chains = HalfChainPolicy::AtExits` | `half_chains = HalfChainPolicy::EachOperation`: every operation's result rounded to `half`, as the AIR computes it | The result may differ from the rounded operations' by the roundings the chain skips, each within half a unit in the last place of a `half` at its step, compounded along the chain; a value inside the chain past `half`'s range (65504) stays finite where the rounded operations reach infinity. Within the AIR's flags, which let a compiler regroup and fuse such operations. `FastMathRewrites` (`fast-math-rewrites`) | Not timed. Size on vk12-floor (the fixtures' SPIR-V words, the default against the accurate form): `hfb_filter_bank` 121,270 against 131,766 (1,024 quantizes against 2,464), `grd_half_many_samples` 82,019 against 84,627, `nan_half_fast` 9,808 against 9,832 |
|
||||
| A texture that only samples or reads (no `RenderTarget`, `ShaderWrite` or `ShaderAtomic` usage) over host pages (a no-copy buffer's, or a no-copy heap's buffer's, imported by their pointer or as dma-bufs; or a buffer in fresh pages) is a linear image aliasing the pages in place, where the device's own check shows that the image's first move, which Vulkan lets read and write every byte bound to it (`VUID-VkImageCreateInfo-pNext-01443` makes such an image start `UNDEFINED`), leaves every byte alone while the CPU writes beside it: a deliberate, scoped exception to relying on documented Vulkan behaviour alone, the owner's ruling (`in_place.rs`). The check runs once per driver, release and runtime, per class of pages, on a thread of its own, its verdict kept in the shader cache's directory; a texture made before its class's verdict is a shadow. A texture whose usage renders or writes, a check that failed or made no image, and a pitch no image takes keep the shadow (`shadowed-texture`, its reason named, `WorkCounts::host_texture_shadows_*`). | `host_page_textures = HostPageTexturePolicy::InPlace` | `host_page_textures = HostPageTexturePolicy::Shadow`: every texture over host pages a shadow, its texels copied in before each command buffer that uses it and merged back after each write (the host-pages bullet under **Costs of matching Metal**) | Exact where the driver keeps what its check showed: the check covers texels, the bytes between rows and those after the image, of 1, 2, 4, 8 and 16-byte texels and a 3840x2160 surface, three rounds each; a driver whose first move changed a byte outside every round's window would undo a CPU write made meanwhile. Not announced where the check passed. A CPU write reaches the image's reads as it reaches the buffer's (Host Write Ordering Guarantees) | See **Costs of matching Metal** (host pages): the shadow copies a sampled 3840x2160 surface in whole each command buffer |
|
||||
| A render or compute state's creation hands the driver's making of its predicted pipeline (`pipeline/predicted.rs`, `pipeline/dispatch_making.rs`) to the runtime's pool, kept by the state as a draw's or dispatch's making is, and waits for it `pipeline_creation_wait` at most; a committed command buffer's recordings wait until its commit plus `pipeline_commit_wait` at most, one deadline its commands share, for its draws' and dispatches' (a compute encoder's, a render pass's tile dispatches) pipelines still being made (the scheduler wakes at the bound, `StepWaits::until`), an execution's replayed draws (`render/pending.rs`) among them, whose pipelines the commit's settle hands to the pool (a device replay's, one recording for every command, waits until made under either value), then record each such command as nothing: a draw's barriers and visibility query, a dispatch's barrier (a tile dispatch's copies into its scratch and back), no draw or dispatch, the command buffer running on without error. The making goes on, and the command buffers after it draw and dispatch with the pipeline once made. Metal compiles inside `newRenderPipelineState`, so no draw of a made state waits or is dropped; a host that creates a state inside a command buffer's encoding (the consumer creates a guest's state at an execution's first lookup of it) held that execution through the driver's whole compile: 11.59 s inside one execution on an M2 Pro (MoltenVK 1.4.2, a cold Metal compiler service; a sample of such a stall finds the compile's thread waiting in `MVKMetalCompiler::compile` for Metal's compiler), past the guest's 10 s FIFO check, which ended the guest's task. Each bound is 4.5 s: a creation and a commit may fall in one step of the guest's FIFO (a task's jobs run one after another, and a draw's own variant waits under its command buffer's bound), and no runtime call waits for both, so one step waits 9 s at most for makings, under that 10 s check. A creation waits on no command buffer's deadline and a `commit` on no creation's; a `commit` waits until its own deadline at most (it records there what it can, an execution of render commands the CPU writes among them), every other recording on the scheduler's thread. Made until made under either value, in the call that makes them: a draw that records nothing, one in a pass of custom sample positions and one recorded again into another instance of its pass (each in the draw's call or an execution's replay), a device replay's draws (in its `commit`), and a failed making made again (`PipelineWaitPolicy`'s docs). The runtime's: no pipeline differs. | `pipeline_waits = PipelineWaitPolicy::Bounded`, `pipeline_creation_wait = 4.5 s`, `pipeline_commit_wait = 4.5 s` | `pipeline_waits = PipelineWaitPolicy::Exact`: the creation makes its predicted pipeline before it returns (a render state's first key on its own thread, the rest on the pool, joined; a compute state's on its own thread), an execution's settle makes its replayed draws' pipelines at the commit, and a command buffer waits for each draw's and dispatch's pipeline until it is made | A draw whose pipeline was still being made `pipeline_commit_wait` after its command buffer's commit renders nothing in that command buffer (only there: later ones draw it), where Metal's renders: content drawn once (a layer, a glyph cache) stays without it until redrawn. A creation returns after `pipeline_creation_wait` at most with its making in flight (`WorkCounts::creations_left_making`). `DrawDroppedStillMaking` (`draw-dropped-still-making`), at each such draw where `DeviceOptions::announce_each` asks, else once per device; `CommandBuffer::dropped_draw` names the first with `VK_TIMEOUT`; `WorkCounts::draws_dropped_still_making`; `deferred_calls::a_draw_whose_pipeline_is_still_being_made_at_its_bound_runs_nothing` and `under_the_exact_wait_a_held_making_holds_its_command_buffer_until_it_lands`. A dispatch whose pipeline was still being made then writes nothing in that command buffer, where Metal's runs: `DispatchDroppedStillMaking` (`dispatch-dropped-still-making`), `WorkCounts::dispatches_dropped_still_making`, the first named by `dropped_draw`; `deferred_calls::a_dispatch_whose_pipeline_is_still_being_made_at_its_bound_runs_nothing`, `a_compute_state_s_creation_waits_its_bound_for_its_predicted_making` and `a_replayed_draw_whose_pipeline_is_still_being_made_at_its_bound_runs_nothing` | No GPU cost. The exact form holds the creating thread, and the command buffer, for the whole compile: up to 11.59 s on the M2 Pro's cold boot (that boot's 2,483 render state creations, translation included: 300 over 16 ms, 151 over 100 ms, 14 over 250 ms, 3 over 1 s, the longest 11.59 s, 5.82 s and 1.17 s), where the default holds a creation for 4.5 s at most and a command buffer for 4.5 s from its commit, which drops the draws of the compiles that outlast those (2 of that boot's 2,483 were over 4.5 s) for the command buffers committed before they land; bounds of 1 s Line truncated
|
||||
| A line Apple's `setLineWidth:` widens (`w' = floor(16 w) / 16`, other than 1) is drawn by the device's own lines at `w'` wherever it draws that width (`wideLines`, `w'` in `lineWidthRange` and above 0), where Metal draws the parallelogram Vulkan's non-strict wide lines may be (`render/line_width.rs`). They are exactly it on a non-strict device whose wide lines are parallelograms (`strictLines` unset, `nonStrictWideLinesUseParallelogram` set) at a width above 1 on its `lineWidthGranularity`, unannounced there; elsewhere they differ: a strict device's rectangle with square ends (lavapipe, NVIDIA), lines Vulkan does not state as parallelograms (ANV, and every width below 1), a width rounded to the granularity. A triangle's edges in fill mode `Lines` and a mesh draw's lines take the device's lines under either value, the band not drawing them. The runtime's: no pipeline's code differs. | `wide_lines = WideLinePolicy::Device` | `wide_lines = WideLinePolicy::Exact`: a draw of lines the device's lines draw otherwise than Metal is the pipeline's band variant (`VariantKey::line_band`, `pipeline::link::band`), two triangles over the parallelogram through a tessellation control and evaluation stage, on a device with `tessellationShader` (the device's lines where it has none); every other width other than 1 is the band under either value | The lines can cover pixels the parallelogram does not, and miss others, at each end and along each edge: up to half the width past each end (square ends), and a rounded width. `DeviceWideLines` (`device-wide-lines`), at each such draw where `DeviceOptions::announce_each` asks, else once per device; `WorkCounts::device_wide_line_draws`, `line_band_draws`; `runtime_lane::line_widths` (the band matches Metal's maps on MoltenVK under both values, which has no `wideLines`) | Not measured. Expected from the band's form: a second pipeline variant made for each render state that draws such lines (its two synthesized stages), each line tessellated as a patch of two control points into four corners, and a strip or loop drawn as the list of its segments |
|
||||
|
||||
All at once: `DevicePolicy::exact_answers()` sets every switch above; each row states its own cost.
|
||||
|
||||
@@ -839,6 +840,17 @@ driver's. Each is open work.
|
||||
neither pixel is required; both choices conform and there is no Vulkan control over the tie, so
|
||||
this is the driver's and not ours. RADV and ANV unrun.
|
||||
|
||||
- **Lines under Apple's `setLineWidth:` at a width other than 1 that neither route draws as
|
||||
Metal** (`render/line_width.rs`). Refused (`RuntimeGap::WideLines`): a triangle's edges in fill
|
||||
mode `Lines` and a mesh draw's lines where the device's own lines do not draw the width (every
|
||||
such draw on MoltenVK), an amplified band, and any wide line in an execution or a
|
||||
rasterization-rate-mapped pass. Not announced: the band is cut at the near and far planes where
|
||||
its triangles are, which can differ from Metal's clipped segment by part of a pixel there; what
|
||||
its fragments read (varyings and depth across the width) is not compared with Metal's; and at
|
||||
width 1 in a multisampled pass the runtime's lines are its ordinary ones (Bresenham's where the
|
||||
device offers them) where Metal draws the parallelogram at the sample positions (MoltenVK's are
|
||||
Metal's own).
|
||||
|
||||
- **A heap multisample texture's sample moves on a GPU of 20 GiB or less**: a command queue keeps
|
||||
the images such moves go through up to a sixty-fourth of the device's largest device-local heap
|
||||
(`gpu_pools::device_share`, `texture/copy_images.rs`). A 4096 x 2160 `Depth32Float_Stencil8`
|
||||
|
||||
+12
-10
@@ -27,9 +27,9 @@ Columns:
|
||||
|
||||
| Kind | Variants | With a site | Reach system | Reach app | Reach rare | Reach none | Unassessed |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 125 | 125 | 6 | 32 | 70 | 17 | 0 |
|
||||
| Runtime gaps | 70 | 70 | 1 | 8 | 45 | 16 | 0 |
|
||||
| Apple-only calls | 5 | 5 | 0 | 0 | 0 | 5 | 0 |
|
||||
| Translator and front-end refusals | 126 | 126 | 6 | 32 | 70 | 18 | 0 |
|
||||
| Runtime gaps | 71 | 71 | 1 | 8 | 45 | 17 | 0 |
|
||||
| Apple-only calls | 4 | 4 | 0 | 0 | 0 | 4 | 0 |
|
||||
| Binder refusals at a device limit | 9 | 9 | 0 | 1 | 7 | 1 | 0 |
|
||||
| Translation caps | 14 | 14 | 0 | 0 | 7 | 7 | 0 |
|
||||
| Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 |
|
||||
@@ -41,9 +41,9 @@ Columns:
|
||||
|
||||
| Kind | `metal-measured` | `metal-documented` | `metal-takes` | `device` | `ours` | `unknown` | `delegated` | `-` |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 0 | 0 | 0 | 48 | 54 | 0 | 0 | 23 |
|
||||
| Runtime gaps | 0 | 0 | 0 | 0 | 70 | 0 | 0 | 0 |
|
||||
| Apple-only calls | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
|
||||
| Translator and front-end refusals | 0 | 0 | 0 | 48 | 55 | 0 | 0 | 23 |
|
||||
| Runtime gaps | 0 | 0 | 0 | 0 | 71 | 0 | 0 | 0 |
|
||||
| Apple-only calls | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
|
||||
| Binder refusals at a device limit | 0 | 0 | 0 | 9 | 0 | 0 | 0 | 0 |
|
||||
| Translation caps | 0 | 0 | 0 | 0 | 14 | 0 | 0 | 0 |
|
||||
| Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
|
||||
@@ -122,7 +122,7 @@ Columns:
|
||||
| `InterfaceComponents` | Too many interface components or locations | devices short of a device limit the site names; devices without VkLimit::MaxColorAttachments; devices without VkLimit::MaxVertexInputAttributes | `device` | 4: `crates/metal2vulkan/src/pipeline/compile/color_group.rs (refusal)`, `crates/metal2vulkan/src/pipeline/link/graphics.rs (graphics_state)` (+2) | `rare`: too many varyings or attachments for a device |
|
||||
| `UnmatchedVarying` | A fragment input without a vertex producer (a Metal link error) | every device (no Vulkan mechanism) | `device` | 3: `crates/metal2vulkan/src/pipeline/link/varyings.rs (mesh_fragment)`, `crates/metal2vulkan/src/pipeline/link/varyings.rs (varyings, 2 sites)` | `none`: a Metal link error |
|
||||
| `KernelStageIn` | Kernel `[[stage_in]]` | every device (not implemented) | `ours` | 3: `crates/metal2vulkan-runtime/src/indirect_execute.rs (record)`, `crates/metal2vulkan/src/bind/dispatch.rs (instantiate)` (+1) | `rare`: kernel stage-in combinations Metal leaves unestablished |
|
||||
| `Tessellation` | Tessellation | devices without VkLimit::MaxPushConstantsSize; devices without VkLimit::MaxStorageBufferRange; devices without VkLimit::MaxTessellationGenerationLevel; every device (not implemented) | `ours` | 13: `crates/metal2vulkan-air/src/canon/mod.rs (post_check, 2 sites)`, `crates/metal2vulkan/src/bind/graphics.rs (tessellation_dispatch)` (+10) | `rare`: tessellation |
|
||||
| `Tessellation` | Tessellation | devices without VkLimit::MaxStorageBufferRange; devices without VkLimit::MaxTessellationGenerationLevel; every device (not implemented) | `ours` | 12: `crates/metal2vulkan-air/src/canon/mod.rs (post_check, 2 sites)`, `crates/metal2vulkan/src/bind/graphics.rs (tessellation_dispatch)` (+9) | `rare`: tessellation |
|
||||
| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | `ours` | 7: `crates/metal2vulkan/src/bind/graphics.rs (mesh_limit)`, `crates/metal2vulkan/src/bind/graphics.rs (plan)` (+4) | `rare`: mesh pipelines |
|
||||
| `TileShading` | | devices without VkLimit::MaxStorageBufferRange; devices without a format's usage; every device (not implemented) | `ours` | 5: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs (scratch)`, `crates/metal2vulkan/src/bind/plan/compute.rs (tile_memory)` (+3) | `rare`: tile shaders (Apple GPU families) |
|
||||
| `Imageblocks` | An imageblock outside the forms implemented | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`missing`); drivers with a defect; every device (not implemented) | `ours` | 10: `crates/metal2vulkan/src/lower/access/imageblock.rs (imageblocks)`, `crates/metal2vulkan/src/lower/access/mod.rs (select_param)` (+7) | `rare`: imageblocks (Apple GPU families) |
|
||||
@@ -180,6 +180,7 @@ Columns:
|
||||
| `ProgramScopeBinding` | A program-scope buffer binding of MSL 3.2 (macOS 15 and later), `constant T* constant p [[buffer(n)]];` in Apple's `!air.global_bindings` list,... | - | `-` | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs (decode)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) |
|
||||
| `SeqCstFence` | A sequentially consistent fence (`seq_cst` `atomic_thread_fence`, an LLVM `fence seq_cst`, or a `seq_cst` barrier ordering device memory), whose... | devices short of a Vulkan feature the site names | `device` | 1: `crates/metal2vulkan/src/lower/sync/barrier.rs (require_seq_cst)` | `rare`: a seq_cst fence in a vertex or fragment stage without its stores and atomics |
|
||||
| `PostDepthCoverage` | The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`), read through `VK_EXT_post_depth_coverage` | devices short of a Vulkan extension the site names; devices without VkExtension::ExtPostDepthCoverage | `device` | 2: `crates/metal2vulkan-runtime/src/families/features.rs (state)`, `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)` | `rare`: the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage |
|
||||
| `WideLines` | Lines at a width other than 1 (Apple's `setLineWidth:`), drawn by the device's own wide lines (`wideLines`) or as bands of triangles through... | devices without VkFeature::TessellationShader; devices without VkLimit::MaxTessellationEvaluationOutputComponents; every device (not implemented) | `ours` | 4: `crates/metal2vulkan-runtime/src/render/line_width.rs (line_route)`, `crates/metal2vulkan/src/pipeline/link/band.rs (plan, 3 sites)` | `none`: a line under the Apple-private setLineWidth: at a width other than 1 on a device without tessellationShader whose own lines do not draw it, or a band pipeline form not built (a selected slice or viewport, barycentric weights, multiview, synthesized geometry) |
|
||||
|
||||
## 2. Runtime gaps (`Error::NotImplemented(RuntimeGap)`)
|
||||
|
||||
@@ -245,6 +246,7 @@ Columns:
|
||||
| `RestartedStrip` | An indexed strip after `set_primitive_restart_enabled` with an index Vulkan does not restart at, which the runtime draws as a list an index... | every device (runtime piece not built) | `ours` | 1: `crates/metal2vulkan-runtime/src/render/restart.rs (gap)` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws |
|
||||
| `PrivatePrimitives` | A draw of one of Metal's private primitive types (`DrawPrimitiveType` | every device (runtime piece not built) | `ours` | 2: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)`, `crates/metal2vulkan-runtime/src/render/restart.rs (gap)` | `none`: a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a list past a u32 or one storage range, indices or arguments an unordered earlier draw wrote |
|
||||
| `ProvokingVertex` | A draw under Apple's last provoking vertex (`setProvokingVertexMode:` 1) on a device without `VK_EXT_provoking_vertex`'s last vertex, which the... | every device (runtime piece not built) | `ours` | 1: `crates/metal2vulkan-runtime/src/render/restart.rs (gap)` | `none`: a draw after the Apple-private setProvokingVertexMode: 1, on a device without the last provoking vertex, whose rotated list cannot draw as Metal draws |
|
||||
| `WideLines` | A draw at a line width other than 1 (Apple's `setLineWidth:`) the runtime does not draw as Metal does (`render/line_width.rs`) | every device (runtime piece not built) | `ours` | 5: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)`, `crates/metal2vulkan-runtime/src/render/executions.rs (settle_draw_of)` (+2) | `none`: under the Apple-private setLineWidth: at a width other than 1, a triangle's edges or a mesh draw the device's own lines do not draw, an amplified band, or a line in a rate-mapped pass or an execution |
|
||||
| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | `ours` | 1: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier |
|
||||
| `RotatedTexture` | A rotated texture (`TextureDescriptor::rotation`) where the runtime does not build what Metal does | every device (runtime piece not built) | `ours` | 8: `crates/metal2vulkan-runtime/src/buffer_texture.rs (turned_plane)`, `crates/metal2vulkan-runtime/src/rotated.rs (new, 2 sites)` (+5) | `rare`: a rotated drawable's views, rows past its buffer |
|
||||
| `DetachTextures` | A texture over a no-copy buffer's or heap's bytes (a heap's texture, or a texture over the buffer or over one of the heap's buffers) that no... | every device (runtime piece not built) | `ours` | 7: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs (rebind_host_pages)`, `crates/metal2vulkan-runtime/src/buffer_texture.rs (make_texture_over)` (+4) | `none`: a runtime extension's detach with a texture no stand-in presents exactly |
|
||||
@@ -261,7 +263,6 @@ Columns:
|
||||
| Variant | What it blocks | Where | Basis | Sites | Reach |
|
||||
|---|---|---|---|---|---|
|
||||
| `ProtectedContent` | Protection options whose answer on Metal is not measured (`command_buffer/protection.rs`) | every device (Apple-private, Metal's answer not measured) | `-` | 3: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs (commit_now)`, `crates/metal2vulkan-runtime/src/command_buffer/protection.rs (refuse_protected_state_encoder)` (+1) | `none`: Apple-private (no public header) |
|
||||
| `LineWidth` | A line width other than 1 (`setLineWidth:`) | every device (Apple-private, Metal's answer not measured) | `-` | 1: `crates/metal2vulkan-runtime/src/apple_only.rs (check)` | `none`: Apple-private (no public header) |
|
||||
| `ViewportTransformDisabled` | The viewport transform turned off (`setViewportTransformEnabled:NO`) | every device (Apple-private, Metal's answer not measured) | `-` | 1: `crates/metal2vulkan-runtime/src/apple_only.rs (check)` | `none`: Apple-private (no public header) |
|
||||
| `VertexAmplificationMode` | `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the value) of 0, whose copies change from run to run on... | every device (Apple-private, Metal's answer not measured) | `-` | 2: `crates/metal2vulkan-runtime/src/apple_only.rs (check)`, `crates/metal2vulkan-runtime/src/apple_only.rs (set_vertex_amplification_mode)` | `none`: Apple-private (no public header) |
|
||||
| `SurfaceClientDirection` | A texture over an IOSurface made with `kIOSurfaceClientDirection` (`newTextureWithDescriptor:iosurface:plane:` of such a surface) | every device (Apple-private, Metal's answer not measured) | `-` | 1: `crates/metal2vulkan-runtime/src/buffer_texture.rs (new_texture_with_iosurface_plane)` | `none`: an IOSurface key in no public header |
|
||||
@@ -625,7 +626,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::InterfaceComponents`: `crates/metal2vulkan/src/pipeline/compile/color_group.rs (refusal)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs (assign)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs (limit_error)`
|
||||
- `feature::UnmatchedVarying`: `crates/metal2vulkan/src/pipeline/link/varyings.rs (mesh_fragment)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs (varyings, 2 sites)`
|
||||
- `feature::KernelStageIn`: `crates/metal2vulkan-runtime/src/indirect_execute.rs (record)`; `crates/metal2vulkan/src/bind/dispatch.rs (instantiate)`; `crates/metal2vulkan/src/lower/stage_io/stage_in.rs (select)`
|
||||
- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs (post_check, 2 sites)`; `crates/metal2vulkan/src/bind/graphics.rs (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (primitive_id_output)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs (push_offset)`
|
||||
- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs (post_check, 2 sites)`; `crates/metal2vulkan/src/bind/graphics.rs (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (primitive_id_output)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs (control_plan)`
|
||||
- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs (mesh_limit)`; `crates/metal2vulkan/src/bind/graphics.rs (plan)`; `crates/metal2vulkan/src/lower/mesh/mod.rs (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs (plan_entry, 2 sites)`; `crates/metal2vulkan/src/memory/plan.rs (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs (records)`
|
||||
- `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs (scratch)`; `crates/metal2vulkan/src/bind/plan/compute.rs (tile_memory)`; `crates/metal2vulkan/src/lower/access/tile.rs (not_implemented)`; `crates/metal2vulkan/src/lower/sync/barrier.rs (tile_shading)`; `crates/metal2vulkan/src/pipeline/compile/api.rs (tile_pipeline)`
|
||||
- `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (plan_tests, 2 sites)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (reach)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs (require)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs (fragment_imageblock)`
|
||||
@@ -683,6 +684,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs (decode)`; `crates/metal2vulkan/src/error/mod.rs (from)`
|
||||
- `feature::SeqCstFence`: `crates/metal2vulkan/src/lower/sync/barrier.rs (require_seq_cst)`
|
||||
- `feature::PostDepthCoverage`: `crates/metal2vulkan-runtime/src/families/features.rs (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)`
|
||||
- `feature::WideLines`: `crates/metal2vulkan-runtime/src/render/line_width.rs (line_route)`; `crates/metal2vulkan/src/pipeline/link/band.rs (plan, 3 sites)`
|
||||
- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs (host_copy)`; `crates/metal2vulkan-runtime/src/texture.rs (image)`; `crates/metal2vulkan-runtime/src/texture.rs (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs (new_surface_planes_texture)`
|
||||
- `gap::ResourceHeap`: `crates/metal2vulkan-runtime/src/binding.rs (descriptor)`
|
||||
- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs (make_aliasable)`
|
||||
@@ -743,6 +745,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `gap::RestartedStrip`: `crates/metal2vulkan-runtime/src/render/restart.rs (gap)`
|
||||
- `gap::PrivatePrimitives`: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)`; `crates/metal2vulkan-runtime/src/render/restart.rs (gap)`
|
||||
- `gap::ProvokingVertex`: `crates/metal2vulkan-runtime/src/render/restart.rs (gap)`
|
||||
- `gap::WideLines`: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs (settle_draw_of)`; `crates/metal2vulkan-runtime/src/render/line_width.rs (line_route, 2 sites)`; `crates/metal2vulkan-runtime/src/render/restart.rs (gap)`
|
||||
- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs (draw_resident)`
|
||||
- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/buffer_texture.rs (turned_plane)`; `crates/metal2vulkan-runtime/src/rotated.rs (new, 2 sites)`; `crates/metal2vulkan-runtime/src/shadow.rs (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs (view)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs (check_rotated_reach)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs (copied_image)`; `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs (new_usage_shadow)`
|
||||
- `gap::DetachTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs (new_stand_in)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs (stand_in_while_detached)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs (stand_ins, 2 sites)`
|
||||
@@ -754,7 +757,6 @@ Each refusal's sites, with the function that builds it.
|
||||
- `gap::MultisampledBufferLayout`: `crates/metal2vulkan-runtime/src/sample_interleave.rs (plan)`
|
||||
- `gap::ColorAttachmentGroups`: `crates/metal2vulkan-runtime/src/render/color_groups.rs (gap)`
|
||||
- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs (commit_now)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs (refuse_protected_state_encoder)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs (set)`
|
||||
- `apple::LineWidth`: `crates/metal2vulkan-runtime/src/apple_only.rs (check)`
|
||||
- `apple::ViewportTransformDisabled`: `crates/metal2vulkan-runtime/src/apple_only.rs (check)`
|
||||
- `apple::VertexAmplificationMode`: `crates/metal2vulkan-runtime/src/apple_only.rs (check)`; `crates/metal2vulkan-runtime/src/apple_only.rs (set_vertex_amplification_mode)`
|
||||
- `apple::SurfaceClientDirection`: `crates/metal2vulkan-runtime/src/buffer_texture.rs (new_texture_with_iosurface_plane)`
|
||||
|
||||
@@ -412,7 +412,7 @@ narrow refusal that the call's rustdoc describes.
|
||||
| `SetFragmentTexture` | `setFragmentTexture:atIndex:` | `RenderCommandEncoder::set_fragment_texture` |
|
||||
| `SetFragmentTextures` | `setFragmentTextures:withRange:` | `RenderCommandEncoder::set_fragment_textures` |
|
||||
| `SetFrontFacingWinding` | `setFrontFacingWinding:` | `RenderCommandEncoder::set_front_facing_winding` |
|
||||
| `SetLineWidth` | `setLineWidth:` (SPI) | `RenderCommandEncoder::set_line_width`: 1 accepted; anything else refused `AppleOnly::LineWidth` *(partial)* |
|
||||
| `SetLineWidth` | `setLineWidth:` (SPI) | `RenderCommandEncoder::set_line_width`: every width accepted, quantized as Metal does; drawn by the device's lines where they draw it (announced `device-wide-lines` where not Metal's parallelogram) or as the band variant; a triangle's edges, and a line without `tessellationShader`, the device's lines do not draw refused `RuntimeGap::WideLines` or needing `tessellationShader` (the runtime's README, line widths) *(partial)* |
|
||||
| `SetPointSize` | `setPointSize:` (SPI) | `RenderCommandEncoder::set_point_size`: a no-op, as on Metal |
|
||||
| `SetProvokingVertexMode` | `setProvokingVertexMode:` (SPI) | `RenderCommandEncoder::set_provoking_vertex_mode`: modes 0 and 1 drawn as Metal draws them; every other mode, which Metal draws a third way, drawn as 1 (patches as 0), each draw Metal's third way draws otherwise announced (`provoking-vertex-unmatched`) *(partial)* |
|
||||
| `SetRenderPipelineState` | `setRenderPipelineState:` | `RenderCommandEncoder::set_render_pipeline_state` |
|
||||
|
||||
@@ -185,7 +185,6 @@ gap DecodedHeapTexture app an ASTC texture in a heap on a device without ASTC
|
||||
gap VertexFetchPast4GiB rare vertex fetch past 4 GiB of a bind offset
|
||||
gap StageInFetchPast4GiB rare stage-in fetch past 4 GiB of a bind offset
|
||||
apple ProtectedContent none Apple-private (no public header)
|
||||
apple LineWidth none Apple-private (no public header)
|
||||
apple ViewportTransformDisabled none Apple-private (no public header)
|
||||
apple VertexAmplificationMode none Apple-private (no public header)
|
||||
apple DepthCleared none Apple-private (no public header)
|
||||
@@ -235,3 +234,5 @@ feature SeqCstFence rare a seq_cst fence in a vertex or fragment stage without i
|
||||
gap MultisampledBufferCopy rare a buffer<->multisampled-texture copy on a device without sample-rate shading, an integer multisample attachment at the count, or the copy format's storage; and, where maintenance8's depth/colour copies are missing or wrong, what the sample-rate draws cannot move: a 16-bit depth on a driver whose codes the fragment-depth draw is not measured to keep, or a depth or stencil texture they cannot sample or render to (emulated elsewhere; the consumer's Maps pans and screensaver make the copy)
|
||||
gap MultisampledBufferLayout rare a buffer<->multisampled-texture copy at a bytesPerRow of 0 from an offset that is a multiple of 16, or of pixels of 32 bytes or more at a pitch below a row or off the pixel: Metal copies these by rules not yet reduced, and its API validation rejects them
|
||||
gap ColorAttachmentGroups app in a render pass of more color attachments than the device draws at once (five or more on a device of four), or one at an index past them: a pipeline state of other colors, a tile state, an execution of render commands, a draw reading another group's attachment
|
||||
feature WideLines none a line under the Apple-private setLineWidth: at a width other than 1 on a device without tessellationShader whose own lines do not draw it, or a band pipeline form not built (a selected slice or viewport, barycentric weights, multiview, synthesized geometry)
|
||||
gap WideLines none under the Apple-private setLineWidth: at a width other than 1, a triangle's edges or a mesh draw the device's own lines do not draw, an amplified band, or a line in a rate-mapped pass or an execution
|
||||
|
Can't render this file because it contains an unexpected character in line 126 and column 96.
|
@@ -181,6 +181,12 @@ CORE_PROPERTIES = {
|
||||
# Without `largePoints` a device's points are 1.0 (`pointSizeRange` (1.0, 1.0)), the
|
||||
# bound the reader takes for an absent range.
|
||||
"pointSizeRange": [1.0, 1.0],
|
||||
# Without `wideLines` a device's lines are 1.0 (`lineWidthRange` (1.0, 1.0),
|
||||
# `lineWidthGranularity` 0.0); subPixelPrecisionBits' guarantee is 4; strictLines none.
|
||||
"subPixelPrecisionBits": 4,
|
||||
"lineWidthRange": [1.0, 1.0],
|
||||
"lineWidthGranularity": 0.0,
|
||||
"strictLines": False,
|
||||
}}),
|
||||
"VkPhysicalDeviceVulkan11Properties": (1, {
|
||||
"subgroupSize": 1,
|
||||
|
||||
Reference in new issue
Block a user