MCPcopy Create free account
hub / github.com/InoriRus/Kyty / get_texture_format

Function get_texture_format

source/emulator/src/Graphics/Objects/Texture.cpp:20–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace Kyty::Libs::Graphics {
19
20static VkFormat get_texture_format(uint32_t dfmt, uint32_t nfmt, uint32_t fmt)
21{
22 if (fmt == 0)
23 {
24 if (nfmt == 9 && dfmt == 10)
25 {
26 return VK_FORMAT_R8G8B8A8_SRGB;
27 }
28 if (nfmt == 0 && dfmt == 10)
29 {
30 return VK_FORMAT_R8G8B8A8_UNORM;
31 }
32 if (nfmt == 0 && dfmt == 1)
33 {
34 return VK_FORMAT_R8_UNORM;
35 }
36 if (nfmt == 0 && dfmt == 3)
37 {
38 return VK_FORMAT_R8G8_UNORM;
39 }
40 if (nfmt == 9 && dfmt == 37)
41 {
42 return VK_FORMAT_BC3_SRGB_BLOCK;
43 }
44 if (nfmt == 0 && dfmt == 37)
45 {
46 return VK_FORMAT_BC3_UNORM_BLOCK;
47 }
48 if (nfmt == 0 && dfmt == 36)
49 {
50 return VK_FORMAT_BC2_UNORM_BLOCK;
51 }
52 if (nfmt == 0 && dfmt == 35)
53 {
54 return VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
55 }
56 EXIT("unknown format: nfmt = %u, dfmt = %u\n", nfmt, dfmt);
57 } else
58 {
59 if (fmt == 56)
60 {
61 return VK_FORMAT_R8G8B8A8_UNORM;
62 }
63 EXIT("unknown format: fmt = %u\n", fmt);
64 }
65 return VK_FORMAT_UNDEFINED;
66}
67
68static VkComponentSwizzle get_swizzle(uint8_t s)
69{

Callers 2

create_funcFunction · 0.70
create2_funcFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected