code wiki / (root) / nx_gpu_choice_workspace_t48.nx

nx_gpu_choice_workspace_t48.nx

buildroot/runtime/nx_gpu_choice_workspace_t48.nx

4446 B2 linesdepth 0pulls 0 transitivereach 160 importersview sourcekind librarytopic gpu
docsdependenciesstructsconstsfunctions

about

Reusable browser graphics control emitted by Nishi; OS preferences remain an explicit user action.

dependencies 0 imports · 49 importers

nx_gpu_choice_workspace_t48.nx nx_game_page_affine_candidate_t361 nx_game_page_authored_material_t54 nx_game_page_body_t138.nx nx_game_page_canonical_t135.nx nx_game_page_catwalk_lighting_cand nx_game_page_eye_t138.nx nx_game_page_gait_candidate_t139.n nx_game_page_garment_t132.nx nx_game_page_hair_attachment_candi nx_game_page_hair_attachment_t283.

diagram shows first 10 each side; +0 more imports, +39 more importers in the complete lists below.

imports: none

imported by: nx_game_page_affine_candidate_t361.nxnx_game_page_authored_material_t54.nxnx_game_page_body_t138.nxnx_game_page_canonical_t135.nxnx_game_page_catwalk_lighting_candidate_t316.nxnx_game_page_eye_t138.nxnx_game_page_gait_candidate_t139.nxnx_game_page_garment_t132.nxnx_game_page_hair_attachment_candidate_t263.nxnx_game_page_hair_attachment_t283.nxnx_game_page_hair_guides_candidate_t263.nxnx_game_page_hair_t138.nxnx_game_page_host_candidate_t341.nxnx_game_page_imported_t262.nxnx_game_page_inspection_distance_t235.nxnx_game_page_inspection_t142.nxnx_game_page_integrated_t73.nxnx_game_page_length_diag_t140.nxnx_game_page_lit_candidate_t181.nxnx_game_page_material_body_t61.nxnx_game_page_material_candidate_t181.nxnx_game_page_material_compose_t55.nxnx_game_page_material_schema_candidate_t181.nxnx_game_page_metadata_candidate_t220.nxnx_game_page_mip_candidate_t241.nxnx_game_page_motion_candidate_t328.nxnx_game_page_motion_inventory_candidate_t330.nxnx_game_page_move_t72.nxnx_game_page_owned_candidate_t181.nxnx_game_page_pipeline_t64.nxnx_game_page_pre_inspection_t142.nxnx_game_page_pre_toon_region_t143.nxnx_game_page_procedural_review_candidate_t333.nxnx_game_page_rig_comparison_t332.nxnx_game_page_rig_inspection_t230.nxnx_game_page_rig_observation_candidate_t331.nxnx_game_page_scene_light_candidate_t364.nxnx_game_page_search_t53.nxnx_game_page_shared_candidate_t340.nxnx_game_page_skin_t138.nxnx_game_page_static_candidate_t338.nxnx_game_page_toon_region_candidate_t143.nxnx_game_page_visitors_inspection_t142.nxnx_game_page_visitors_t140.nxnx_game_page_workbench_candidate_t342.nxnx_game_page_workspace_body_t49.nxnx_game_page_workspace_body_t59.nxnx_game_page_workspace_t48.nxnx_movement_base_page_t139.nx

structs

none

consts

none

functions

