|
2317 | 2317 | <a href="#2316" id="2316">2316</a> |
2318 | 2318 | <a href="#2317" id="2317">2317</a> |
2319 | 2319 | <a href="#2318" id="2318">2318</a> |
| 2320 | +<a href="#2319" id="2319">2319</a> |
| 2321 | +<a href="#2320" id="2320">2320</a> |
| 2322 | +<a href="#2321" id="2321">2321</a> |
| 2323 | +<a href="#2322" id="2322">2322</a> |
| 2324 | +<a href="#2323" id="2323">2323</a> |
| 2325 | +<a href="#2324" id="2324">2324</a> |
| 2326 | +<a href="#2325" id="2325">2325</a> |
| 2327 | +<a href="#2326" id="2326">2326</a> |
| 2328 | +<a href="#2327" id="2327">2327</a> |
| 2329 | +<a href="#2328" id="2328">2328</a> |
| 2330 | +<a href="#2329" id="2329">2329</a> |
| 2331 | +<a href="#2330" id="2330">2330</a> |
| 2332 | +<a href="#2331" id="2331">2331</a> |
| 2333 | +<a href="#2332" id="2332">2332</a> |
| 2334 | +<a href="#2333" id="2333">2333</a> |
| 2335 | +<a href="#2334" id="2334">2334</a> |
| 2336 | +<a href="#2335" id="2335">2335</a> |
| 2337 | +<a href="#2336" id="2336">2336</a> |
| 2338 | +<a href="#2337" id="2337">2337</a> |
| 2339 | +<a href="#2338" id="2338">2338</a> |
| 2340 | +<a href="#2339" id="2339">2339</a> |
| 2341 | +<a href="#2340" id="2340">2340</a> |
| 2342 | +<a href="#2341" id="2341">2341</a> |
| 2343 | +<a href="#2342" id="2342">2342</a> |
| 2344 | +<a href="#2343" id="2343">2343</a> |
| 2345 | +<a href="#2344" id="2344">2344</a> |
| 2346 | +<a href="#2345" id="2345">2345</a> |
| 2347 | +<a href="#2346" id="2346">2346</a> |
| 2348 | +<a href="#2347" id="2347">2347</a> |
| 2349 | +<a href="#2348" id="2348">2348</a> |
| 2350 | +<a href="#2349" id="2349">2349</a> |
| 2351 | +<a href="#2350" id="2350">2350</a> |
| 2352 | +<a href="#2351" id="2351">2351</a> |
| 2353 | +<a href="#2352" id="2352">2352</a> |
| 2354 | +<a href="#2353" id="2353">2353</a> |
| 2355 | +<a href="#2354" id="2354">2354</a> |
| 2356 | +<a href="#2355" id="2355">2355</a> |
| 2357 | +<a href="#2356" id="2356">2356</a> |
| 2358 | +<a href="#2357" id="2357">2357</a> |
2320 | 2359 | </pre></div><pre class="rust"><code><span class="kw">use super</span>::{ |
2321 | 2360 | ast::{ |
2322 | 2361 | BuiltinVariations, FunctionDeclaration, FunctionKind, Overload, ParameterInfo, |
|
2611 | 2650 | f, |
2612 | 2651 | ) |
2613 | 2652 | } |
| 2653 | + <span class="string">"textureQueryLevels" </span>=> { |
| 2654 | + <span class="kw">let </span>f = |kind, dim, arrayed, multi, shadow| { |
| 2655 | + <span class="kw">let </span>class = <span class="kw">match </span>shadow { |
| 2656 | + <span class="bool-val">true </span>=> ImageClass::Depth { multi }, |
| 2657 | + <span class="bool-val">false </span>=> ImageClass::Sampled { kind, multi }, |
| 2658 | + }; |
| 2659 | + |
| 2660 | + <span class="kw">let </span>image = TypeInner::Image { |
| 2661 | + dim, |
| 2662 | + arrayed, |
| 2663 | + class, |
| 2664 | + }; |
| 2665 | + |
| 2666 | + declaration |
| 2667 | + .overloads |
| 2668 | + .push(module.add_builtin(<span class="macro">vec!</span>[image], MacroCall::TextureQueryLevels)) |
| 2669 | + }; |
| 2670 | + |
| 2671 | + texture_args_generator(TextureArgsOptions::SHADOW | variations.into(), f) |
| 2672 | + } |
2614 | 2673 | <span class="string">"texelFetch" </span>| <span class="string">"texelFetchOffset" </span>=> { |
2615 | 2674 | <span class="kw">let </span>offset = <span class="string">"texelFetchOffset" </span>== name; |
2616 | 2675 | <span class="kw">let </span>f = |kind, dim, arrayed, multi, _shadow| { |
|
3834 | 3893 | TextureSize { |
3835 | 3894 | arrayed: bool, |
3836 | 3895 | }, |
| 3896 | + TextureQueryLevels, |
3837 | 3897 | ImageLoad { |
3838 | 3898 | multi: bool, |
3839 | 3899 | }, |
|
4066 | 4126 | Span::default(), |
4067 | 4127 | )<span class="question-mark">? |
4068 | 4128 | </span>} |
| 4129 | + MacroCall::TextureQueryLevels => { |
| 4130 | + <span class="kw">let </span>expr = ctx.add_expression( |
| 4131 | + Expression::ImageQuery { |
| 4132 | + image: args[<span class="number">0</span>], |
| 4133 | + query: ImageQuery::NumLevels, |
| 4134 | + }, |
| 4135 | + Span::default(), |
| 4136 | + )<span class="question-mark">?</span>; |
| 4137 | + |
| 4138 | + ctx.add_expression( |
| 4139 | + Expression::As { |
| 4140 | + expr, |
| 4141 | + kind: Sk::Sint, |
| 4142 | + convert: <span class="prelude-val">Some</span>(<span class="number">4</span>), |
| 4143 | + }, |
| 4144 | + Span::default(), |
| 4145 | + )<span class="question-mark">? |
| 4146 | + </span>} |
4069 | 4147 | MacroCall::ImageLoad { multi } => { |
4070 | 4148 | <span class="kw">let </span>comps = frontend.coordinate_components(ctx, args[<span class="number">0</span>], args[<span class="number">1</span>], <span class="prelude-val">None</span>, meta)<span class="question-mark">?</span>; |
4071 | 4149 | <span class="kw">let </span>(sample, level) = <span class="kw">match </span>(multi, args.get(<span class="number">2</span>)) { |
|
0 commit comments