《ShaderToHuman(S2H)HLSL GLSL库用于调试着色器.pdf》由会员分享,可在线阅读,更多相关《ShaderToHuman(S2H)HLSL GLSL库用于调试着色器.pdf(16页珍藏版)》请在三个皮匠报告上搜索。
1、Shader To Human(S2H)Martin MittringMMittringEA.comAnushka NairAnuNairEA.comMartin MittringMMittringEA.comAnushka NairAnuNairEA.comSEEDhttps:/ library for debugging shadersThink of PrintF for shadersWith shader hot reload its like a debugger watch windowProgrammable visualizer 2D/3D/UICaution:DIY,per
2、formanceIntegrate HLSL in few includesIntegrate GLSL using preprocessor definesUnit tests with screenshot comparison2GitHub:https:/ browser:search“Human”Installation:copy“include”folder(1-4 files)Target FrameworksGigi:https:/ to get it?3My SW Development ExperienceC+:Debugger,PrintFDebugger,PrintF d
3、ebuggingCryEngine:Visualize TextureVisualize Texture,CVars,LUA&C+LUA&C+,loggingUnreal Engine 3.4:CVars,ShowFlags,VisualizerVisualizerMeta:Unity,TransformTransform math,QuaternionEA SEED:GPU drivenGPU driven,Persistent Thread,ThreadGroup,Wave Intrinsics,Phases=needed tooling4000.027 NIT000.086 LUXDoc
4、umentationHTML docs using JavaScript,WebGLUser can copy HLSL or GLSLWebGL has no define support=We use cl.exe as preprocessor,copy.glsl filesGLSL files outside HTML/JS=no local html file,NodeJS/server hosted5Demo6Integration Options7ImplementationFont in texture,fast but adds complications =optional
5、Font in array,no integration needed=defaultDrivers can implement fast path=had to find itData is stored in 32 bit arrayAvoid defines and templatesUsages2h_printCharacter(ui,65u)/basis functions2h_printTxt(ui,X,0,x)/only work in HLSLs2h_printTxt(ui,_X,_0,_SPACE,_x)/works in GLSL toos2h_printTxt(ui,X0
6、 x)/not portable(yet)s2h_printLF(ui)/goto next line(LineFeed)Print strings from a shader language 8Gather(s2h.hlsl)Implementationstruct to pass state and dstColorSetup(see top in s2h.hlsl)#include s2h.hContextGather ui;s2h_init(ui,pxPos);float4 linColor=background*(1.0f-ui.dstColor.a)+ui.dstColor;fr