summaryrefslogtreecommitdiff
path: root/src/video_core/shader_environment.cpp
diff options
context:
space:
mode:
authorGravatar FengChen2022-09-01 22:05:11 +0800
committerGravatar FengChen2022-09-20 11:55:43 +0800
commit9a95c7fa14bdfc14aacea92896c8ae8533918fe8 (patch)
tree3beb2289136a59134195d35e37d4b56b294a3081 /src/video_core/shader_environment.cpp
parentMerge pull request #8841 from zhaobot/tx-update-20220901035349 (diff)
downloadyuzu-9a95c7fa14bdfc14aacea92896c8ae8533918fe8.tar.gz
yuzu-9a95c7fa14bdfc14aacea92896c8ae8533918fe8.tar.xz
yuzu-9a95c7fa14bdfc14aacea92896c8ae8533918fe8.zip
video_core: Generate mipmap texture by drawing
Diffstat (limited to 'src/video_core/shader_environment.cpp')
-rw-r--r--src/video_core/shader_environment.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp
index 808d88eec..3ead06dd6 100644
--- a/src/video_core/shader_environment.cpp
+++ b/src/video_core/shader_environment.cpp
@@ -191,6 +191,8 @@ void GenericEnvironment::Serialize(std::ofstream& file) const {
191 .write(reinterpret_cast<const char*>(&start_address), sizeof(start_address)) 191 .write(reinterpret_cast<const char*>(&start_address), sizeof(start_address))
192 .write(reinterpret_cast<const char*>(&cached_lowest), sizeof(cached_lowest)) 192 .write(reinterpret_cast<const char*>(&cached_lowest), sizeof(cached_lowest))
193 .write(reinterpret_cast<const char*>(&cached_highest), sizeof(cached_highest)) 193 .write(reinterpret_cast<const char*>(&cached_highest), sizeof(cached_highest))
194 .write(reinterpret_cast<const char*>(&viewport_transform_state),
195 sizeof(viewport_transform_state))
194 .write(reinterpret_cast<const char*>(&stage), sizeof(stage)) 196 .write(reinterpret_cast<const char*>(&stage), sizeof(stage))
195 .write(reinterpret_cast<const char*>(code.data()), code_size); 197 .write(reinterpret_cast<const char*>(code.data()), code_size);
196 for (const auto& [key, type] : texture_types) { 198 for (const auto& [key, type] : texture_types) {
@@ -311,6 +313,12 @@ Shader::TextureType GraphicsEnvironment::ReadTextureType(u32 handle) {
311 return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, via_header_index, handle); 313 return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, via_header_index, handle);
312} 314}
313 315
316u32 GraphicsEnvironment::ReadViewportTransformState() {
317 const auto& regs{maxwell3d->regs};
318 viewport_transform_state = regs.viewport_transform_enabled;
319 return viewport_transform_state;
320}
321
314ComputeEnvironment::ComputeEnvironment(Tegra::Engines::KeplerCompute& kepler_compute_, 322ComputeEnvironment::ComputeEnvironment(Tegra::Engines::KeplerCompute& kepler_compute_,
315 Tegra::MemoryManager& gpu_memory_, GPUVAddr program_base_, 323 Tegra::MemoryManager& gpu_memory_, GPUVAddr program_base_,
316 u32 start_address_) 324 u32 start_address_)
@@ -342,6 +350,10 @@ Shader::TextureType ComputeEnvironment::ReadTextureType(u32 handle) {
342 return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); 350 return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle);
343} 351}
344 352
353u32 ComputeEnvironment::ReadViewportTransformState() {
354 return viewport_transform_state;
355}
356
345void FileEnvironment::Deserialize(std::ifstream& file) { 357void FileEnvironment::Deserialize(std::ifstream& file) {
346 u64 code_size{}; 358 u64 code_size{};
347 u64 num_texture_types{}; 359 u64 num_texture_types{};
@@ -354,6 +366,7 @@ void FileEnvironment::Deserialize(std::ifstream& file) {
354 .read(reinterpret_cast<char*>(&start_address), sizeof(start_address)) 366 .read(reinterpret_cast<char*>(&start_address), sizeof(start_address))
355 .read(reinterpret_cast<char*>(&read_lowest), sizeof(read_lowest)) 367 .read(reinterpret_cast<char*>(&read_lowest), sizeof(read_lowest))
356 .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) 368 .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest))
369 .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state))
357 .read(reinterpret_cast<char*>(&stage), sizeof(stage)); 370 .read(reinterpret_cast<char*>(&stage), sizeof(stage));
358 code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64))); 371 code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64)));
359 file.read(reinterpret_cast<char*>(code.get()), code_size); 372 file.read(reinterpret_cast<char*>(code.get()), code_size);
@@ -411,6 +424,10 @@ Shader::TextureType FileEnvironment::ReadTextureType(u32 handle) {
411 return it->second; 424 return it->second;
412} 425}
413 426
427u32 FileEnvironment::ReadViewportTransformState() {
428 return viewport_transform_state;
429}
430
414u32 FileEnvironment::LocalMemorySize() const { 431u32 FileEnvironment::LocalMemorySize() const {
415 return local_memory_size; 432 return local_memory_size;
416} 433}