web: the page's WebGPU device asks for GL 4.1's texture limits and GL 4.3's compute ones; the context is GL 4.6

The Mesa context in the page settled at GL 4.0 (GLSL 4.00), so Unity's
#version 410 geometry stages failed to compile. The decoder's version
report, now listing every unmet requirement from 4.1 to 4.6
(report_version_gap), named them on edger's P620: MaxTextureSize,
MaxRenderbufferSize and MaxCubeTextureLevels (16384 a side), and
MaxArrayTextureLayers (2048) for 4.1; ARB_compute_shader for 4.3 and
ARB_ES3_1_compatibility for 4.5 after it. Every extension was there. The
gaps were WebGPU's default limits (8192 texels, 256 layers, 256 compute
invocations, 16 KiB of workgroup memory), which a device gets unless it
asks: requestGexDevice now asks for 16384/2048 and 1024 invocations and
32 KiB, clamped to the adapter, and the same trace replays with
"negotiated desktop GL 4.6" and nothing missing. (707e84b8's version fit
stays for adapters below these limits, such as SwiftShader.)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_d2453757b8a84fdbb4ee7c9e093141df
This commit is contained in:
velzieandClaude Opus 5.5 committed 2026-10-08 11:05:27 -04:00
1 parent c39706baac
commit e204fa1b68
3 files changed
+110

No files matched your search

