diff --git a/docs/maxwell.md b/docs/maxwell.md index b173af4b..e2758b6a 100644 --- a/docs/maxwell.md +++ b/docs/maxwell.md @@ -174,7 +174,10 @@ Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the gr where the driver keeps NaNs (3.13). 14. **Point size / line width.** Census: `SetLineWidth 4.5` ~1/frame (2 line draws into a 144x144 R8 target), `SetPointSize 5` ~14/frame; 4 point VS rely on it. Point size: translator patch 0008 reads it from the support - buffer, **fixed**. Line width: 1 px, non-default values logged (`nvn_ext.c`), **mismatch, minor**. + buffer, **fixed**. Line width: recorded with the draw state (`nvn_api_cmd.c`, `OP_BIND_STATE` kind 7) and set as + dynamic state for draws of the line topology class (`vk_pipeline.c` `vk_pipeline_line_width`), held to the + device's `lineWidthRange`; 1 px on a device without `wideLines` and for triangles drawn in the line polygon mode. + **Implemented; not compared with the hardware's wide-line coverage.** 15. **Block height.** `nvn_tex.c` truncates like NVN (2.1); every other step of the layout matches. **OK.** 16. **Depth mode and clamp.** `vk_pipeline.c` `create_graphics` (`negativeOneToOne` from `nvn_depth_minus_w`, `depthClampEnable` from NVN state). Matches the hardware z maths (1.5) and clamp switch (1.6). **OK.** diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 99ca6beb..d57fa19b 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -313,6 +313,9 @@ # drawn as a rectangle over solid ground at the Hyrule Castle moat and the Castle Town canal from some camera # positions, and can turn into a red beam there. 0: the water's shaders as they are. # water_projective = 1 +# Lines are drawn as wide as the game sets them (it draws two a frame 4.5 pixels wide into a small mask). 0: every +# line 1 pixel wide, as up to 0.9.1. +# line_width = 1 # Optimisations, 0 turns each off: skip bindings that did not change, remember shader lookups, reuse the previous # draw's pipeline when its state repeats, remember texture descriptors between draws, update descriptors in bulk, # skip push constants that did not change. diff --git a/runtime/cfg.c b/runtime/cfg.c index eb36aad7..98f71229 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -54,7 +54,7 @@ static const char *const known[] = { "HDR_BLOWOUT", "HDR_CONTRAST", "HDR_EXPOSURE", "HDR_FLARE", "HDR_GAMMA", "HDR_GRADE", "HDR_HIGHLIGHT_SAT", "HDR_HIGHLIGHTS", "HDR_HUE", "HDR_HUE_CLIP", "HDR_MATCH_SLOPE", "HDR_MIDGRAY", "HDR_SATURATION", "HDR_SHADOWS", "HDR_TONEMAP", "HDR_TONE_SLOPE", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "LANG", "LIB_PREBUILD", - "BIG_BUILD_FREE_MB", "BIG_BUILD_MAX_MB", "BUILD_FREE_MB", "BUILD_RESERVE_MB", "LIB_PREBUILD_BIG", "LIB_PREBUILD_BIG_BG", "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LIB_WARM", "PIPE_LINK_MS", "FRAME_HOLD_MS", "PACE_SMOOTH", "OQ_BATCH", "GATE_WAIT_MS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MEM_CENSUS", "MEM_NEED_MB", "MENU_LANG", "MENU_SOUND_VOLUME", "MENU_TEST", + "BIG_BUILD_FREE_MB", "BIG_BUILD_MAX_MB", "BUILD_FREE_MB", "BUILD_RESERVE_MB", "LIB_PREBUILD_BIG", "LIB_PREBUILD_BIG_BG", "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LIB_WARM", "LINE_WIDTH", "PIPE_LINK_MS", "FRAME_HOLD_MS", "PACE_SMOOTH", "OQ_BATCH", "GATE_WAIT_MS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MEM_CENSUS", "MEM_NEED_MB", "MENU_LANG", "MENU_SOUND_VOLUME", "MENU_TEST", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_CLICK", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MICROPHONE", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MONITOR", "MOTION", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOUSE_TRACE", "MOVIE_HOST", "MOVIE_PACE", "MOVIE_CLOCK", "TEST_HITCH", "MVOBJ_ALL", "MVOBJ_BANKS", "MVOBJ_EQUAL", "MVOBJ_EXACT", "MVOBJ_EXEC", "MVOBJ_NOC4", "MVOBJ_ONLY", "MVOBJ_TIMES", "MVPREV_CHECK", "MVPREV_GROW", "MVPREV_SKIP", "MVPREV_TRUST", "MV_CHECK", "MV_SURVEY", @@ -132,7 +132,7 @@ static const struct { const char *key, *section; } sections[] = { {"TIMER_1MS", "performance"}, {"PIPE_WAIT", "performance"}, {"PIPE_SKIP", "performance"}, {"ONESHOT_BUDGET", "performance"}, {"PIPE_FRAME_WAIT_MS", "performance"}, {"PIPE_SKIP_STEADY", "performance"}, {"CACHE_DIE", "performance"}, {"ONE_PER_CORE", "performance"}, - {"LIB_PREBUILD", "performance"}, {"LIB_PREBUILD_THREADS", "performance"}, {"LIB_WARM", "performance"}, {"PIPE_LINK_MS", "performance"}, {"PIPE_LINK_DRAW_MS", "performance"}, {"PIPE_AHEAD", "performance"}, {"PIPE_FAST_WORKERS", "performance"}, {"GPL_FEEDBACK", "performance"}, {"FRAME_HOLD_MS", "performance"}, {"PACE_SMOOTH", "performance"}, {"OQ_BATCH", "performance"}, {"GATE_WAIT_MS", "performance"}, {"PIPE_PREBUILD", "performance"}, {"PIPE_SEED", "performance"}, + {"LIB_PREBUILD", "performance"}, {"LIB_PREBUILD_THREADS", "performance"}, {"LIB_WARM", "performance"}, {"PIPE_LINK_MS", "performance"}, {"PIPE_LINK_DRAW_MS", "performance"}, {"PIPE_AHEAD", "performance"}, {"LINE_WIDTH", "performance"}, {"PIPE_FAST_WORKERS", "performance"}, {"GPL_FEEDBACK", "performance"}, {"FRAME_HOLD_MS", "performance"}, {"PACE_SMOOTH", "performance"}, {"OQ_BATCH", "performance"}, {"GATE_WAIT_MS", "performance"}, {"PIPE_PREBUILD", "performance"}, {"PIPE_SEED", "performance"}, {"COMPUTE_KEEP", "performance"}, {"PREWARM_XLATE", "performance"}, {"GPL", "performance"}, {"ASTC", "performance"}, {"MEMORY", "performance"}, {"TEX_ALIAS", "performance"}, {"DEPTH_INIT_INLINE", "performance"}, {"DEPTH_ALIAS_LOG", "diagnostics"}, {"TEX_DISUSE", "performance"}, {"TEX_DISUSE_EVICT", "performance"}, {"TEX_GEN_UNDO", "performance"}, {"TEX_REUSE", "performance"}, {"TEX_SPLIT_FILL", "performance"}, {"TEX_VRAM_PRESSURE", "performance"}, {"TEX_PROC_COMMIT_MB", "performance"}, {"ASTC_BC", "performance"}, {"LOD_GUARD", "performance"}, {"FIX_C0", "performance"}, {"FIX_ZERO", "performance"}, {"WATER_PROJECTIVE", "performance"}, @@ -271,6 +271,7 @@ static const CfgMeta metas[] = { {"MESH_FALLBACK", "auto", "auto|0|1", RESTART}, {"MESH_FALLBACK_MB", "128", "16..4096", RESTART}, {"MESH_FALLBACK_WORKERS", "auto", "auto|1|2|3|4", RESTART}, // vk_exec_draw.c mfb_worker_count {"PIPE_AHEAD", "1", "0|1", RESTART}, // vk_exec.c vk_exec_ahead, vk_pipeline.c vk_pipeline_hint + {"LINE_WIDTH", "1", "0|1", RESTART}, // vk_pipeline.c key_lines {"GPL_FEEDBACK", "1", "0|1", RESTART}, // vk_pipeline.c gpl_feedback {"PIPE_FAST_WORKERS", "1", "0|1", RESTART}, // vk_pipeline.c lib_worker, fast_take {"FRAME_HOLD_MS", "120", "0..500", RESTART}, // vk_backend.c frame_hold diff --git a/runtime/nvn_api_cmd.c b/runtime/nvn_api_cmd.c index e3a11d6e..257f1ff4 100644 --- a/runtime/nvn_api_cmd.c +++ b/runtime/nvn_api_cmd.c @@ -902,6 +902,13 @@ NVN_API(nvnCommandBufferSetPointSize) { r->kind = 6; memcpy(r->bytes, &s, sizeof s); } +// void nvnCommandBufferSetLineWidth(NVNcommandBuffer *cmd, float width): bind-state kind 7, as the point size +NVN_API(nvnCommandBufferSetLineWidth) { + p_bind_state *r = REC(cmd_of(c), OP_BIND_STATE, p_bind_state); + float w = arg_s(c, 0); + r->kind = 7; + memcpy(r->bytes, &w, sizeof w); +} // void nvnCommandBufferBindVertexAttribState(NVNcommandBuffer *cmd, int n, const NVNvertexAttribState *states) NVN_API(nvnCommandBufferBindVertexAttribState) { cmd_t *o = cmd_of(c); diff --git a/runtime/nvn_ext.c b/runtime/nvn_ext.c index 238f0789..40b5e17a 100644 --- a/runtime/nvn_ext.c +++ b/runtime/nvn_ext.c @@ -379,16 +379,12 @@ NVN_API(nvnVertexStreamStateGetStride) { ret_x(c, ST(vs_st)->stride); } NVN_API(nvnVertexStreamStateGetDivisor) { ret_x(c, ST(vs_st)->divisor); } #undef ST -// ---------- rasterisation state without a host equivalent: lines are 1 pixel wide and point size comes from the vertex -// shader. Non-default values are reported once; the drawing proceeds without them. +// ---------- rasterisation state without a host equivalent. Non-default values are reported once; the drawing proceeds +// without them. #define ONCE(...) do { static int once_; if (!once_++) rt_log("nvn: " __VA_ARGS__); } while (0) -// void nvnCommandBufferSetLineWidth / SetPointSize(NVNcommandBuffer *cmd, float value) -NVN_API(nvnCommandBufferSetLineWidth) { - float w = arg_s(c, 0); - if (w != 1.0f) ONCE("SetLineWidth %g: lines are drawn 1 pixel wide", w); -} -// SetPointSize is recorded in nvn_api_cmd.c (OP_BIND_STATE kind 6): the replay feeds it to the vertex shaders through the -// support buffer (translator patch 0008). +// SetPointSize and SetLineWidth are recorded in nvn_api_cmd.c (OP_BIND_STATE kinds 6 and 7): the replay feeds the point +// size to the vertex shaders through the support buffer (translator patch 0008) and sets the line width for the draws +// of lines (vk_pipeline.c vk_pipeline_line_width). // void nvnCommandBufferSetConservativeRasterEnable(NVNcommandBuffer *cmd, NVNboolean enable) NVN_API(nvnCommandBufferSetConservativeRasterEnable) { if (nvn_arg_bool(c, 1)) ONCE("conservative rasterisation requested: drawn normally"); diff --git a/runtime/nvn_obj.h b/runtime/nvn_obj.h index 526ea503..ca80ff3a 100644 --- a/runtime/nvn_obj.h +++ b/runtime/nvn_obj.h @@ -142,7 +142,7 @@ typedef struct { int32_t mode; int32_t pad; uint64_t addr; } p_render_cond; // typedef struct { int32_t enable; uint32_t index; } p_prim_restart; // SetPrimitiveRestart: indexed strips restart at index typedef struct { float n, f; } p_depth_range; typedef struct { const prog_t *prog; int32_t stages; } p_bind_program; -typedef struct { int32_t kind; uint8_t bytes[0x18]; } p_bind_state; // kind: 0 blend 1 color 2 chmask 3 ms 4 poly 5 ds 6 point size (float) +typedef struct { int32_t kind; uint8_t bytes[0x18]; } p_bind_state; // kind: 0 blend 1 color 2 chmask 3 ms 4 poly 5 ds 6 point size (float) 7 line width (float) typedef struct { int32_t first, n; uint32_t st[16]; } p_bind_vattr; typedef struct { int32_t first, n; vs_st st[16]; } p_bind_vstream; typedef struct { int32_t first, n; NVNbufferRange r[16]; } p_bind_vbuf; diff --git a/runtime/vk.h b/runtime/vk.h index 292f4453..16a86659 100644 --- a/runtime/vk.h +++ b/runtime/vk.h @@ -871,6 +871,9 @@ VkPipeline vk_pipeline_compute(const GfxShader *cs, const VkPipeInfo **info); // write masks and references; vertex buffers with vkCmdBindVertexBuffers2 (strides NULL when // vk_pipeline_vertex_input_dynamic(), else from VkPipeState.vstream). void vk_pipeline_set_dynamic(VkCommandBuffer cb, const VkPipeState *s); +// The line width for a draw of lines with the state s (width in pixels as the game set it; 0 = 1): recorded when s +// draws lines and the device has wide lines, whose pipelines take the width as dynamic state. Nothing otherwise. +void vk_pipeline_line_width(VkCommandBuffer cb, const VkPipeState *s, float width); // Vertex input as vkCmdSetVertexInputEXT takes it (vk_pipeline.c vertex_input). typedef struct { uint32_t n_attr, n_bind; diff --git a/runtime/vk_exec.h b/runtime/vk_exec.h index 47fa8696..3df3b9da 100644 --- a/runtime/vk_exec.h +++ b/runtime/vk_exec.h @@ -79,6 +79,7 @@ typedef struct VkExec { float depth_range[2]; // OP_DEPTH_RANGE: overrides the viewports' near and far uint32_t st_vmask[2], st_wmask[2], st_ref[2]; // OP_STENCIL per face (0 front, 1 back): compare mask, write mask, ref float point_size; // OP_BIND_STATE kind 6: NVN point size for the support buffer; 0 = never set = 1 + float line_width; // OP_BIND_STATE kind 7: NVN line width in pixels; 0 = never set = 1 p_poly_offset poly_offset; // OP_POLY_OFFSET: depth bias factor, units, clamp p_prim_restart prim_restart; // OP_PRIM_RESTART: applied to indexed strip and fan draws (op_draw_idx) float blend_color[4]; // OP_BLEND_COLOR diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index 0c588229..d9ef4e84 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -4331,6 +4331,7 @@ static int prepare_draw_ex(VkExec *ex, int prim, int32_t count, int restart, int cx->B.st = s, cx->B.st_valid = 1; if (ex->mark && vk_exec_frame.draws == ex->mark_draws0) ex->mark->first[0] = vs, ex->mark->first[1] = fs; } + vk_pipeline_line_width(ex->cb, &s, ex->line_width); // a draw of lines: the game's width; else nothing if (!mesh) { vk_dlaa_draw(ex); vk_mvsurvey_draw(ex); @@ -6456,6 +6457,7 @@ static void op_draw_impl(VkExec *ex, uint32_t op, const void *payload) { case 4: memcpy(&ex->pipe.poly, b->bytes, sizeof ex->pipe.poly); break; case 5: memcpy(&ex->pipe.ds, b->bytes, sizeof ex->pipe.ds); break; case 6: memcpy(&ex->point_size, b->bytes, sizeof ex->point_size); break; + case 7: memcpy(&ex->line_width, b->bytes, sizeof ex->line_width); break; } break; } diff --git a/runtime/vk_pipeline.c b/runtime/vk_pipeline.c index 15a41f5e..225bd84f 100644 --- a/runtime/vk_pipeline.c +++ b/runtime/vk_pipeline.c @@ -84,6 +84,8 @@ static struct { int vs_outs_all; // NX2NAVI_VS_OUTS: 0 union of paired fragment inputs, 1 (all) all 32 output locations int dyn_vi, dyn_clamp, dyn_poly, dyn_blend_en, dyn_blend_eq, dyn_wmask, dyn_a2c; int f_logic_op, f_depth_clamp, f_fill_non_solid, f_dual_src, f_full_subgroups; + int wide_lines; // the device draws lines of other widths than 1 (vk_pipeline_line_width) + float line_w[2], line_gran; // its range of widths and their step int cache_control; // pipelineCreationCacheControl: a create can ask for the pipeline caches only int feedback; // NX2NAVI_PIPE_FEEDBACK: 1 count pipeline cache hits, 2 also log each compute and graphics build uint64_t cache_loaded; // bytes of pipeline-cache.bin the driver took at boot @@ -958,6 +960,12 @@ static int ensure_init(void) { P.f_depth_clamp = f2.features.depthClamp; P.f_fill_non_solid = f2.features.fillModeNonSolid; P.f_dual_src = f2.features.dualSrcBlend; + P.wide_lines = f2.features.wideLines && cfg_bool("NX2NAVI_LINE_WIDTH"); + P.line_w[0] = c->props.limits.lineWidthRange[0], P.line_w[1] = c->props.limits.lineWidthRange[1]; + P.line_gran = c->props.limits.lineWidthGranularity; + if (!P.wide_lines) + rt_log("vk_pipeline: lines are drawn 1 pixel wide whatever width the game sets (%s)", + f2.features.wideLines ? "NX2NAVI_LINE_WIDTH=0" : "this device has no wide lines"); #define PROC(field, name) (P.field = (void *)vk_dpa(c->device, name)) PROC(push, "vkCmdPushDescriptorSetKHR"); // Descriptor update templates (core 1.1; the push variant comes with VK_KHR_push_descriptor on 1.1): the driver @@ -3106,6 +3114,29 @@ static int water_mode(const VkPipeState *s, const GKey *k) { return mode == 1 && k->dsb ? 0 : mode; } +// ---- line width (NX2NAVI_LINE_WIDTH, default 1; 0: every line 1 pixel wide, as before) +// The game sets a width for its lines (nvnCommandBufferSetLineWidth, recorded as OP_BIND_STATE kind 7): 4.5 pixels +// for two line draws a frame into a 144x144 R8 target, which were drawn 1 pixel wide. A pipeline of the line topology +// class lists the width as dynamic state, in its whole build and in its pre-rasterization library (PrKey.lines), and +// each draw of lines records the width the game set, held to the device's range. Pipelines of the other classes are +// built as before, so their entries in the pipeline caches and the driver's stay the ones in use. A polygon mode that +// draws triangles as lines keeps 1 pixel: the mode can be dynamic state, which no pipeline key tells apart. +static int key_lines(const GKey *k) { return P.wide_lines && k->topo_class == 1; } + +void vk_pipeline_line_width(VkCommandBuffer cb, const VkPipeState *s, float width) { + if (!P.wide_lines || is_mesh(s) || topology_class(vk_pipeline_topology(s->prim)) != 1) return; + float w = width > 0 ? width : 1.0f; + if (P.line_gran > 0) w = P.line_w[0] + P.line_gran * (float)(int)((w - P.line_w[0]) / P.line_gran + 0.5f); + w = w < P.line_w[0] ? P.line_w[0] : w > P.line_w[1] ? P.line_w[1] : w; + static float logged; + if (w != 1.0f && w != logged) { // one line for each width in a row: the game uses one or two + logged = w; + rt_log("vk_pipeline: lines drawn %g pixels wide (the game set %g; the device draws %g to %g in steps of %g)", + (double)w, (double)width, (double)P.line_w[0], (double)P.line_w[1], (double)P.line_gran); + } + vkCmdSetLineWidth(cb, w); +} + static VkPipeline create_graphics(const VkPipeState *s, const GKey *k, const Layout *l, uint32_t fs_off) { VkShaderModule vm = VK_NULL_HANDLE, fm = VK_NULL_HANDLE; uint64_t vw, fw, vm_hash = 0, fm_hash = 0; // the hashes: of the final modules, for the PIPE_FEEDBACK 2 line @@ -3244,6 +3275,11 @@ static VkPipeline create_graphics(const VkPipeState *s, const GKey *k, const Lay VkPipelineDynamicStateCreateInfo dy = {.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, .dynamicStateCount = P.n_dyn, .pDynamicStates = P.dyn}; VkDynamicState mdyn[sizeof P.dyn / sizeof P.dyn[0] + 1]; + if (!mesh && key_lines(k)) { // lines take the game's width per draw (vk_pipeline_line_width) + memcpy(mdyn, P.dyn, P.n_dyn * sizeof *mdyn); + mdyn[P.n_dyn] = VK_DYNAMIC_STATE_LINE_WIDTH; + dy.dynamicStateCount = P.n_dyn + 1, dy.pDynamicStates = mdyn; + } if (mesh) { // a mesh pipeline must not list vertex input, topology or primitive restart as dynamic uint32_t n = 0; for (uint32_t i = 0; i < P.n_dyn; i++) @@ -3331,7 +3367,9 @@ typedef struct Lib { struct Lib *next; uint64_t hash; VkPipeline pipe; uint32_t static Lib *libs[LIB_BUCKETS]; typedef struct { uint32_t kind, topo_class, attr_fmt[32], attr_off[32]; uint8_t attr_bind[32], rate[17], pad[3]; } ViKey; -typedef struct { uint32_t kind, missing; const GfxShader *vs; uint8_t clamp, poly_mode, minus_w, water_projective; GfxShaderIo fin[32]; } PrKey; +typedef struct { uint32_t kind, missing; const GfxShader *vs; uint8_t clamp, poly_mode, minus_w, water_projective; + uint8_t lines; // key_lines: the library lists the line width as dynamic state + GfxShaderIo fin[32]; } PrKey; typedef struct { uint32_t kind; uint8_t dsb, samples, a2c, water_projective; const GfxShader *fs; } FsKey; typedef struct { uint32_t kind; uint8_t n_color, samples, a2c, logic_op, blend_en, fbl, pad[2]; uint32_t color[8], depth, stencil, wmask; uint8_t blend[8][6]; } FoKey; // fbl: GKey.fbl, the feedback loop flags of the library (gpl_feedback) @@ -3360,6 +3398,12 @@ static VkPipeline lib_create(int kind, const VkPipeState *s, const GKey *k, VkPi .dynamicStateCount = P.n_dyn, .pDynamicStates = P.dyn}; VkGraphicsPipelineCreateInfo pi = {.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, .pNext = &ri, .flags = VK_PIPELINE_CREATE_LIBRARY_BIT_KHR | noopt_flag(), .pDynamicState = &dy}; + VkDynamicState ldyn[sizeof P.dyn / sizeof P.dyn[0] + 1]; + if (kind == LIB_PR && ((const PrKey *)key)->lines) { // the rasterization state is this library's: as create_graphics + memcpy(ldyn, P.dyn, P.n_dyn * sizeof *ldyn); + ldyn[P.n_dyn] = VK_DYNAMIC_STATE_LINE_WIDTH; + dy.dynamicStateCount = P.n_dyn + 1, dy.pDynamicStates = ldyn; + } VkShaderModule m = VK_NULL_HANDLE; VkPipelineShaderStageCreateInfo st = {.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .pName = "main"}; VkPipelineShaderStageRequiredSubgroupSizeCreateInfo rq; @@ -3627,6 +3671,7 @@ static void lib_keys(const VkPipeState *s, const GKey *k, ViKey *v, PrKey *pk, F memset(pk, 0, sizeof *pk); GfxShaderIo fin[32]; pk->kind = LIB_PR, pk->vs = s->vs, pk->clamp = k->clamp, pk->poly_mode = k->poly_mode, pk->minus_w = k->minus_w; + pk->lines = (uint8_t)key_lines(k); pk->missing = vs_union_missing(s, fin); for (int i = 0; i < 32; i++) if (pk->missing >> i & 1) pk->fin[i] = fin[i];