|
|
|
@ -145,7 +145,7 @@ void Maxwell3D::ProcessQueryGet() {
|
|
|
|
|
GPUVAddr sequence_address = regs.query.QueryAddress();
|
|
|
|
|
// Since the sequence address is given as a GPU VAddr, we have to convert it to an application
|
|
|
|
|
// VAddr before writing.
|
|
|
|
|
VAddr address = memory_manager.GpuToCpuAddress(sequence_address);
|
|
|
|
|
boost::optional<VAddr> address = memory_manager.GpuToCpuAddress(sequence_address);
|
|
|
|
|
|
|
|
|
|
// TODO(Subv): Support the other query units.
|
|
|
|
|
ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop,
|
|
|
|
@ -153,7 +153,7 @@ void Maxwell3D::ProcessQueryGet() {
|
|
|
|
|
ASSERT_MSG(regs.query.query_get.short_query,
|
|
|
|
|
"Writing the entire query result structure is unimplemented");
|
|
|
|
|
|
|
|
|
|
u32 value = Memory::Read32(address);
|
|
|
|
|
u32 value = Memory::Read32(*address);
|
|
|
|
|
u32 result = 0;
|
|
|
|
|
|
|
|
|
|
// TODO(Subv): Support the other query variables
|
|
|
|
@ -173,7 +173,7 @@ void Maxwell3D::ProcessQueryGet() {
|
|
|
|
|
case Regs::QueryMode::Write2: {
|
|
|
|
|
// Write the current query sequence to the sequence address.
|
|
|
|
|
u32 sequence = regs.query.query_sequence;
|
|
|
|
|
Memory::Write32(address, sequence);
|
|
|
|
|
Memory::Write32(*address, sequence);
|
|
|
|
|
|
|
|
|
|
// TODO(Subv): Write the proper query response structure to the address when not using short
|
|
|
|
|
// mode.
|
|
|
|
@ -225,9 +225,10 @@ void Maxwell3D::ProcessCBData(u32 value) {
|
|
|
|
|
// Don't allow writing past the end of the buffer.
|
|
|
|
|
ASSERT(regs.const_buffer.cb_pos + sizeof(u32) <= regs.const_buffer.cb_size);
|
|
|
|
|
|
|
|
|
|
VAddr address = memory_manager.GpuToCpuAddress(buffer_address + regs.const_buffer.cb_pos);
|
|
|
|
|
boost::optional<VAddr> address =
|
|
|
|
|
memory_manager.GpuToCpuAddress(buffer_address + regs.const_buffer.cb_pos);
|
|
|
|
|
|
|
|
|
|
Memory::Write32(address, value);
|
|
|
|
|
Memory::Write32(*address, value);
|
|
|
|
|
|
|
|
|
|
// Increment the current buffer position.
|
|
|
|
|
regs.const_buffer.cb_pos = regs.const_buffer.cb_pos + 4;
|
|
|
|
@ -237,10 +238,10 @@ Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {
|
|
|
|
|
GPUVAddr tic_base_address = regs.tic.TICAddress();
|
|
|
|
|
|
|
|
|
|
GPUVAddr tic_address_gpu = tic_base_address + tic_index * sizeof(Texture::TICEntry);
|
|
|
|
|
VAddr tic_address_cpu = memory_manager.GpuToCpuAddress(tic_address_gpu);
|
|
|
|
|
boost::optional<VAddr> tic_address_cpu = memory_manager.GpuToCpuAddress(tic_address_gpu);
|
|
|
|
|
|
|
|
|
|
Texture::TICEntry tic_entry;
|
|
|
|
|
Memory::ReadBlock(tic_address_cpu, &tic_entry, sizeof(Texture::TICEntry));
|
|
|
|
|
Memory::ReadBlock(*tic_address_cpu, &tic_entry, sizeof(Texture::TICEntry));
|
|
|
|
|
|
|
|
|
|
ASSERT_MSG(tic_entry.header_version == Texture::TICHeaderVersion::BlockLinear ||
|
|
|
|
|
tic_entry.header_version == Texture::TICHeaderVersion::Pitch,
|
|
|
|
@ -267,10 +268,10 @@ Texture::TSCEntry Maxwell3D::GetTSCEntry(u32 tsc_index) const {
|
|
|
|
|
GPUVAddr tsc_base_address = regs.tsc.TSCAddress();
|
|
|
|
|
|
|
|
|
|
GPUVAddr tsc_address_gpu = tsc_base_address + tsc_index * sizeof(Texture::TSCEntry);
|
|
|
|
|
VAddr tsc_address_cpu = memory_manager.GpuToCpuAddress(tsc_address_gpu);
|
|
|
|
|
boost::optional<VAddr> tsc_address_cpu = memory_manager.GpuToCpuAddress(tsc_address_gpu);
|
|
|
|
|
|
|
|
|
|
Texture::TSCEntry tsc_entry;
|
|
|
|
|
Memory::ReadBlock(tsc_address_cpu, &tsc_entry, sizeof(Texture::TSCEntry));
|
|
|
|
|
Memory::ReadBlock(*tsc_address_cpu, &tsc_entry, sizeof(Texture::TSCEntry));
|
|
|
|
|
return tsc_entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -292,7 +293,7 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt
|
|
|
|
|
current_texture < tex_info_buffer_end; current_texture += sizeof(Texture::TextureHandle)) {
|
|
|
|
|
|
|
|
|
|
Texture::TextureHandle tex_handle{
|
|
|
|
|
Memory::Read32(memory_manager.GpuToCpuAddress(current_texture))};
|
|
|
|
|
Memory::Read32(*memory_manager.GpuToCpuAddress(current_texture))};
|
|
|
|
|
|
|
|
|
|
Texture::FullTextureInfo tex_info{};
|
|
|
|
|
// TODO(Subv): Use the shader to determine which textures are actually accessed.
|
|
|
|
|