1= Math Test 2 3This file (vkmath.txt) contains all the latexmath blocks and inlines in the 4Vulkan spec and style guide, so we can see how they're rendered with 5different methods and output formats. 6 7== File chapters/fundamentals.txt 8 9=== latexmath block 1 10 11[latexmath] 12++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 13f = { c \over { 2^b - 1 } } 14++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 15 16=== latexmath block 2 17 18[latexmath] 19++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 20f = \max\left( {c \over {2^{b-1} - 1}}, -1.0 \right) 21++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 22 23== File chapters/interfaces.txt 24 25=== latexmath inline 1 26 27latexmath:[(x,y,z,\frac{1}{w})] 28 29=== latexmath inline 2 30 31latexmath:[\frac{1}{w}] 32 33== File chapters/primsrast.txt 34 35=== latexmath block 3 36 37[latexmath] 38++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 39s = {1 \over 2} + { \left( x_p - x_f \right) \over \text{size} } 40++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 41 42[latexmath] 43++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 44t = {1 \over 2} + { \left( y_p - y_f \right) \over \text{size} } 45++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 46 47=== latexmath block 4 48 49[latexmath] 50++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 51t = {{( \mathbf{p}_r - \mathbf{p}_a ) \cdot ( \mathbf{p}_b - \mathbf{p}_a )} 52 \over {\| \mathbf{p}_b - \mathbf{p}_a \|^2 }} 53++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 54 55=== latexmath block 5 56 57[latexmath] 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 59f = {{ (1-t) {f_a / w_a} + t { f_b / w_b} } \over 60 {(1-t) / w_a + t / w_b }} 61++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 62 63=== latexmath block 6 64 65[latexmath] 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 67a = -{1 \over 2}\sum_{i=0}^{n-1} 68 x_f^i y_f^{i \oplus 1} - 69 x_f^{i \oplus 1} y_f^i 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 71 72=== latexmath inline 3 73 74latexmath:[x_f^i] and latexmath:[y_f^i] 75 76=== latexmath block 7 77 78[latexmath] 79++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 80a = {{\mathrm{A}(p p_b p_c)} \over {\mathrm{A}(p_a p_b p_c)}}, \quad 81b = {{\mathrm{A}(p p_a p_c)} \over {\mathrm{A}(p_a p_b p_c)}}, \quad 82c = {{\mathrm{A}(p p_a p_b)} \over {\mathrm{A}(p_a p_b p_c)}}, 83++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 84 85=== latexmath block 8 86 87[latexmath] 88++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 89f = { a {f_a / w_a} + b {f_b / w_b} + c {f_c / w_c} } \over 90 { {a / w_a} + {b / w_b} + {c / w_c} } 91++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 92 93== File chapters/fundamentals.txt 94 95=== latexmath block 9 96 97[latexmath] 98++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 99f = { c \over { 2^b - 1 } } 100++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 101 102=== latexmath block 10 103 104[latexmath] 105++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 106f = \max\left( {c \over {2^{b-1} - 1}}, -1.0 \right) 107++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 108 109== File chapters/interfaces.txt 110 111=== latexmath inline 4 112 113latexmath:[(x,y,z,\frac{1}{w})] 114 115=== latexmath inline 5 116 117latexmath:[\frac{1}{w}]. 118 119== File chapters/primsrast.txt 120 121=== latexmath block 11 122 123[latexmath] 124++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 125s = {1 \over 2} + { \left( x_p - x_f \right) \over \text{size} } 126++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 127[latexmath] 128++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 129t = {1 \over 2} + { \left( y_p - y_f \right) \over \text{size} } 130++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 131 132=== latexmath block 12 133 134[latexmath] 135++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 136t = {{( \mathbf{p}_r - \mathbf{p}_a ) \cdot ( \mathbf{p}_b - \mathbf{p}_a )} 137 \over {\| \mathbf{p}_b - \mathbf{p}_a \|^2 }} 138++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 139 140=== latexmath block 13 141 142[latexmath] 143++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 144f = {{ (1-t) {f_a / w_a} + t { f_b / w_b} } \over 145 {(1-t) / w_a + t / w_b }} 146++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 147 148=== latexmath block 14 149 150[latexmath] 151++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 152a = -{1 \over 2}\sum_{i=0}^{n-1} 153 x_f^i y_f^{i \oplus 1} - 154 x_f^{i \oplus 1} y_f^i 155++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 156 157=== latexmath inline 6 158 159latexmath:[x_f^i] and latexmath:[y_f^i] 160 161=== latexmath block 15 162 163[latexmath] 164++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 165a = {{\mathrm{A}(p p_b p_c)} \over {\mathrm{A}(p_a p_b p_c)}}, \quad 166b = {{\mathrm{A}(p p_a p_c)} \over {\mathrm{A}(p_a p_b p_c)}}, \quad 167c = {{\mathrm{A}(p p_a p_b)} \over {\mathrm{A}(p_a p_b p_c)}}, 168++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 169 170=== latexmath block 16 171 172[latexmath] 173++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 174f = { a {f_a / w_a} + b {f_b / w_b} + c {f_c / w_c} } \over 175 { {a / w_a} + {b / w_b} + {c / w_c} } 176++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 177 178=== latexmath block 17 179 180[latexmath] 181++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 182f = \sum_{i=1}^{n} a_i f_i 183++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 184 185=== latexmath inline 7 186 187latexmath:[\sum_{i=1}^{n}a_i = 1]. 188 189=== latexmath block 18 190 191[latexmath] 192++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 193m = \sqrt{ \left({{\partial z_f} \over {\partial x_f}}\right)^2 194 + \left({{\partial z_f} \over {\partial y_f}}\right)^2} 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 196 197=== latexmath block 19 198 199[latexmath] 200++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 201m = \max\left( \left| {{\partial z_f} \over {\partial x_f}} \right|, 202 \left| {{\partial z_f} \over {\partial y_f}} \right| \right) 203++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 204 205=== latexmath block 20 206 207[latexmath] 208++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 209o = 210\begin{cases} 211 m \times depthBiasSlopeFactor + 212 r \times depthBiasConstantFactor & depthBiasClamp = 0\ or\ NaN \\ 213 \min(m \times depthBiasSlopeFactor + 214 r \times depthBiasConstantFactor, 215 depthBiasClamp) & depthBiasClamp > 0 \\ 216 \max(m \times depthBiasSlopeFactor + 217 r \times depthBiasConstantFactor, 218 depthBiasClamp) & depthBiasClamp < 0 \\ 219\end{cases} 220++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 221 222== File chapters/tessellation.txt 223 224=== latexmath inline 8 225 226latexmath:[\frac{1}{n}, \frac{2}{n}, \ldots, \frac{n-1}{n}] 227 228== File chapters/textures.txt 229 230=== latexmath block 21 231 232[latexmath] 233+++++++++++++++++++ 234\begin{aligned} 235N & = 9 & \text{number of mantissa bits per component} \\ 236B & = 15 & \text{exponent bias} \\ 237E_{max} & = 31 & \text{maximum possible biased exponent value} \\ 238sharedexp_{max} & = \frac{(2^N-1)}{2^N} \times 2^{(E_{max}-B)} 239\end{aligned} 240+++++++++++++++++++ 241 242=== latexmath block 22 243 244[latexmath] 245+++++++++++++++++++ 246\begin{aligned} 247exp' = 248 \begin{cases} 249 \left \lfloor \log_2(max_{clamped}) \right \rfloor + (B+1) 250 & \text{for}\ max_{clamped} > 2^{-(B+1)} \\ 251 0 252 & \text{for}\ max_{clamped} \leq 2^{-(B+1)} 253 \end{cases} 254\end{aligned} 255+++++++++++++++++++ 256 257=== latexmath block 23 258 259[latexmath] 260+++++++++++++++++++ 261\begin{aligned} 262max_{shared} = 263\left \lfloor 264\frac{max_{clamped}}{2^{(exp'-B-N)}}+\frac{1}{2} 265\right \rfloor 266\end{aligned} 267+++++++++++++++++++ 268 269=== latexmath block 24 270 271[latexmath] 272+++++++++++++++++++ 273\begin{aligned} 274exp_{shared} = 275 \begin{cases} 276 exp' & \text{for}\ 0 \leq max_{shared} < 2^N \\ 277 exp'+1 & \text{for}\ max_{shared} = 2^N 278 \end{cases} 279\end{aligned} 280+++++++++++++++++++ 281 282=== latexmath block 25 283 284[latexmath] 285+++++++++++++++++++ 286\begin{aligned} 287red_{shared} & = 288 \left \lfloor 289 \frac{red_{clamped}}{2^{(exp_{shared}-B-N)}}+ \frac{1}{2} 290 \right \rfloor \\ 291green_{shared} & = 292 \left \lfloor 293 \frac{green_{clamped}}{2^{(exp_{shared}-B-N)}}+ \frac{1}{2} 294 \right \rfloor \\ 295blue_{shared} & = 296 \left \lfloor 297 \frac{blue_{clamped}}{2^{(exp_{shared}-B-N)}}+ \frac{1}{2} 298 \right \rfloor 299\end{aligned} 300+++++++++++++++++++ 301 302=== latexmath block 26 303 304[latexmath] 305+++++++++++++++++++ 306\begin{aligned} 307D & = 1.0 & 308 \begin{cases} 309 D_{ref} \leq D & \text{for LEQUAL} \\ 310 D_{ref} \geq D & \text{for GEQUAL} \\ 311 D_{ref} < D & \text{for LESS} \\ 312 D_{ref} > D & \text{for GREATER} \\ 313 D_{ref} = D & \text{for EQUAL} \\ 314 D_{ref} \neq D & \text{for NOTEQUAL} \\ 315 true & \text{for ALWAYS} \\ 316 false & \text{for NEVER} 317 \end{cases} \\ 318D & = 0.0 & \text{otherwise} 319\end{aligned} 320+++++++++++++++++++ 321 322=== latexmath block 27 323 324[latexmath] 325+++++++++++++++++++ 326\begin{aligned} 327C'_{rgba}[R] & = 328 \begin{cases} 329 C_{rgba}[R] & \text{for RED swizzle} \\ 330 C_{rgba}[G] & \text{for GREEN swizzle} \\ 331 C_{rgba}[B] & \text{for BLUE swizzle} \\ 332 C_{rgba}[A] & \text{for ALPHA swizzle} \\ 333 0 & \text{for ZERO swizzle} \\ 334 one & \text{for ONE swizzle} \\ 335 C_{rgba}[R] & \text{for IDENTITY swizzle} 336 \end{cases} 337\end{aligned} 338+++++++++++++++++++ 339 340=== latexmath block 28 341 342[latexmath] 343+++++++++++++++++++ 344\begin{aligned} 345C_{rgba}[R] & \text{is the RED component} \\ 346C_{rgba}[G] & \text{is the GREEN component} \\ 347C_{rgba}[B] & \text{is the BLUE component} \\ 348C_{rgba}[A] & \text{is the ALPHA component} \\ 349one & = 1.0\text{f} & \text{for floating point components} \\ 350one & = 1 & \text{for integer components} 351\end{aligned} 352+++++++++++++++++++ 353 354=== latexmath block 29 355 356[latexmath] 357+++++++++++++++++++ 358\begin{aligned} 359dPdx_{i_1,j_0} & = dPdx_{i_0,j_0} & = P_{i_1,j_0} - P_{i_0,j_0} \\ 360dPdx_{i_1,j_1} & = dPdx_{i_0,j_1} & = P_{i_1,j_1} - P_{i_0,j_1} \\ 361\\ 362dPdy_{i_0,j_1} & = dPdy_{i_0,j_0} & = P_{i_0,j_1} - P_{i_0,j_0} \\ 363dPdy_{i_1,j_1} & = dPdy_{i_1,j_0} & = P_{i_1,j_1} - P_{i_1,j_0} 364\end{aligned} 365+++++++++++++++++++ 366 367=== latexmath block 30 368 369[latexmath] 370+++++++++++++++++++ 371\begin{aligned} 372dPdx & = 373 \begin{cases} 374 dPdx_{i_0,j_0} & \text{preferred}\\ 375 dPdx_{i_0,j_1} 376 \end{cases} \\ 377dPdy & = 378 \begin{cases} 379 dPdy_{i_0,j_0} & \text{preferred}\\ 380 dPdy_{i_1,j_0} 381 \end{cases} 382\end{aligned} 383+++++++++++++++++++ 384 385=== latexmath block 31 386 387[latexmath] 388+++++++++++++++++++ 389\begin{aligned} 390s & = \frac{s}{q}, & \text{for 1D, 2D, or 3D image} \\ 391\\ 392t & = \frac{t}{q}, & \text{for 2D or 3D image} \\ 393\\ 394r & = \frac{r}{q}, & \text{for 3D image} \\ 395\\ 396D_{ref} & = \frac{D_{ref}}{q}, & \text{if provided} 397\end{aligned} 398+++++++++++++++++++ 399 400 401=== latexmath block 32 402 403[latexmath] 404+++++++++++++++++++ 405\begin{aligned} 406\partial{s}/\partial{x} & = dPdx(s), & \partial{s}/\partial{y} & = dPdy(s), & \text{for 1D, 2D, Cube, or 3D image} \\ 407\partial{t}/\partial{x} & = dPdx(t), & \partial{t}/\partial{y} & = dPdy(t), & \text{for 2D, Cube, or 3D image} \\ 408\partial{u}/\partial{x} & = dPdx(u), & \partial{u}/\partial{y} & = dPdy(u), & \text{for Cube or 3D image} 409\end{aligned} 410+++++++++++++++++++ 411 412=== latexmath block 33 413 414[latexmath] 415++++++++++++++++++++++++ 416\begin{aligned} 417s_{face} & = 418 \frac{1}{2} \times \frac{s_c}{|r_c|} + \frac{1}{2} \\ 419t_{face} & = 420 \frac{1}{2} \times \frac{t_c}{|r_c|} + \frac{1}{2} \\ 421\end{aligned} 422++++++++++++++++++++++++ 423 424=== latexmath block 34 425 426[latexmath] 427++++++++++++++++++++++++ 428\begin{aligned} 429\frac{\partial{s_{face}}}{\partial{x}} &= 430 \frac{\partial}{\partial{x}} \left ( \frac{1}{2} \times \frac{s_{c}}{|r_{c}|} 431 + \frac{1}{2}\right ) \\ 432\frac{\partial{s_{face}}}{\partial{x}} &= 433 \frac{1}{2} \times \frac{\partial}{\partial{x}} 434 \left ( \frac{s_{c}}{|r_{c}|} \right ) \\ 435\frac{\partial{s_{face}}}{\partial{x}} &= 436 \frac{1}{2} \times 437 \left ( 438 \frac{ 439 |r_{c}| \times \partial{s_c}/\partial{x} 440 -s_c \times {\partial{r_{c}}}/{\partial{x}}} 441 {\left ( r_{c} \right )^2} 442 \right ) 443\end{aligned} 444++++++++++++++++++++++++ 445 446=== latexmath block 35 447 448[latexmath] 449++++++++++++++++++++++++ 450\begin{aligned} 451\frac{\partial{s_{face}}}{\partial{y}} &= 452 \frac{1}{2} \times 453 \left ( 454 \frac{ 455 |r_{c}| \times \partial{s_c}/\partial{y} 456 -s_c \times {\partial{r_{c}}}/{\partial{y}}} 457 {\left ( r_{c} \right )^2} 458 \right )\\ 459\frac{\partial{t_{face}}}{\partial{x}} &= 460 \frac{1}{2} \times 461 \left ( 462 \frac{ 463 |r_{c}| \times \partial{t_c}/\partial{x} 464 -t_c \times {\partial{r_{c}}}/{\partial{x}}} 465 {\left ( r_{c} \right )^2} 466 \right ) \\ 467\frac{\partial{t_{face}}}{\partial{y}} &= 468 \frac{1}{2} \times 469 \left ( 470 \frac{ 471 |r_{c}| \times \partial{t_c}/\partial{y} 472 -t_c \times {\partial{r_{c}}}/{\partial{y}}} 473 {\left ( r_{c} \right )^2} 474 \right ) 475\end{aligned} 476++++++++++++++++++++++++ 477 478=== latexmath block 36 479 480[latexmath] 481++++++++++++++++++++++++ 482\begin{aligned} 483\rho_{x} & = \sqrt{ m_{ux} ^{2} + m_{vx} ^{2} + m_{wx} ^{2} } \\ 484\rho_{y} & = \sqrt{ m_{uy} ^{2} + m_{vy} ^{2} + m_{wy} ^{2} } 485\end{aligned} 486++++++++++++++++++++++++ 487 488=== latexmath block 37 489 490 :: [eq]#f~x~# is continuous and monotonically increasing in each of 491 [eq]#m~ux~#, [eq]#m~vx~#, and [eq]#m~wx~# 492 :: [eq]#f~y~# is continuous and monotonically increasing in each of 493 [eq]#m~uy~#, [eq]#m~vy~#, and [eq]#m~wy~# 494 :: [eq]#max({vert}m~ux~{vert}, {vert}m~vx~{vert}, {vert}m~wx~{vert}) {leq} 495 f~x~ {leq} {vert}m~ux~{vert} + {vert}m~vx~{vert} + {vert}m~wx~{vert}# 496 :: [eq]#max({vert}m~uy~{vert}, {vert}m~vy~{vert}, {vert}m~wy~{vert}) {leq} 497 f~y~ {leq} {vert}m~uy~{vert} + {vert}m~vy~{vert} + {vert}m~wy~{vert}# 498 499=== latexmath block 38 500 501[latexmath] 502++++++++++++++++++++++++ 503\begin{aligned} 504N & = \min \left (\left \lceil \frac{\rho_{max}}{\rho_{min}} \right \rceil ,max_{Aniso} \right ) 505\end{aligned} 506++++++++++++++++++++++++ 507 508=== latexmath block 39 509 510[latexmath] 511++++++++++++++++++++++++ 512\begin{aligned} 513\lambda_{base}(x,y) & = 514 \begin{cases} 515 shaderOp.Lod & \text{(from optional SPIR-V operand)} \\ 516 \log_2 \left ( \frac{\rho_{max}}{N} \right ) & \text{otherwise} 517 \end{cases} \\ 518\lambda'(x,y) & = \lambda_{base} + \mathbin{clamp}(sampler.bias + shaderOp.bias,-maxSamplerLodBias,maxSamplerLodBias) \\ 519\lambda & = 520 \begin{cases} 521 lod_{max}, & \lambda' > lod_{max} \\ 522 \lambda', & lod_{min} \leq \lambda' \leq lod_{max} \\ 523 lod_{min}, & \lambda' < lod_{min} \\ 524 undefined, & lod_{min} > lod_{max} \\ 525 \end{cases} 526\end{aligned} 527++++++++++++++++++++++++ 528 529=== latexmath block 40 530 531[latexmath] 532++++++++++++++++++++++++ 533\begin{aligned} 534sampler.bias & = mipLodBias & \text{(from sampler descriptor)} \\ 535shaderOp.bias & = 536 \begin{cases} 537 Bias & \text{(from optional SPIR-V operand)} \\ 538 0 & \text{otherwise} 539 \end{cases} \\ 540sampler.lod_{min} & = minLod & \text{(from sampler descriptor)} \\ 541shaderOp.lod_{min} & = 542 \begin{cases} 543 MinLod & \text{(from optional SPIR-V operand)} \\ 544 0 & \text{otherwise} 545 \end{cases} \\ 546\\ 547lod_{min} & = \max(sampler.lod_{min}, shaderOp.lod_{min}) \\ 548lod_{max} & = maxLod & \text{(from sampler descriptor)} 549\end{aligned} 550++++++++++++++++++++++++ 551 552=== latexmath block 41 553 554[latexmath] 555++++++++++++++++++++++++ 556\begin{aligned} 557d = 558 \begin{cases} 559 level_{base}, & \lambda \leq \frac{1}{2} \\[.5em] 560 nearest(\lambda), & \lambda > \frac{1}{2}, 561 level_{base} + \lambda \leq 562 q + \frac{1}{2} \\[.5em] 563 q, & \lambda > \frac{1}{2}, 564 level_{base} + \lambda > q + \frac{1}{2} 565 \end{cases} 566\end{aligned} 567++++++++++++++++++++++++ 568 569=== latexmath block 42 570 571[latexmath] 572++++++++++++++++++++++++ 573\begin{aligned} 574nearest(\lambda) & = 575 \begin{cases} 576 \left \lceil level_{base}+\lambda + \frac{1}{2}\right \rceil - 1, & 577 \text{preferred} \\ 578 \left \lfloor level_{base}+\lambda + \frac{1}{2}\right \rfloor, & 579 \text{alternative} 580 \end{cases} 581\end{aligned} 582++++++++++++++++++++++++ 583 584=== latexmath block 43 585 586[latexmath] 587++++++++++++++++++++++++ 588\begin{aligned} 589d_{hi} & = 590 \begin{cases} 591 q, & level_{base} + \lambda \geq q \\ 592 \left \lfloor level_{base}+\lambda \right \rfloor, & \text{otherwise} 593 \end{cases} \\ 594d_{lo} & = 595 \begin{cases} 596 q, & level_{base} + \lambda \geq q \\ 597 d_{hi}+1, & \text{otherwise} 598 \end{cases} 599\end{aligned} 600++++++++++++++++++++++++ 601 602=== latexmath block 44 603 604[latexmath] 605++++++++++++++++++++++++ 606\begin{aligned} 607u(x,y) & = s(x,y) \times width_{level} \\ 608v(x,y) & = 609 \begin{cases} 610 0 & \text{for 1D images} \\ 611 t(x,y) \times height_{level} & \text{otherwise} 612 \end{cases} \\ 613w(x,y) & = 614 \begin{cases} 615 0 & \text{for 2D or Cube images} \\ 616 r(x,y) \times depth_{level} & \text{otherwise} 617 \end{cases} \\ 618\\ 619a(x,y) & = 620 \begin{cases} 621 a(x,y) & \text{for array images} \\ 622 0 & \text{otherwise} 623 \end{cases} 624\end{aligned} 625++++++++++++++++++++++++ 626 627=== latexmath block 45 628 629[latexmath] 630++++++++++++++++++++++++ 631\begin{aligned} 632\mathbin{RNE}(a) & = 633 \begin{cases} 634 \mathbin{roundTiesToEven}(a) & \text{preferred, from IEEE Std 754-2008 Floating-Point Arithmetic} \\ 635 \left \lfloor a + \frac{1}{2} \right \rfloor & \text{alternative} 636 \end{cases} 637\end{aligned} 638++++++++++++++++++++++++ 639 640=== latexmath block 46 641 642[latexmath] 643++++++++++++++++++++++++ 644\begin{aligned} 645i &= 646 \begin{cases} 647 i \bmod size & \text{for repeat} \\ 648 (size-1) - \mathbin{mirror} 649 ((i \bmod (2 \times size)) - size) & \text{for mirrored repeat} \\ 650 \mathbin{clamp}(i,0,size-1) & \text{for clamp to edge} \\ 651 \mathbin{clamp}(i,-1,size) & \text{for clamp to border} \\ 652 \mathbin{clamp}(\mathbin{mirror}(i),0,size-1) & \text{for mirror clamp to edge} 653 \end{cases} 654\end{aligned} 655++++++++++++++++++++++++ 656 657 658=== latexmath block 47 659 660[latexmath] 661++++++++++++++++++++++++ 662\begin{aligned} 663& \mathbin{mirror}(n) = 664 \begin{cases} 665 n & \text{for}\ n \geq 0 \\ 666 -(1+n) & \text{otherwise} 667 \end{cases} 668\end{aligned} 669++++++++++++++++++++++++ 670 671=== latexmath block 48 672 673[latexmath] 674++++++++++++++++++++++++ 675\begin{aligned} 676\tau[R] &= \tau_{i0j1}[level_{base}][comp] \\ 677\tau[G] &= \tau_{i1j1}[level_{base}][comp] \\ 678\tau[B] &= \tau_{i1j0}[level_{base}][comp] \\ 679\tau[A] &= \tau_{i0j0}[level_{base}][comp] 680\end{aligned} 681++++++++++++++++++++++++ 682 683=== latexmath block 49 684 685[latexmath] 686++++++++++++++++++++++++ 687\begin{aligned} 688\tau[level_{base}][comp] &= 689 \begin{cases} 690 \tau[level_{base}][R], & \text{for}\ comp = 0 \\ 691 \tau[level_{base}][G], & \text{for}\ comp = 1 \\ 692 \tau[level_{base}][B], & \text{for}\ comp = 2 \\ 693 \tau[level_{base}][A], & \text{for}\ comp = 3 694 \end{cases}\\ 695comp & \,\text{from SPIR-V operand Component} 696\end{aligned} 697++++++++++++++++++++++++ 698 699=== latexmath block 50 700 701[latexmath] 702++++++++++++++++++++++++ 703\begin{aligned} 704\tau[level] &= 705 \begin{cases} 706 \tau_{ijk}[level], & \text{for 3D image} \\ 707 \tau_{ij}[level], & \text{for 2D or Cube image} \\ 708 \tau_{i}[level], & \text{for 1D image} 709 \end{cases} 710\end{aligned} 711++++++++++++++++++++++++ 712 713=== latexmath block 51 714 715[latexmath] 716++++++++++++++++++++++++ 717\begin{aligned} 718\tau_{3D}[level] & = (1-\alpha)(1-\beta)(1-\gamma)\tau_{i0j0k0}[level] \\ 719 & \, + (\alpha)(1-\beta)(1-\gamma)\tau_{i1j0k0}[level] \\ 720 & \, + (1-\alpha)(\beta)(1-\gamma)\tau_{i0j1k0}[level] \\ 721 & \, + (\alpha)(\beta)(1-\gamma)\tau_{i1j1k0}[level] \\ 722 & \, + (1-\alpha)(1-\beta)(\gamma)\tau_{i0j0k1}[level] \\ 723 & \, + (\alpha)(1-\beta)(\gamma)\tau_{i1j0k1}[level] \\ 724 & \, + (1-\alpha)(\beta)(\gamma)\tau_{i0j1k1}[level] \\ 725 & \, + (\alpha)(\beta)(\gamma)\tau_{i1j1k1}[level] 726\end{aligned} 727++++++++++++++++++++++++ 728 729=== latexmath block 52 730 731[latexmath] 732++++++++++++++++++++++++ 733\begin{aligned} 734\tau_{2D}[level] & = (1-\alpha)(1-\beta)\tau_{i0j0}[level] \\ 735 & \, + (\alpha)(1-\beta)\tau_{i1j0}[level] \\ 736 & \, + (1-\alpha)(\beta)\tau_{i0j1}[level] \\ 737 & \, + (\alpha)(\beta)\tau_{i1j1}[level] 738\end{aligned} 739++++++++++++++++++++++++ 740 741=== latexmath block 53 742 743[latexmath] 744++++++++++++++++++++++++ 745\begin{aligned} 746\tau_{1D}[level] & = (1-\alpha)\tau_{i0}[level] \\ 747 & \, + (\alpha)\tau_{i1}[level] 748\end{aligned} 749++++++++++++++++++++++++ 750 751=== latexmath block 54 752 753[latexmath] 754++++++++++++++++++++++++ 755\begin{aligned} 756\tau[level] &= 757 \begin{cases} 758 \tau_{3D}[level], & \text{for 3D image} \\ 759 \tau_{2D}[level], & \text{for 2D or Cube image} \\ 760 \tau_{1D}[level], & \text{for 1D image} 761 \end{cases} 762\end{aligned} 763++++++++++++++++++++++++ 764 765=== latexmath block 55 766 767[latexmath] 768++++++++++++++++++++++++ 769\begin{aligned} 770\tau &= 771 \begin{cases} 772 \tau[d], & \text{for mip mode BASE or NEAREST} \\ 773 (1-\delta)\tau[d_{hi}]+\delta\tau[d_{lo}], & \text{for mip mode LINEAR} 774 \end{cases} 775\end{aligned} 776++++++++++++++++++++++++ 777 778=== latexmath block 56 779 780[latexmath] 781++++++++++++++++++++++++ 782\begin{aligned} 783\tau_{2Daniso} & = 784 \frac{1}{N}\sum_{i=1}^{N} 785 {\tau_{2D}\left ( 786 u \left ( x - \frac{1}{2} + \frac{i}{N+1} , y \right ), 787 \left ( v \left (x-\frac{1}{2}+\frac{i}{N+1} \right ), y 788\right ) 789 \right )}, 790 & \text{when}\ \rho_{x} > \rho_{y} \\ 791\tau_{2Daniso} &= 792 \frac{1}{N}\sum_{i=1}^{N} 793 {\tau_{2D}\left ( 794 u \left ( x, y - \frac{1}{2} + \frac{i}{N+1} \right ), 795 \left ( v \left (x,y-\frac{1}{2}+\frac{i}{N+1} \right ) 796\right ) 797 \right )}, 798 & \text{when}\ \rho_{y} \geq \rho_{x} 799\end{aligned} 800++++++++++++++++++++++++ 801 802== File chapters/vertexpostproc.txt 803 804=== latexmath block 57 805 806[latexmath] 807++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 808\begin{array}{c} 809-w_c \leq x_c \leq w_c \\ 810-w_c \leq y_c \leq w_c \\ 8110 \leq z_c \leq w_c 812\end{array} 813++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 814 815=== latexmath block 58 816 817[latexmath] 818++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 819\left(\begin{array}{c} 820x_c \\ 821y_c \\ 822z_c \\ 823w_c 824\end{array}\right) 825++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 826 827=== latexmath block 59 828 829[latexmath] 830++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 831\left( 832 \begin{array}{c} 833 x_d \\ 834 y_d \\ 835 z_d 836 \end{array} 837\right) = 838\left( 839 \begin{array}{c} 840 \frac{x_c}{w_c} \\ 841 \frac{y_c}{w_c} \\ 842 \frac{z_c}{w_c} 843 \end{array} 844\right) 845++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 846 847=== latexmath inline 12 848 849latexmath:[\frac{k}{2^m - 1}] 850 851== File chapters/VK_IMG_filter_cubic/filter_cubic_texel_filtering.txt 852 853=== latexmath block 60 854 855[latexmath] 856++++++++++++++++++++++++ 857\begin{aligned} 858cinterp(\tau_0, \tau_1, \tau_2, \tau_3, \omega) = 859\frac{1}{2} 860\begin{bmatrix}1 & \omega & \omega^2 & \omega^3 \end{bmatrix} 861\times 862\begin{bmatrix} 863 0 & 2 & 0 & 0 \\ 864-1 & 0 & 1 & 0 \\ 865 2 & -5 & 4 & 1 \\ 866-1 & 3 & -3 & 1 867\end{bmatrix} 868\times 869\begin{bmatrix} 870\tau_0 \\ 871\tau_1 \\ 872\tau_2 \\ 873\tau_3 874\end{bmatrix} 875\end{aligned} 876++++++++++++++++++++++++ 877 878=== latexmath block 61 879 880[latexmath] 881++++++++++++++++++++++++ 882\begin{aligned} 883\tau[level] &= 884 \begin{cases} 885 \tau_{2D}[level], & \text{for 2D image} \\ 886 \tau_{1D}[level], & \text{for 1D image} 887 \end{cases} 888\end{aligned} 889++++++++++++++++++++++++ 890 891== File chapters/VK_IMG_filter_cubic/filter_cubic_texel_selection.txt 892 893=== latexmath block 62 894 895[latexmath] 896++++++++++++++++++++++++ 897\begin{aligned} 898i_{0} & = \left \lfloor u - \frac{3}{2} \right \rfloor & i_{1} & = i_{0} + 1 & i_{2} & = i_{1} + 1 & i_{3} & = i_{2} + 1 \\[1em] 899j_{0} & = \left \lfloor u - \frac{3}{2} \right \rfloor & j_{1} & = j_{0} + 1 & j_{2} & = j_{1} + 1 & j_{3} & = j_{2} + 1 \\ 900\\ 901\alpha & = \mathbin{frac} \left ( u - \frac{1}{2} \right ) \\[1em] 902\beta & = \mathbin{frac} \left ( v - \frac{1}{2} \right ) 903\end{aligned} 904++++++++++++++++++++++++ 905 906== File style/writing.txt 907 908=== latexmath inline 13 909 910latexmath:[[0,1\]] 911 912=== latexmath inline 14 913 914latexmath:[\frac{1 - \frac{x}{2}}{x - 1}] 915 916=== latexmath inline 15 917 918latexmath:[\mathbf{c} = t \mathbf{c}_1 + (1-t) \mathbf{c}_2.] 919 920=== latexmath block 63 921 922[latexmath] 923+++++++++++++++++++ 924\begin{aligned} 925c_{RGB} & = 926 \begin{cases} 927 \frac{c_{sRGB}}{12.92} & \text{for}\ c_{sRGB} \leq 0.04045 \\ 928 \left ( \frac{c_{sRGB}+0.055}{1.055} \right )^{2.4} & \text{for}\ c_{sRGB} > 0.04045 929 \end{cases} 930\end{aligned} 931+++++++++++++++++++ 932 933=== latexmath block 64 934 935[latexmath] 936+++++++++++++++++++ 937V = 938 \begin{cases} 939 (-1)^S \times 0.0, & E = 0, M = 0 \\ 940 (-1)^S \times 2^{-14} \times { M \over 2^{10} }, 941 & E = 0, M \neq 0 \\ 942 (-1)^S \times 2^{E-15} \times { \left( 1 + { M \over 2^{10} } \right) }, 943 & 0 < E < 31 \\ 944 (-1)^S \times Inf, & E = 31, M = 0 \\ 945 NaN, & E = 31, M \neq 0 946 \end{cases} 947+++++++++++++++++++ 948