Debian Codegraph @

Source/Core/VideoCommon/Resources/InvalidTextures.cpp

raw symbols SCIP
1 // Copyright 2025 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #include "VideoCommon/Resources/InvalidTextures.h"
5
6 #include "VideoCommon/AbstractGfx.h"
7 #include "VideoCommon/TextureConfig.h"
8
9 namespace VideoCommon
10 {
11 std::unique_ptr<AbstractTexture> CreateInvalidTransparentTexture()
12 {
13 const TextureConfig tex_config{
14 1, 1, 1, 1, 1, AbstractTextureFormat::RGBA8, 0, AbstractTextureType::Texture_2D};
15 auto texture = g_gfx->CreateTexture(tex_config, "Invalid Transparent Texture");
16 const std::array<u8, 4> pixel{0, 0, 0, 0};
17 texture->Load(0, 1, 1, 1, pixel.data(), pixel.size());
18 return texture;
19 }
20
21 std::unique_ptr<AbstractTexture> CreateInvalidColorTexture()
22 {
23 const TextureConfig tex_config{
24 1, 1, 1, 1, 1, AbstractTextureFormat::RGBA8, 0, AbstractTextureType::Texture_2D};
25 auto texture = g_gfx->CreateTexture(tex_config, "Invalid Color Texture");
26 const std::array<u8, 4> pixel{255, 0, 255, 255};
27 texture->Load(0, 1, 1, 1, pixel.data(), pixel.size());
28 return texture;
29 }
30
31 std::unique_ptr<AbstractTexture> CreateInvalidCubemapTexture()
32 {
33 #ifdef __APPLE__
34 // TODO: figure out cube map oddness on Apple (specifically Metal)
35 return nullptr;
36 #else
37 const TextureConfig tex_config{
38 1, 1, 1, 6, 1, AbstractTextureFormat::RGBA8, 0, AbstractTextureType::Texture_CubeMap};
39 auto texture = g_gfx->CreateTexture(tex_config, "Invalid Cubemap Texture");
40 const std::array<u8, 4> pixel{255, 0, 255, 255};
41 for (u32 i = 0; i < tex_config.layers; i++)
42 {
43 texture->Load(0, tex_config.width, tex_config.height, 1, pixel.data(), pixel.size(), i);
44 }
45 return texture;
46 #endif
47 }
48
49 std::unique_ptr<AbstractTexture> CreateInvalidArrayTexture()
50 {
51 const TextureConfig tex_config{
52 1, 1, 1, 1, 1, AbstractTextureFormat::RGBA8, 0, AbstractTextureType::Texture_2DArray};
53 auto texture = g_gfx->CreateTexture(tex_config, "Invalid Array Texture");
54 const std::array<u8, 4> pixel{255, 0, 255, 255};
55 texture->Load(0, 1, 1, 1, pixel.data(), pixel.size());
56 return texture;
57 }
58 } // namespace VideoCommon