mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-13 13:28:27 +02:00
176 lines
6.9 KiB
Plaintext
176 lines
6.9 KiB
Plaintext
[
|
|
{"type":"CommentPreproc","value":"#include"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"CommentPreprocFile","value":"\u003cmetal_stdlib\u003e"},
|
|
{"type":"CommentPreproc","value":"\n"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"using"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Keyword","value":"namespace"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"metal"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"// Include header shared between C code and .metal files.\n"},
|
|
{"type":"CommentPreproc","value":"#include"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"CommentPreprocFile","value":"\"AAPLShaderTypes.h\""},
|
|
{"type":"CommentPreproc","value":"\n"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"CommentSingle","value":"// Include header shared between all .metal files.\n"},
|
|
{"type":"CommentPreproc","value":"#include"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"CommentPreprocFile","value":"\"AAPLShaderCommon.h\""},
|
|
{"type":"CommentPreproc","value":"\n"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"struct"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameClass","value":"VertexOutput"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"KeywordType","value":"float4"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameAttribute","value":"[[position]]"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"};"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"// A depth pre-pass is necessary in forward plus rendering to produce\n// minimum and maximum depth bounds for light culling.\n"},
|
|
{"type":"Keyword","value":"vertex"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"VertexOutput"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameFunction","value":"depth_pre_pass_vertex"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"Vertex"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"in"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameAttribute","value":"[[ stage_in ]]"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"constant"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"AAPLFrameData"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"\u0026"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"frameData"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"[["},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"buffer"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"AAPLBufferIndexFrameData"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"]])"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"CommentSingle","value":"// Make the position a float4 to perform 4x4 matrix math on it.\n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"VertexOutput"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"out"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"KeywordType","value":"float4"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordType","value":"float4"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"in"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberFloat","value":"1.0"},
|
|
{"type":"Punctuation","value":");"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"CommentSingle","value":"// Calculate the position in clip space.\n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"out"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"frameData"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"projectionMatrix"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"*"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"frameData"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"modelViewMatrix"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"*"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"return"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"out"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"fragment"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"ColorData"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameFunction","value":"depth_pre_pass_fragment"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"VertexOutput"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"in"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameAttribute","value":"[[ stage_in ]]"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"CommentSingle","value":"// Populate on-tile geometry buffer data.\n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"ColorData"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"f"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"CommentSingle","value":"// Setting color in the depth pre-pass is unnecessary, but may make debugging easier.\n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"CommentSingle","value":"// f.lighting = half4(0, 0, 0, 1);\n"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"CommentSingle","value":"// Set the depth in clip space, which you use in `AAPLCulling` to perform per-tile light culling.\n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"f"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"depth"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"in"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"position"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"Name","value":"z"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"return"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"f"},
|
|
{"type":"Punctuation","value":";"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n"}
|
|
]
|