+80
View File
@@ -752,6 +752,86 @@ void report_version_gap() {
const struct gl_extensions& e = mesa_context->ctx->Extensions;
const unsigned have = mesa_context->ctx->Version;
/* Every requirement from GL 4.1 to 4.6 that is not met, not only the next
* rung's: what stands between this context and 4.6, in one list. The
* conditions are compute_version()'s (src/mesa/main/version.c). */
if (have >= 40) {
const struct gl_constants& c = mesa_context->ctx->Const;
struct need { unsigned version; const char* name; bool met; };
const need needs[] = {
{41, "MaxTextureSize >= 16384", c.MaxTextureSize >= 16384},
{41, "MaxRenderbufferSize >= 16384", c.MaxRenderbufferSize >= 16384},
{41, "MaxCubeTextureLevels >= 15", c.MaxCubeTextureLevels >= 15},
{41, "Max3DTextureLevels >= 12", c.Max3DTextureLevels >= 12},
{41, "MaxArrayTextureLayers >= 2048", c.MaxArrayTextureLayers >= 2048},
{41, "ARB_ES2_compatibility", (bool)e.ARB_ES2_compatibility},
{41, "ARB_shader_precision", (bool)e.ARB_shader_precision},
{41, "ARB_vertex_attrib_64bit", (bool)e.ARB_vertex_attrib_64bit},
{41, "ARB_viewport_array", (bool)e.ARB_viewport_array},
{42, "ARB_base_instance", (bool)e.ARB_base_instance},
{42, "ARB_conservative_depth", (bool)e.ARB_conservative_depth},
{42, "ARB_internalformat_query", (bool)e.ARB_internalformat_query},
{42, "ARB_shader_atomic_counters", (bool)e.ARB_shader_atomic_counters},
{42, "ARB_shader_image_load_store", (bool)e.ARB_shader_image_load_store},
{42, "ARB_shading_language_420pack", (bool)e.ARB_shading_language_420pack},
{42, "ARB_shading_language_packing", (bool)e.ARB_shading_language_packing},
{42, "ARB_texture_compression_bptc", (bool)e.ARB_texture_compression_bptc},
{42, "ARB_transform_feedback_instanced", (bool)e.ARB_transform_feedback_instanced},
{43, "vertex MaxUniformBlocks >= 14", c.Program[MESA_SHADER_VERTEX].MaxUniformBlocks >= 14},
{43, "ARB_ES3_compatibility", (bool)e.ARB_ES3_compatibility},
{43, "ARB_arrays_of_arrays", (bool)e.ARB_arrays_of_arrays},
{43, "ARB_compute_shader", (bool)e.ARB_compute_shader},
{43, "ARB_copy_image", (bool)e.ARB_copy_image},
{43, "ARB_explicit_uniform_location", (bool)e.ARB_explicit_uniform_location},
{43, "ARB_fragment_layer_viewport", (bool)e.ARB_fragment_layer_viewport},
{43, "ARB_framebuffer_no_attachments", (bool)e.ARB_framebuffer_no_attachments},
{43, "ARB_internalformat_query2", (bool)e.ARB_internalformat_query2},
{43, "ARB_robust_buffer_access_behavior", (bool)e.ARB_robust_buffer_access_behavior},
{43, "ARB_shader_image_size", (bool)e.ARB_shader_image_size},
{43, "ARB_shader_storage_buffer_object", (bool)e.ARB_shader_storage_buffer_object},
{43, "ARB_stencil_texturing", (bool)e.ARB_stencil_texturing},
{43, "ARB_texture_buffer_range", (bool)e.ARB_texture_buffer_range},
{43, "ARB_texture_query_levels", (bool)e.ARB_texture_query_levels},
{43, "ARB_texture_view", (bool)e.ARB_texture_view},
{44, "MaxVertexAttribStride >= 2048", c.MaxVertexAttribStride >= 2048},
{44, "ARB_buffer_storage", (bool)e.ARB_buffer_storage},
{44, "ARB_enhanced_layouts", (bool)e.ARB_enhanced_layouts},
{44, "ARB_query_buffer_object", (bool)e.ARB_query_buffer_object},
{44, "ARB_texture_mirror_clamp_to_edge", (bool)e.ARB_texture_mirror_clamp_to_edge},
{44, "ARB_texture_stencil8", (bool)e.ARB_texture_stencil8},
{44, "ARB_vertex_type_10f_11f_11f_rev", (bool)e.ARB_vertex_type_10f_11f_11f_rev},
{45, "ARB_ES3_1_compatibility", (bool)e.ARB_ES3_1_compatibility},
{45, "ARB_clip_control", (bool)e.ARB_clip_control},
{45, "ARB_conditional_render_inverted", (bool)e.ARB_conditional_render_inverted},
{45, "ARB_cull_distance", (bool)e.ARB_cull_distance},
{45, "ARB_derivative_control", (bool)e.ARB_derivative_control},
{45, "ARB_shader_texture_image_samples", (bool)e.ARB_shader_texture_image_samples},
{45, "NV_texture_barrier", (bool)e.NV_texture_barrier},
{46, "ARB_gl_spirv", (bool)e.ARB_gl_spirv},
{46, "ARB_spirv_extensions", (bool)e.ARB_spirv_extensions},
{46, "ARB_indirect_parameters", (bool)e.ARB_indirect_parameters},
{46, "ARB_polygon_offset_clamp", (bool)e.ARB_polygon_offset_clamp},
{46, "ARB_shader_atomic_counter_ops", (bool)e.ARB_shader_atomic_counter_ops},
{46, "ARB_shader_draw_parameters", (bool)e.ARB_shader_draw_parameters},
{46, "ARB_shader_group_vote", (bool)e.ARB_shader_group_vote},
{46, "ARB_texture_filter_anisotropic", (bool)e.ARB_texture_filter_anisotropic},
{46, "ARB_transform_feedback_overflow_query", (bool)e.ARB_transform_feedback_overflow_query},
};
for (const need& n : needs)
if (n.version > have && !n.met)
fprintf(stderr, "gex-wgpu: to 4.6: GL %u.%u wants %s\n",
n.version / 10, n.version % 10, n.name);
fprintf(stderr, "gex-wgpu: to 4.6: constants MaxTextureSize %u "
"MaxRenderbufferSize %u MaxCubeTextureLevels %u "
"Max3DTextureLevels %u MaxArrayTextureLayers %u "
"vertex MaxUniformBlocks %u MaxVertexAttribStride %u "
"glsl_feature_level %u\n",
c.MaxTextureSize, c.MaxRenderbufferSize, c.MaxCubeTextureLevels,
c.Max3DTextureLevels, c.MaxArrayTextureLayers,
c.Program[MESA_SHADER_VERTEX].MaxUniformBlocks,
c.MaxVertexAttribStride,
mesa_frontend_screen.screen->caps.glsl_feature_level);
}
/* The driver's advertised level, not ctx->Const.GLSLVersion: Mesa clamps
* that down to match the GL version it settled on, so reading it back
* would report the *consequence* of the version as if it were a cause. */
+15
View File
@@ -98,6 +98,21 @@
// sample, so any wider attachment set fails on it -- GL 3.2 wants
// eight draw buffers of whatever format the application chose.
maxColorAttachmentBytesPerSample: 64,
// GL 4.1 wants 16384 texels a side and 2048 array layers
// (compute_version), and WebGPU's defaults are 8192 and 256: without
// asking, every context settled at 4.0 and GLSL 4.00, and Unity's
// #version 410 geometry stages (Muck's grass) failed to compile. GL
// 4.3's compute shaders want 1024 invocations a workgroup and 32 KiB
// of shared memory (WebGPU: 256 and 16 KiB). All clamped to the adapter.
maxTextureDimension1D: 16384,
maxTextureDimension2D: 16384,
maxTextureDimension3D: 2048,
maxTextureArrayLayers: 2048,
maxComputeInvocationsPerWorkgroup: 1024,
maxComputeWorkgroupSizeX: 1024,
maxComputeWorkgroupSizeY: 1024,
maxComputeWorkgroupSizeZ: 64,
maxComputeWorkgroupStorageSize: 32768,
};
const requiredLimits = {};
for (const [limit, wanted] of Object.entries(want)) {
+15
View File
@@ -44,6 +44,21 @@ export function requestGexDevice() {
maxStorageBuffersInVertexStage: 16,
maxStorageBuffersInFragmentStage: 16,
maxColorAttachmentBytesPerSample: 64,
// GL 4.1 wants 16384 texels a side and 2048 array layers
// (compute_version), and WebGPU's defaults are 8192 and 256: without
// asking, every context settled at 4.0 and GLSL 4.00, and Unity's
// #version 410 geometry stages (Muck's grass) failed to compile. GL
// 4.3's compute shaders want 1024 invocations a workgroup and 32 KiB
// of shared memory (WebGPU: 256 and 16 KiB). All clamped to the adapter.
maxTextureDimension1D: 16384,
maxTextureDimension2D: 16384,
maxTextureDimension3D: 2048,
maxTextureArrayLayers: 2048,
maxComputeInvocationsPerWorkgroup: 1024,
maxComputeWorkgroupSizeX: 1024,
maxComputeWorkgroupSizeY: 1024,
maxComputeWorkgroupSizeZ: 64,
maxComputeWorkgroupStorageSize: 32768,
};
const requiredLimits = {};
for (const [limit, wanted] of Object.entries(want)) {