1// 2// Copyright 2018 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6 7Texture2D<float4> TextureF : register(t0); 8Texture2D<uint4> TextureUI : register(t0); 9Texture3D<float4> TextureF_3D : register(t0); 10Texture2DArray<float4> TextureF_2DArray : register(t0); 11 12SamplerState Sampler : register(s0); 13 14// Notation: 15// PM: premultiply, UM: unmulitply, PT: passthrough 16// F: float, U: uint 17 18// Float to float LUMA 19float4 PS_FtoF_PM_LUMA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 20{ 21 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 22 color.rgb = color.r * color.a; 23 color.a = 1.0f; 24 return color; 25} 26float4 PS_FtoF_UM_LUMA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 27{ 28 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 29 if (color.a > 0.0f) 30 { 31 color.rgb = color.r / color.a; 32 } 33 color.a = 1.0f; 34 return color; 35} 36 37// Float to float LUMAALPHA 38float4 PS_FtoF_PM_LUMAALPHA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 39{ 40 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 41 color.rgb = color.r * color.a; 42 return color; 43} 44 45float4 PS_FtoF_UM_LUMAALPHA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 46{ 47 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 48 if (color.a > 0.0f) 49 { 50 color.rgb = color.r / color.a; 51 } 52 return color; 53} 54 55// Float to float RGBA 56float4 PS_FtoF_PM_RGBA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 57{ 58 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 59 color.rgb *= color.a; 60 return color; 61} 62 63float4 PS_FtoF_UM_RGBA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 64{ 65 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 66 if (color.a > 0.0f) 67 { 68 color.rgb /= color.a; 69 } 70 return color; 71} 72 73// Float to float RGB 74float4 PS_FtoF_PM_RGB_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 75{ 76 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 77 color.rgb *= color.a; 78 color.a = 1.0f; 79 return color; 80} 81 82float4 PS_FtoF_UM_RGB_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 83{ 84 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 85 if (color.a > 0.0f) 86 { 87 color.rgb /= color.a; 88 } 89 color.a = 1.0f; 90 return color; 91} 92 93float4 PS_FtoF_PM_RGBA_4444_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 94{ 95 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 96 color.rgb *= color.a; 97 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 98 return color; 99} 100 101float4 PS_FtoF_UM_RGBA_4444_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 102{ 103 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 104 if (color.a > 0.0f) 105 { 106 color.rgb /= color.a; 107 } 108 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 109 return color; 110} 111 112float4 PS_FtoF_PM_RGB_565_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 113{ 114 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 115 color.rgb *= color.a; 116 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 117 color.a = 1.0f; 118 return color; 119} 120 121float4 PS_FtoF_UM_RGB_565_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 122{ 123 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 124 if (color.a > 0.0f) 125 { 126 color.rgb /= color.a; 127 } 128 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 129 color.a = 1.0f; 130 return color; 131} 132 133float4 PS_FtoF_PM_RGBA_5551_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 134{ 135 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 136 color.rgb *= color.a; 137 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 138 return color; 139} 140 141float4 PS_FtoF_UM_RGBA_5551_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 142{ 143 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 144 if (color.a > 0.0f) 145 { 146 color.rgb /= color.a; 147 } 148 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 149 return color; 150} 151 152// Float to uint RGBA 153uint4 PS_FtoU_PT_RGBA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 154{ 155 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 156 return uint4(color * 255); 157} 158 159uint4 PS_FtoU_PM_RGBA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 160{ 161 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 162 color.rgb *= color.a; 163 return uint4(color * 255); 164} 165 166uint4 PS_FtoU_UM_RGBA_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 167{ 168 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 169 if (color.a > 0.0f) 170 { 171 color.rgb /= color.a; 172 } 173 return uint4(color * 255); 174} 175 176// Float to uint RGB 177uint4 PS_FtoU_PT_RGB_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 178{ 179 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 180 return uint4(color.rgb * 255, 1); 181} 182 183uint4 PS_FtoU_PM_RGB_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 184{ 185 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 186 color.rgb *= color.a; 187 return uint4(color.rgb * 255, 1); 188} 189 190uint4 PS_FtoU_UM_RGB_2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0 191{ 192 float4 color = TextureF.Sample(Sampler, inTexCoord).rgba; 193 if (color.a > 0.0f) 194 { 195 color.rgb /= color.a; 196 } 197 return uint4(color.rgb * 255, 1); 198} 199 200// Texture3D 201// Float to float LUMA 202float4 PS_FtoF_PM_LUMA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 203{ 204 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 205 color.rgb = color.r * color.a; 206 color.a = 1.0f; 207 return color; 208} 209 210float4 PS_FtoF_UM_LUMA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 211{ 212 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 213 if (color.a > 0.0f) 214 { 215 color.rgb = color.r / color.a; 216 } 217 color.a = 1.0f; 218 return color; 219} 220 221// Float to float LUMAALPHA 222float4 PS_FtoF_PM_LUMAALPHA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 223{ 224 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 225 color.rgb = color.r * color.a; 226 return color; 227} 228 229float4 PS_FtoF_UM_LUMAALPHA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 230{ 231 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 232 if (color.a > 0.0f) 233 { 234 color.rgb = color.r / color.a; 235 } 236 return color; 237} 238 239// Float to float RGBA 240float4 PS_FtoF_PM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 241{ 242 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 243 color.rgb *= color.a; 244 return color; 245} 246 247float4 PS_FtoF_UM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 248{ 249 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 250 if (color.a > 0.0f) 251 { 252 color.rgb /= color.a; 253 } 254 return color; 255} 256 257// Float to float RGB 258float4 PS_FtoF_PM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 259{ 260 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 261 color.rgb *= color.a; 262 color.a = 1.0f; 263 return color; 264} 265 266float4 PS_FtoF_UM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 267{ 268 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 269 if (color.a > 0.0f) 270 { 271 color.rgb /= color.a; 272 } 273 color.a = 1.0f; 274 return color; 275} 276 277float4 PS_FtoF_PM_RGBA_4444_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 278{ 279 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 280 color.rgb *= color.a; 281 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 282 return color; 283} 284 285float4 PS_FtoF_UM_RGBA_4444_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 286{ 287 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 288 if (color.a > 0.0f) 289 { 290 color.rgb /= color.a; 291 } 292 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 293 return color; 294} 295 296float4 PS_FtoF_PM_RGB_565_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 297{ 298 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 299 color.rgb *= color.a; 300 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 301 color.a = 1.0f; 302 return color; 303} 304 305float4 PS_FtoF_UM_RGB_565_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 306{ 307 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 308 if (color.a > 0.0f) 309 { 310 color.rgb /= color.a; 311 } 312 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 313 color.a = 1.0f; 314 return color; 315} 316 317float4 PS_FtoF_PM_RGBA_5551_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 318{ 319 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 320 color.rgb *= color.a; 321 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 322 return color; 323} 324 325float4 PS_FtoF_UM_RGBA_5551_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 326{ 327 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 328 if (color.a > 0.0f) 329 { 330 color.rgb /= color.a; 331 } 332 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 333 return color; 334} 335 336// Float to uint RGBA 337uint4 PS_FtoU_PT_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 338{ 339 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 340 return uint4(color * 255); 341} 342 343uint4 PS_FtoU_PM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 344{ 345 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 346 color.rgb *= color.a; 347 return uint4(color * 255); 348} 349 350uint4 PS_FtoU_UM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 351{ 352 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 353 if (color.a > 0.0f) 354 { 355 color.rgb /= color.a; 356 } 357 return uint4(color * 255); 358} 359 360// Float to uint RGB 361uint4 PS_FtoU_PT_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 362{ 363 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 364 return uint4(color.rgb * 255, 1); 365} 366 367uint4 PS_FtoU_PM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 368{ 369 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 370 color.rgb *= color.a; 371 return uint4(color.rgb * 255, 1); 372} 373 374uint4 PS_FtoU_UM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 375{ 376 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 377 if (color.a > 0.0f) 378 { 379 color.rgb /= color.a; 380 } 381 return uint4(color.rgb * 255, 1); 382} 383 384// Float to int RGBA 385int4 PS_FtoI_PT_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 386{ 387 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 388 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 389 return int4(color * 127); 390} 391 392int4 PS_FtoI_PM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 393{ 394 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 395 color.rgb *= color.a; 396 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 397 return int4(color * 127); 398} 399 400int4 PS_FtoI_UM_RGBA_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 401{ 402 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 403 if (color.a > 0.0f) 404 { 405 color.rgb /= color.a; 406 } 407 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 408 return int4(color * 127); 409} 410 411// Float to int RGB 412int4 PS_FtoI_PT_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 413{ 414 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 415 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 416 return int4(color.rgb * 127, 1); 417} 418 419int4 PS_FtoI_PM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 420{ 421 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 422 color.rgb *= color.a; 423 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 424 return int4(color.rgb * 127, 1); 425} 426 427int4 PS_FtoI_UM_RGB_3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD) : SV_TARGET0 428{ 429 float4 color = TextureF_3D.Sample(Sampler, inTexCoord).rgba; 430 if (color.a > 0.0f) 431 { 432 color.rgb /= color.a; 433 } 434 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 435 return int4(color.rgb * 127, 1); 436} 437 438// Texture2DArray 439// Float to float LUMA 440float4 PS_FtoF_PM_LUMA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 441{ 442 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 443 color.rgb = color.r * color.a; 444 color.a = 1.0f; 445 return color; 446} 447 448float4 PS_FtoF_UM_LUMA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 449{ 450 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 451 if (color.a > 0.0f) 452 { 453 color.rgb = color.r / color.a; 454 } 455 color.a = 1.0f; 456 return color; 457} 458 459// Float to float LUMAALPHA 460float4 PS_FtoF_PM_LUMAALPHA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 461{ 462 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 463 color.rgb = color.r * color.a; 464 return color; 465} 466 467float4 PS_FtoF_UM_LUMAALPHA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 468{ 469 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 470 if (color.a > 0.0f) 471 { 472 color.rgb = color.r / color.a; 473 } 474 return color; 475} 476 477// Float to float RGBA 478float4 PS_FtoF_PM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 479{ 480 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 481 color.rgb *= color.a; 482 return color; 483} 484 485float4 PS_FtoF_UM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 486{ 487 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 488 if (color.a > 0.0f) 489 { 490 color.rgb /= color.a; 491 } 492 return color; 493} 494 495// Float to float RGB 496float4 PS_FtoF_PM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 497{ 498 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 499 color.rgb *= color.a; 500 color.a = 1.0f; 501 return color; 502} 503 504float4 PS_FtoF_UM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 505{ 506 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 507 if (color.a > 0.0f) 508 { 509 color.rgb /= color.a; 510 } 511 color.a = 1.0f; 512 return color; 513} 514 515float4 PS_FtoF_PM_RGBA_4444_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 516{ 517 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 518 color.rgb *= color.a; 519 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 520 return color; 521} 522 523float4 PS_FtoF_UM_RGBA_4444_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 524{ 525 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 526 if (color.a > 0.0f) 527 { 528 color.rgb /= color.a; 529 } 530 color = round(color * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 531 return color; 532} 533 534float4 PS_FtoF_PM_RGB_565_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 535{ 536 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 537 color.rgb *= color.a; 538 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 539 color.a = 1.0f; 540 return color; 541} 542 543float4 PS_FtoF_UM_RGB_565_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 544{ 545 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 546 if (color.a > 0.0f) 547 { 548 color.rgb /= color.a; 549 } 550 color.rgb = round(color.rgb * float3(31, 63, 31)) / float3(31, 63, 31); 551 color.a = 1.0f; 552 return color; 553} 554 555float4 PS_FtoF_PM_RGBA_5551_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 556{ 557 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 558 color.rgb *= color.a; 559 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 560 return color; 561} 562 563float4 PS_FtoF_UM_RGBA_5551_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 564{ 565 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 566 if (color.a > 0.0f) 567 { 568 color.rgb /= color.a; 569 } 570 color = round(color * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 571 return color; 572} 573 574// Float to uint RGBA 575uint4 PS_FtoU_PT_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 576{ 577 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 578 return uint4(color * 255); 579} 580 581uint4 PS_FtoU_PM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 582{ 583 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 584 color.rgb *= color.a; 585 return uint4(color * 255); 586} 587 588uint4 PS_FtoU_UM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 589{ 590 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 591 if (color.a > 0.0f) 592 { 593 color.rgb /= color.a; 594 } 595 return uint4(color * 255); 596} 597 598// Float to uint RGB 599uint4 PS_FtoU_PT_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 600{ 601 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 602 return uint4(color.rgb * 255, 1); 603} 604 605uint4 PS_FtoU_PM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 606{ 607 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 608 color.rgb *= color.a; 609 return uint4(color.rgb * 255, 1); 610} 611 612uint4 PS_FtoU_UM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 613{ 614 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 615 if (color.a > 0.0f) 616 { 617 color.rgb /= color.a; 618 } 619 return uint4(color.rgb * 255, 1); 620} 621 622// Float to int RGBA 623int4 PS_FtoI_PT_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 624{ 625 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 626 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 627 return int4(color * 127); 628} 629 630int4 PS_FtoI_PM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 631{ 632 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 633 color.rgb *= color.a; 634 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 635 return int4(color * 127); 636} 637 638int4 PS_FtoI_UM_RGBA_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 639{ 640 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 641 if (color.a > 0.0f) 642 { 643 color.rgb /= color.a; 644 } 645 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 646 return int4(color * 127); 647} 648 649// Float to int RGB 650int4 PS_FtoI_PT_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 651{ 652 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 653 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 654 return int4(color.rgb * 127, 1); 655} 656 657int4 PS_FtoI_PM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 658{ 659 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 660 color.rgb *= color.a; 661 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 662 return int4(color.rgb * 127, 1); 663} 664 665int4 PS_FtoI_UM_RGB_2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 666{ 667 float4 color = TextureF_2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 668 if (color.a > 0.0f) 669 { 670 color.rgb /= color.a; 671 } 672 color = round(color * float4(127, 127, 127, 127)) / float4(127, 127, 127, 127); 673 return int4(color.rgb * 127, 1); 674} 675