summaryrefslogtreecommitdiff
path: root/src/video_core/engines
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/engines
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/engines')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 4d9745e48..ca1b150a7 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -2,8 +2,11 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes>
5#include "common/assert.h" 6#include "common/assert.h"
6#include "video_core/engines/maxwell_3d.h" 7#include "video_core/engines/maxwell_3d.h"
8#include "video_core/textures/decoders.h"
9#include "video_core/textures/texture.h"
7 10
8namespace Tegra { 11namespace Tegra {
9namespace Engines { 12namespace Engines {
@@ -160,6 +163,48 @@ void Maxwell3D::ProcessQueryGet() {
160 163
161void Maxwell3D::DrawArrays() { 164void Maxwell3D::DrawArrays() {
162 LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring"); 165 LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring");
166
167 auto& fragment_shader = state.shader_stages[static_cast<size_t>(Regs::ShaderStage::Fragment)];
168 auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index];
169 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
170
171 GPUVAddr tic_base_address = regs.tic.TICAddress();
172
173 GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size;
174
175 for (GPUVAddr current_texture = tex_info_buffer.address + 0x20;
176 current_texture < tex_info_buffer_end; current_texture += 4) {
177
178 Texture::TextureHandle tex_info{
179 Memory::Read32(memory_manager.PhysicalToVirtualAddress(current_texture))};
180
181 if (tex_info.tic_id != 0 || tex_info.tsc_id != 0) {
182 GPUVAddr tic_address_gpu =
183 tic_base_address + tex_info.tic_id * sizeof(Texture::TICEntry);
184 VAddr tic_address_cpu = memory_manager.PhysicalToVirtualAddress(tic_address_gpu);
185
186 Texture::TICEntry tic_entry;
187 Memory::ReadBlock(tic_address_cpu, &tic_entry, sizeof(Texture::TICEntry));
188
189 auto r_type = tic_entry.r_type.Value();
190 auto g_type = tic_entry.g_type.Value();
191 auto b_type = tic_entry.b_type.Value();
192 auto a_type = tic_entry.a_type.Value();
193
194 // TODO(Subv): Different data types for separate components are not supported
195 ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
196
197 auto format = tic_entry.format.Value();
198
199 auto texture = Texture::DecodeTexture(
200 memory_manager.PhysicalToVirtualAddress(tic_entry.Address()),
201 tic_entry.format.Value(), tic_entry.Width(), tic_entry.Height());
202
203 LOG_CRITICAL(HW_GPU,
204 "Fragment shader using texture TIC %08X TSC %08X at address %016" PRIX64,
205 tex_info.tic_id.Value(), tex_info.tsc_id.Value(), tic_entry.Address());
206 }
207 }
163} 208}
164 209
165void Maxwell3D::BindTextureInfoBuffer(const std::vector<u32>& parameters) { 210void Maxwell3D::BindTextureInfoBuffer(const std::vector<u32>& parameters) {