summaryrefslogtreecommitdiff
path: root/src/video_core/textures
diff options
context:
space:
mode:
authorGravatar Subv2018-03-19 18:00:29 -0500
committerGravatar Subv2018-03-24 11:30:56 -0500
commit71ebc3e90da9882139d2a5695ca1ed59ea77e94f (patch)
tree48139f0812ee19b69c51db347d4cc4acb23f948b /src/video_core/textures
parentMerge pull request #275 from MerryMage/addticks-dynarmic (diff)
downloadyuzu-71ebc3e90da9882139d2a5695ca1ed59ea77e94f.tar.gz
yuzu-71ebc3e90da9882139d2a5695ca1ed59ea77e94f.tar.xz
yuzu-71ebc3e90da9882139d2a5695ca1ed59ea77e94f.zip
GPU: Preliminary work for texture decoding.
Diffstat (limited to 'src/video_core/textures')
-rw-r--r--src/video_core/textures/decoders.cpp14
-rw-r--r--src/video_core/textures/decoders.h20
-rw-r--r--src/video_core/textures/texture.h57
3 files changed, 91 insertions, 0 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
new file mode 100644
index 000000000..705e2e066
--- /dev/null
+++ b/src/video_core/textures/decoders.cpp
@@ -0,0 +1,14 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "video_core/textures/decoders.h"
6
7namespace Tegra {
8namespace Texture {
9
10std::vector<u8> DecodeTexture(VAddr address, TextureFormat format, u32 width, u32 height) {
11 return {};
12}
13}
14} // namespace Tegra
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h
new file mode 100644
index 000000000..e0d55600e
--- /dev/null
+++ b/src/video_core/textures/decoders.h
@@ -0,0 +1,20 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <vector>
8#include "common/common_types.h"
9#include "video_core/textures/texture.h"
10
11namespace Tegra {
12namespace Texture {
13
14/**
15 * Decodes a swizzled texture into a RGBA8888 texture.
16 */
17std::vector<u8> DecodeTexture(VAddr address, TextureFormat format, u32 width, u32 height);
18
19} // namespace Texture
20} // namespace Tegra
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
new file mode 100644
index 000000000..3306d2ab2
--- /dev/null
+++ b/src/video_core/textures/texture.h
@@ -0,0 +1,57 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/bit_field.h"
8#include "common/common_funcs.h"
9#include "common/common_types.h"
10#include "video_core/memory_manager.h"
11
12namespace Tegra {
13namespace Texture {
14
15enum class TextureFormat : u32 {
16 DXT1 = 0x24,
17};
18
19union TextureHandle {
20 u32 raw;
21 BitField<0, 20, u32> tic_id;
22 BitField<20, 12, u32> tsc_id;
23};
24
25struct TICEntry {
26 union {
27 u32 raw;
28 BitField<0, 7, TextureFormat> format;
29 BitField<7, 3, u32> r_type;
30 BitField<10, 3, u32> g_type;
31 BitField<13, 3, u32> b_type;
32 BitField<16, 3, u32> a_type;
33 };
34 u32 address_low;
35 u16 address_high;
36 INSERT_PADDING_BYTES(6);
37 u16 width_minus_1;
38 INSERT_PADDING_BYTES(2);
39 u16 height_minus_1;
40 INSERT_PADDING_BYTES(10);
41
42 GPUVAddr Address() const {
43 return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low);
44 }
45
46 u32 Width() const {
47 return width_minus_1 + 1;
48 }
49
50 u32 Height() const {
51 return height_minus_1 + 1;
52 }
53};
54static_assert(sizeof(TICEntry) == 0x20, "TICEntry has wrong size");
55
56} // namespace Texture
57} // namespace Tegra