summaryrefslogtreecommitdiffstats
path: root/src/video_core/texture/texture_decode.h
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-01-05 23:11:23 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-04 21:31:40 +0100
commita1c9ac7845395c250a78fc8df93a9ffed29f3d5b (patch)
tree7e3768df24f82e9e732302318326113419309d33 /src/video_core/texture/texture_decode.h
parentMerge pull request #2496 from mailwl/cfg-mem (diff)
downloadyuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar.gz
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar.bz2
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar.lz
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar.xz
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.tar.zst
yuzu-a1c9ac7845395c250a78fc8df93a9ffed29f3d5b.zip
Diffstat (limited to 'src/video_core/texture/texture_decode.h')
-rw-r--r--src/video_core/texture/texture_decode.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/video_core/texture/texture_decode.h b/src/video_core/texture/texture_decode.h
new file mode 100644
index 000000000..0c1438b0f
--- /dev/null
+++ b/src/video_core/texture/texture_decode.h
@@ -0,0 +1,40 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+#include "common/vector_math.h"
+#include "video_core/pica.h"
+
+namespace Pica {
+namespace Texture {
+
+struct TextureInfo {
+ PAddr physical_address;
+ int width;
+ int height;
+ int stride;
+ Pica::Regs::TextureFormat format;
+
+ static TextureInfo FromPicaRegister(const Pica::Regs::TextureConfig& config,
+ const Pica::Regs::TextureFormat& format);
+};
+
+/**
+ * Lookup texel located at the given coordinates and return an RGBA vector of its color.
+ * @param source Source pointer to read data from
+ * @param s,t Texture coordinates to read from
+ * @param info TextureInfo object describing the texture setup
+ * @param disable_alpha This is used for debug widgets which use this method to display textures
+ * without providing a good way to visualize alpha by themselves. If true, this will return 255 for
+ * the alpha component, and either drop the information entirely or store it in an "unused" color
+ * channel.
+ * @todo Eventually we should get rid of the disable_alpha parameter.
+ */
+Math::Vec4<u8> LookupTexture(const u8* source, int s, int t, const TextureInfo& info,
+ bool disable_alpha = false);
+
+} // namespace Texture
+} // namespace Pica