2func ngc_source() -> *u8 { return "const NX_GPU_CHOICES=[['default','Browser default'],['high-performance','High performance'],['low-power','Power saving']];\nfunction nxGpuPreference(){const v=new URL(location.href).searchParams.get('gpuPreference');return NX_GPU_CHOICES.some(x=>x[0]===v)?v:'high-performance';}\nfunction nxGpuAdapterOptions(){const v=nxGpuPreference();return v==='default'?{}:{powerPreference:v};}\nfunction nxGpuAdapterReport(ad){\n const i=ad.info;\n const fields=['vendor','architecture','device','description'];\n const report={state:'unavailable',selection:nxGpuPreference(),scope:'active-webgpu-device',observed_at:new Date().toISOString(),isFallbackAdapter:i&&typeof i.isFallbackAdapter==='boolean'?i.isFallbackAdapter:null};\n for(const k of fields)report[k]=i&&typeof i[k]==='string'&&i[k].trim()?i[k]:null;\n if(fields.some(k=>report[k]))report.state='reported';\n window.__nx_gpu_adapter=report;\n nxGpuChoiceRefresh();\n}\nfunction nxGpuChoiceRefresh(){\n const node=document.getElementById('nx-graphics-status');if(!node)return;\n const r=window.__nx_gpu_adapter;\n if(!r){node.textContent=navigator.gpu?'WebGPU adapter has not been established.':'WebGPU is unavailable in this browser.';return;}\n const name=[r.vendor,r.architecture,r.description,r.device].filter(Boolean).join(' / ');\n node.textContent=name?'Active WebGPU adapter: '+name:'WebGPU is active; this browser does not disclose the adapter identity.';\n if(r.isFallbackAdapter===true)node.textContent+=' Software or fallback adapter reported.';\n}\nfunction nxGpuChoiceMount(){\n if(document.getElementById('nx-graphics-choice'))return;\n const box=document.createElement('details');box.id='nx-graphics-choice';\n box.style.cssText='position:fixed;right:12px;bottom:12px;z-index:10000;max-width:min(360px,calc(100vw - 24px));max-height:70vh;overflow:auto;background:#161c25;color:#f1f5f9;border:1px solid #64748b;border-radius:10px;padding:10px 14px;font:14px/1.5 system-ui;box-sizing:border-box';\n const title=document.createElement('summary');title.textContent='Graphics / Performance';title.style.cursor='pointer';box.append(title);\n const status=document.createElement('p');status.id='nx-graphics-status';status.setAttribute('aria-live','polite');box.append(status);\n const label=document.createElement('label');label.htmlFor='nx-graphics-preference';label.textContent='GPU preference ';box.append(label);\n const select=document.createElement('select');select.id='nx-graphics-preference';\n for(const [value,text] of NX_GPU_CHOICES){const o=document.createElement('option');o.value=value;o.textContent=text;select.append(o);}\n select.value=nxGpuPreference();select.disabled=!navigator.gpu;box.append(select);\n const note=document.createElement('p');note.textContent='This requests a GPU preference. Your browser and operating system choose the adapter; a switch is not guaranteed.';box.append(note);\n const apply=document.createElement('button');apply.type='button';apply.textContent='Apply and reload';apply.disabled=!navigator.gpu;\n apply.addEventListener('click',()=>{const u=new URL(location.href);u.searchParams.set('gpuPreference',select.value);location.assign(u.href);});box.append(apply);\n const warning=document.createElement('p');warning.textContent='Reloading restarts this scene. The choice is carried in this page URL.';box.append(warning);\n const help=document.createElement('details');const heading=document.createElement('summary');heading.textContent='Still using the wrong GPU?';help.append(heading);\n const instructions=document.createElement('p');instructions.textContent='On Windows: Settings > System > Display > Graphics. Select your browser application, choose High performance with the GPU you want, save, then fully restart the browser. Check the active adapter again. This webpage cannot change that Windows setting.';help.append(instructions);box.append(help);\n for(const type of ['keydown','keyup','pointerdown','pointerup','click','wheel'])box.addEventListener(type,e=>e.stopPropagation());\n box.addEventListener('toggle',nxGpuChoiceRefresh);\n document.body.append(box);window.NishiWorkspace?.registerPart('performance',box);nxGpuChoiceRefresh();\n}\nif(document.readyState==='loading')document.addEventListener('DOMContentLoaded',nxGpuChoiceMount,{once:true});else nxGpuChoiceMount();\n" as *u8 }