aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit c0098bd8f0bde327dc6d16e2a22002ccb28a2980
parent e447a943a2006b9af8e0c54cb7e4772b04ce2ac6
Author: anon <anon@example.com>
Date:   Thu, 15 Oct 2026 10:19:24 +0000

Support Linux startup vertex draws and Winsock byte order

Diffstat:
Mdecompiled/runtime/gl_renderer.c | 14+++++++++++++-
Mdecompiled/runtime/gl_renderer.h | 1+
Mdecompiled/runtime/linux_graphics.c | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
Mdecompiled/runtime/linux_network.c | 15+++++++++++++++
Mdecompiled/tests/devices.c | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mdecompiled/tests/network_startup.c | 35+++++++++++++++++++++++++++++++++++
Mtools/reconstruction/test_portable_devices.py | 4++--
7 files changed, 224 insertions(+), 28 deletions(-)

diff --git a/decompiled/runtime/gl_renderer.c b/decompiled/runtime/gl_renderer.c @@ -10,6 +10,7 @@ static GLuint program, vertex_array, vertex_buffer, index_buffer; static GLint texture_enabled, texture_alpha, texture_modulate, texture_modulate_alpha; static int depth_write = 1; static uint32_t depth_function = 4; +static uint32_t cull_mode = 1; struct gl_depth { unsigned width, height, references; GLuint buffer; @@ -250,7 +251,13 @@ void gl_target_draw(struct gl_target *target, const struct gl_vertex *vertices, glViewport(0, 0, target->width, target->height); glEnable(GL_SCISSOR_TEST); glScissor(clip[0], clip[1], clip[2], clip[3]); - glDisable(GL_CULL_FACE); + if (cull_mode == 1) glDisable(GL_CULL_FACE); + else { + glEnable(GL_CULL_FACE); + /* Guest clockwise winding becomes GL counterclockwise after the Y mapping. */ + glFrontFace(GL_CCW); + glCullFace(cull_mode == 2 ? GL_FRONT : GL_BACK); + } if (target->depth) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST); glDepthFunc(GL_NEVER + depth_function - 1); @@ -343,6 +350,11 @@ void gl_renderer_set_depth(int write, uint32_t function) depth_function = function; } +void gl_renderer_set_cull(uint32_t mode) +{ + cull_mode = mode; +} + static GLenum blend_factor(uint32_t factor) { /* Direct3D blend factors supported by the platform adapter. */ diff --git a/decompiled/runtime/gl_renderer.h b/decompiled/runtime/gl_renderer.h @@ -35,5 +35,6 @@ void gl_target_present(struct gl_target *target, const int32_t rectangle[4], int void gl_renderer_set_texture(const struct gl_texture_state *state); void gl_renderer_set_blend(int enabled, uint32_t source, uint32_t destination); void gl_renderer_set_depth(int write, uint32_t function); +void gl_renderer_set_cull(uint32_t mode); #endif diff --git a/decompiled/runtime/linux_graphics.c b/decompiled/runtime/linux_graphics.c @@ -40,7 +40,8 @@ static struct surface_object { } *surfaces; static struct device_object { uint32_t interface, references, cull; - uint32_t min_filter, mag_filter, mip_filter, address_u, address_v, color_op, alpha_op; + uint32_t min_filter, mag_filter, mip_filter, address, address_u, address_v, color_op, alpha_op; + uint32_t sampler_u, sampler_v; uint32_t alpha_arg2; uint32_t blend, source_blend, destination_blend, depth_write, depth_function, clipping, lighting; uint32_t material[17], viewport[6]; @@ -1137,8 +1138,9 @@ static void create_device(void) if (!device) abort(); device->interface = create_interface(6); device->references = 1; - device->cull = 3; /* D3DCULL_CCW default; drawing currently requires CULL_NONE. */ - device->min_filter = device->mag_filter = device->address_u = device->address_v = 1; + device->cull = 3; /* D3DCULL_CCW */ + device->min_filter = device->mag_filter = device->address = device->address_u = device->address_v = 1; + device->sampler_u = device->sampler_v = 1; device->mip_filter = 1; device->color_op = 4; device->alpha_op = 2; @@ -1371,7 +1373,7 @@ static void device_set_state(void) { struct device_object *device = find_device(MEM32(g_esp + 4)); uint32_t state = MEM32(g_esp + 8), value = MEM32(g_esp + 12); - if (state == 22 && (value == 1 || value == 3)) device->cull = value; + if (state == 22 && value >= 1 && value <= 3) device->cull = value; else if (state == 27 && value <= 1) device->blend = value; else if (state == 14 && value <= 1) device->depth_write = value; else if (state == 23 && value >= 1 && value <= 8) device->depth_function = value; @@ -1386,21 +1388,21 @@ static void device_set_state(void) g_esp += 16; } -static void device_draw_primitive(void) +static void draw_primitive(struct device_object *device, uint32_t primitive, uint32_t fvf, + uint32_t input, uint32_t count, uint32_t flags) { - struct device_object *device = find_device(MEM32(g_esp + 4)); - uint32_t primitive = MEM32(g_esp + 8), fvf = MEM32(g_esp + 12), input = MEM32(g_esp + 16); - uint32_t count = MEM32(g_esp + 20), flags = MEM32(g_esp + 24); - g_esp += 28; - if (primitive != 4 || (fvf != 0x44 && fvf != 0x144) || flags || device->cull != 1) { + if ((primitive != 4 && primitive != 5) || + ((fvf & ~0x80u) != 0x44 && (fvf & ~0x80u) != 0x144) || flags) { fprintf(stderr, "Unsupported Direct3D draw primitive=%u fvf=%08x flags=%08x cull=%u\n", primitive, fvf, flags, device->cull); exit(3); } g_eax = 0x80070057u; - if (!input || !count || count % 3 || count > 65535) return; + if (!input || count < 3 || (primitive == 4 && count % 3) || count > 65535) return; + uint32_t index_count = primitive == 4 ? count : (count - 2) * 3; struct gl_vertex *vertices = malloc(count * sizeof(*vertices)); - uint16_t *indices = malloc(count * sizeof(*indices)); + uint16_t *indices = malloc(index_count * sizeof(*indices)); if (!vertices || !indices) abort(); - uint32_t stride = fvf == 0x144 ? 28 : 20; + /* Specular input is inactive while D3DRENDERSTATE_SPECULARENABLE is false. */ + uint32_t uv_offset = 20 + (fvf & 0x80 ? 4 : 0), stride = uv_offset + (fvf & 0x100 ? 8 : 0); for (uint32_t i = 0; i < count; ++i) { float position[4]; memcpy(position, (void *)ADDR(input + i * stride), 16); @@ -1416,20 +1418,26 @@ static void device_draw_primitive(void) vertices[i].color[2] = (color & 255) / 255.0f; vertices[i].color[3] = (color >> 24) / 255.0f; vertices[i].uv[0] = vertices[i].uv[1] = 0; - if (fvf == 0x144) memcpy(vertices[i].uv, (void *)ADDR(input + i * stride + 20), 8); - indices[i] = i; + if (fvf & 0x100) memcpy(vertices[i].uv, (void *)ADDR(input + i * stride + uv_offset), 8); + } + if (primitive == 4) for (uint32_t i = 0; i < count; ++i) indices[i] = i; + else for (uint32_t i = 0; i < count - 2; ++i) { + indices[i * 3] = i + (i & 1); + indices[i * 3 + 1] = i + !(i & 1); + indices[i * 3 + 2] = i + 2; } if (device->texture && device->color_op != 1) { struct gl_texture_state state = {device->texture->target, device->min_filter == 2, device->mag_filter == 2, - device->address_u == 3, device->address_v == 3, + device->sampler_u == 3, device->sampler_v == 3, device->texture->alpha, device->color_op == 4, device->alpha_op == 4, device->mip_filter == 2}; gl_renderer_set_texture(&state); } else gl_renderer_set_texture(NULL); gl_renderer_set_blend(device->blend, device->source_blend, device->destination_blend); gl_renderer_set_depth(device->depth_write, device->depth_function); + gl_renderer_set_cull(device->cull); const int32_t clip[] = {device->viewport[0], device->viewport[1], device->viewport[2], device->viewport[3]}; - gl_target_draw(device->target->target, vertices, count, indices, count, clip); + gl_target_draw(device->target->target, vertices, count, indices, index_count, clip); gl_renderer_set_blend(0, 2, 1); gl_renderer_set_texture(NULL); free(indices); @@ -1437,6 +1445,15 @@ static void device_draw_primitive(void) g_eax = 0; } +static void device_draw_primitive(void) +{ + struct device_object *device = find_device(MEM32(g_esp + 4)); + uint32_t primitive = MEM32(g_esp + 8), fvf = MEM32(g_esp + 12), input = MEM32(g_esp + 16); + uint32_t count = MEM32(g_esp + 20), flags = MEM32(g_esp + 24); + g_esp += 28; + draw_primitive(device, primitive, fvf, input, count, flags); +} + static void device_set_texture(void) { struct device_object *device = find_device(MEM32(g_esp + 4)); @@ -1478,7 +1495,7 @@ static uint32_t texture_stage_state(struct device_object *device, uint32_t state case 4: return device->alpha_op; case 7: case 8: case 9: case 10: /* Inactive bump matrix. */ case 11: case 15: case 19: case 20: case 22: case 23: case 24: return 0; - case 12: return 1; /* Legacy ADDRESS is separate from ADDRESSU/V. */ + case 12: return device->address; case 13: return device->address_u; case 14: return device->address_v; case 16: return device->mag_filter; @@ -1512,9 +1529,17 @@ static void device_set_texture_state(void) if (state == 16 && (value == 1 || value == 2)) device->mag_filter = value; else if (state == 17 && (value == 1 || value == 2)) device->min_filter = value; else if (state == 18 && (value == 1 || value == 2)) device->mip_filter = value; - else if (state == 13 && (value == 1 || value == 3)) { + /* ADDRESS has an independent cache; only changed states update the sampler. */ + else if (state == 12 && (value == 1 || value == 3)) { + if (device->address != value) device->sampler_u = device->sampler_v = value; + device->address = value; + } else if (state == 13 && (value == 1 || value == 3)) { + if (device->address_u != value) device->sampler_u = value; device->address_u = value; - } else if (state == 14 && (value == 1 || value == 3)) device->address_v = value; + } else if (state == 14 && (value == 1 || value == 3)) { + if (device->address_v != value) device->sampler_v = value; + device->address_v = value; + } else if (state == 1 && (value == 1 || value == 2 || value == 4)) device->color_op = value; else if (state == 4 && (value == 2 || value == 4)) device->alpha_op = value; /* Stage zero's CURRENT and DIFFUSE both select interpolated vertex color. */ @@ -1604,6 +1629,19 @@ static void create_vertex_buffer(void) g_eax = 0; } +static void device_draw_vertex_buffer(void) +{ + struct device_object *device = find_device(MEM32(g_esp + 4)); + uint32_t primitive = MEM32(g_esp + 8); + struct vertex_buffer *buffer = find_vertex_buffer(MEM32(g_esp + 12)); + uint32_t start = MEM32(g_esp + 16), count = MEM32(g_esp + 20), flags = MEM32(g_esp + 24); + g_esp += 28; + g_eax = 0x80070057u; + if (start > buffer->count || count > buffer->count - start) return; + draw_primitive(device, primitive, buffer->fvf, + buffer->data + start * vertex_stride(buffer->fvf), count, flags); +} + static void vertex_buffer_query_interface(void) { struct vertex_buffer *buffer = find_vertex_buffer(MEM32(g_esp + 4)); @@ -1719,6 +1757,7 @@ recomp_func_t linux_graphics_virtual(uint32_t address) if (current_slot == 25) return device_draw_primitive; if (current_slot == 34) return device_get_texture; if (current_slot == 35) return device_set_texture; + if (current_slot == 31) return device_draw_vertex_buffer; if (current_slot == 36) return device_get_texture_state; if (current_slot == 37) return device_set_texture_state; return unavailable_method; diff --git a/decompiled/runtime/linux_network.c b/decompiled/runtime/linux_network.c @@ -1,8 +1,21 @@ #include "linux_network.h" +#include <arpa/inet.h> #include <unistd.h> static unsigned startup_count; +static void network_long(void) +{ + g_eax = htonl(MEM32(g_esp + 4)); + g_esp += 8; +} + +static void network_short(void) +{ + g_eax = htons((uint16_t)MEM32(g_esp + 4)); + g_esp += 8; +} + static void wsa_startup(void) { uint16_t requested = MEM32(g_esp + 4); @@ -75,6 +88,8 @@ recomp_func_t linux_network_lookup(const char *name, uint32_t ordinal) {"WSAStartup", 115, wsa_startup}, {"WSACleanup", 116, wsa_cleanup}, {"WSAGetLastError", 111, wsa_get_last_error}, {"WSASetLastError", 112, wsa_set_last_error}, {"gethostname", 57, host_name}, + {"htonl", 8, network_long}, {"htons", 9, network_short}, + {"ntohl", 14, network_long}, {"ntohs", 15, network_short}, }; for (unsigned i = 0; i < sizeof(functions) / sizeof(functions[0]); ++i) if (name ? !strcmp(name, functions[i].name) : ordinal == functions[i].ordinal) diff --git a/decompiled/tests/devices.c b/decompiled/tests/devices.c @@ -159,7 +159,8 @@ static void textured_triangles(uint32_t draw, uint32_t device, uint32_t target, assert(invoke(texture, 2, 1) == 1); const uint32_t blends[][3] = {{0, 2, 1}, {1, 5, 6}, {1, 6, 5}, {1, 1, 2}, {1, 2, 1}}; - for (unsigned scenario = 0; scenario < 40; ++scenario) { + for (unsigned legacy = 0; legacy <= 3; ++legacy) + for (unsigned scenario = 0; scenario < (legacy < 2 ? 40 : 4); ++scenario) { uint32_t filter = scenario & 1 ? 2 : 1, address = scenario & 2 ? 3 : 1; float span = scenario & 4 ? 16.25f : 1.75f; struct vertex { float x, y, z, rhw; uint32_t color; float u, v; } vertices[] = { @@ -180,10 +181,28 @@ static void textured_triangles(uint32_t draw, uint32_t device, uint32_t target, assert(!invoke(device, 20, 3, 20u, blends[scenario / 8][2])); assert(!invoke(device, 21, 3, 19u, workspace()) && *memory(workspace()) == blends[scenario / 8][1]); assert(!invoke(device, 21, 3, 20u, workspace()) && *memory(workspace()) == blends[scenario / 8][2]); - assert(!invoke(device, 37, 4, 0u, 13u, address)); - assert(!invoke(device, 37, 4, 0u, 14u, address)); - assert(!invoke(device, 36, 4, 0u, 13u, workspace()) && *memory(workspace()) == address); - assert(!invoke(device, 36, 4, 0u, 14u, workspace()) && *memory(workspace()) == address); + if (legacy < 2) { + assert(!invoke(device, 37, 4, 0u, 12u, legacy ? address : 1u)); + assert(!invoke(device, 37, 4, 0u, 13u, legacy ? 1u : address)); + assert(!invoke(device, 37, 4, 0u, 14u, legacy ? 1u : address)); + assert(!invoke(device, 36, 4, 0u, 12u, workspace()) && *memory(workspace()) == (legacy ? address : 1)); + assert(!invoke(device, 36, 4, 0u, 13u, workspace()) && *memory(workspace()) == (legacy ? 1 : address)); + assert(!invoke(device, 36, 4, 0u, 14u, workspace()) && *memory(workspace()) == (legacy ? 1 : address)); + } else if (legacy == 2) { + assert(!invoke(device, 37, 4, 0u, 12u, 3u)); + assert(!invoke(device, 37, 4, 0u, 13u, 3u)); + assert(!invoke(device, 37, 4, 0u, 14u, 3u)); + assert(!invoke(device, 37, 4, 0u, 13u, 1u)); + assert(!invoke(device, 37, 4, 0u, 14u, 1u)); + assert(!invoke(device, 36, 4, 0u, 12u, workspace()) && *memory(workspace()) == 3); + } else { + assert(!invoke(device, 37, 4, 0u, 12u, 1u)); + assert(!invoke(device, 37, 4, 0u, 13u, 3u)); + assert(!invoke(device, 37, 4, 0u, 14u, 3u)); + assert(!invoke(device, 37, 4, 0u, 12u, 1u)); + assert(!invoke(device, 36, 4, 0u, 13u, workspace()) && *memory(workspace()) == 3); + assert(!invoke(device, 36, 4, 0u, 14u, workspace()) && *memory(workspace()) == 3); + } assert(!invoke(device, 10, 7, 0u, 0u, 3u, 0xff102030u, 0x3f800000u, 0u)); assert(!invoke(d3d, 7, 1)); @@ -210,6 +229,80 @@ static void textured_triangles(uint32_t draw, uint32_t device, uint32_t target, invoke(d3d, 2, 1); } +static void vertex_buffer_draws_match_memory_draws(uint32_t draw, uint32_t device, uint32_t target, FILE *file) +{ + const uint32_t iid[] = {0xf5049e77, 0x11d24861, 0xa00007a4, 0xa82906c9}; + const uint32_t formats[] = {0x44, 0xc4, 0x144, 0x1c4}; + const unsigned strides[] = {20, 24, 28, 32}; + const float positions[][4] = {{4,4,.25f,1}, {28,4,.25f,1}, {4,28,.25f,1}, {28,28,.25f,1}}; + const unsigned list[] = {0,1,2,2,1,3}; + uint32_t d3d = query(draw, iid), desc = workspace() + 128, input = workspace() + 512; + assert(!invoke(device, 20, 3, 27u, 0u)); + assert(!invoke(device, 20, 3, 14u, 1u)); + assert(!invoke(device, 20, 3, 23u, 4u)); + for (unsigned format = 0; format < 4; ++format) + for (unsigned primitive = 4; primitive <= 5; ++primitive) for (unsigned reverse = 0; reverse <= 1; ++reverse) { + unsigned stride = strides[format], count = primitive == 4 ? 6 : 4; + uint32_t description[] = {16, 0x800, formats[format], 8}; + memcpy(memory(desc), description, 16); + assert(!invoke(d3d, 5, 4, desc, workspace(), 0u)); + uint32_t buffer = *memory(workspace()); + unsigned char original[256]; + memset(original, 0xa5, sizeof(original)); + for (unsigned i = 0; i < count; ++i) { + unsigned char *vertex = original + (i + 2) * stride; + float position[4]; + memcpy(position, positions[primitive == 4 ? list[i] : i], 16); + if (reverse) { float x = position[0]; position[0] = position[1]; position[1] = x; } + memcpy(vertex, position, 16); + uint32_t color = 0xff5a96d2, specular = 0xffffffff; + memcpy(vertex + 16, &color, 4); + if (formats[format] & 0x80) memcpy(vertex + 20, &specular, 4); + if (formats[format] & 0x100) { + const float uv[] = {.125f, .875f}; + memcpy(vertex + stride - 8, uv, 8); + } + } + memcpy(memory(input), original, stride * 8); + assert(!invoke(buffer, 3, 4, 0x1020u, workspace(), 0u)); + memcpy(memory(*memory(workspace())), original, stride * 8); + assert(!invoke(buffer, 4, 1)); + for (unsigned use_buffer = 0; use_buffer <= 1; ++use_buffer) for (unsigned cull = 1; cull <= 3; ++cull) { + assert(!invoke(device, 10, 7, 0u, 0u, 3u, 0xff102030u, 0x3f800000u, 0u)); + assert(!invoke(device, 20, 3, 22u, cull)); + assert(!invoke(device, 21, 3, 22u, workspace()) && *memory(workspace()) == cull); + assert(!invoke(device, 5, 1)); + if (use_buffer) assert(!invoke(device, 31, 6, primitive, buffer, 2u, count, 0u)); + else assert(!invoke(device, 25, 6, primitive, formats[format], input + 2*stride, count, 0u)); + assert(!invoke(device, 6, 1)); + + *memory(desc) = 124; + assert(!invoke(target, 25, 5, 0u, desc, 0x11u, 0u)); + uint32_t pixels = *memory(desc + 36), pitch = *memory(desc + 16); + uint32_t color = cull == (reverse ? 3 : 2) ? 0x102030 : 0x5a96d2; + assert((*memory(pixels + 10 * pitch + 10 * 4) & 0xffffff) == color); + assert((*memory(pixels + 23 * pitch + 23 * 4) & 0xffffff) == color); + assert((*memory(pixels) & 0xffffff) == 0x102030); + unsigned char rgb[32 * 32 * 3]; + for (unsigned y = 0; y < 32; ++y) for (unsigned x = 0; x < 32; ++x) { + uint32_t pixel = *memory(pixels + y * pitch + x * 4); + rgb[(y * 32 + x) * 3] = pixel >> 16; + rgb[(y * 32 + x) * 3 + 1] = pixel >> 8; + rgb[(y * 32 + x) * 3 + 2] = pixel; + } + assert(!invoke(target, 32, 2, 0u)); + assert(fwrite(rgb, 1, sizeof(rgb), file) == sizeof(rgb)); + } + assert(!invoke(buffer, 3, 4, 0x11u, workspace(), 0u)); + assert(!memcmp(memory(*memory(workspace())), original, stride * 8)); + assert(!invoke(buffer, 4, 1)); + /* Native drivers may retain the most recently submitted vertex buffer. */ + invoke(buffer, 2, 1); + } + assert(!invoke(device, 20, 3, 22u, 1u)); + invoke(d3d, 2, 1); +} + static void initial_device_states(uint32_t device) { const uint32_t states[][2] = { @@ -623,6 +716,7 @@ static void device_lifetime_and_rendering(const char *pixels_path) assert(!invoke(color, 32, 2, 0u)); assert(fwrite(rgb, 1, sizeof(rgb), file) == sizeof(rgb)); textured_triangles(draw, device, color, file); + vertex_buffer_draws_match_memory_draws(draw, device, color, file); rectangle_clears_preserve_outside_depth(device, color, file); depth_write_controls_occlusion(device, color); depth_comparisons_control_visibility(device, color); diff --git a/decompiled/tests/network_startup.c b/decompiled/tests/network_startup.c @@ -133,6 +133,38 @@ static void hostname_queries(int initialized) } } +static void byte_order(void) +{ + const char *names[] = {"htonl", "htons", "ntohl", "ntohs"}; + const unsigned ordinals[] = {8, 9, 14, 15}; + const uint32_t longs[] = {0, 1, 0x7f000001, 0x12345678, 0x80000000, 0xffffffff}; + const uint32_t expected[] = {0, 0x01000000, 0x0100007f, 0x78563412, 0x80, 0xffffffff}; + for (unsigned operation = 0; operation < 4; ++operation) { +#ifdef _WIN32 + HMODULE library = GetModuleHandleA("ws2_32.dll"); + FARPROC function = GetProcAddress(library, names[operation]); + assert(function == GetProcAddress(library, (const char *)(uintptr_t)ordinals[operation])); +#else + assert(linux_network_lookup(names[operation], 0) == linux_network_lookup(NULL, ordinals[operation])); +#endif + for (unsigned i = 0; i < (operation & 1 ? 65536 : 6); ++i) { + uint32_t value = operation & 1 ? i : longs[i]; + set_error(777); + +#ifdef _WIN32 + uint32_t result = operation & 1 + ? ((u_short (WSAAPI *)(u_short))function)(value) + : ((u_long (WSAAPI *)(u_long))function)(value); +#else + uint32_t result = call(ordinals[operation], 1, &value); +#endif + + assert(result == (operation & 1 ? ((i & 255) << 8) | (i >> 8) : expected[i])); + assert(get_error() == 777); + } + } +} + int main(void) { #ifdef _WIN32 @@ -146,6 +178,7 @@ int main(void) assert(linux_network_lookup("WSAStartup", 0) == linux_network_lookup(NULL, 115)); assert(linux_network_lookup("gethostname", 0) == linux_network_lookup(NULL, 57)); #endif + byte_order(); hostname_queries(0); cleanup(-1); const struct { uint16_t version; uint32_t error; } versions[] = { @@ -156,6 +189,7 @@ int main(void) for (unsigned i = 0; i < 11; ++i) initialized += startup(versions[i].version, versions[i].error) == 0; assert(initialized == 9); hostname_queries(1); + byte_order(); for (unsigned i = 0; i < initialized; ++i) cleanup(0); cleanup(-1); assert(startup(2, 0) == 0); @@ -165,5 +199,6 @@ int main(void) hostname_queries(0); printf("network startup: 12 negotiations, WSADATA32 layout, nested cleanup and errors, digest %08x\n", digest); puts("hostname: 24 buffer and initialization cases, native host name and guest ABI passed"); + puts("byte order: all 16-bit values and six 32-bit cases, before/after startup, errors preserved"); return 0; } diff --git a/tools/reconstruction/test_portable_devices.py b/tools/reconstruction/test_portable_devices.py @@ -25,8 +25,8 @@ actual = subprocess.check_output(wsl + ["env", "GALLIUM_DRIVER=d3d12", linux_wor assert actual == expected, (expected, actual) windows_pixels = (work / "reference.rgb").read_bytes() linux_pixels = (work / "native.rgb").read_bytes() -assert len(windows_pixels) == len(linux_pixels) == 543744 +assert len(windows_pixels) == len(linux_pixels) == 1428480 error = max(abs(a - b) for a, b in zip(windows_pixels, linux_pixels)) assert error <= 1, error print("Windows == Linux: " + actual.strip()) -print("All 181248 pixels agree within one 8-bit channel step; maximum error:", error) +print("All 476160 pixels agree within one 8-bit channel step; maximum error:", error)