diff options
| author | 2022-11-03 22:21:58 -0700 | |
|---|---|---|
| committer | 2022-11-03 22:21:58 -0700 | |
| commit | 38e4382f532d606afbd3969990a9ca3bac70e557 (patch) | |
| tree | b9af6ed0a26285f4b0dcd5c21028601004267607 /src/video_core/shader_environment.cpp | |
| parent | Merge pull request #9135 from liamwhite/service-thread-event (diff) | |
| parent | Merge branch 'master' into mipmap (diff) | |
| download | yuzu-38e4382f532d606afbd3969990a9ca3bac70e557.tar.gz yuzu-38e4382f532d606afbd3969990a9ca3bac70e557.tar.xz yuzu-38e4382f532d606afbd3969990a9ca3bac70e557.zip | |
Merge pull request #8858 from vonchenplus/mipmap
video_core: Generate mipmap texture by drawing
Diffstat (limited to 'src/video_core/shader_environment.cpp')
| -rw-r--r-- | src/video_core/shader_environment.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp index fbabb3219..63bcf9337 100644 --- a/src/video_core/shader_environment.cpp +++ b/src/video_core/shader_environment.cpp | |||
| @@ -188,6 +188,8 @@ void GenericEnvironment::Serialize(std::ofstream& file) const { | |||
| 188 | .write(reinterpret_cast<const char*>(&start_address), sizeof(start_address)) | 188 | .write(reinterpret_cast<const char*>(&start_address), sizeof(start_address)) |
| 189 | .write(reinterpret_cast<const char*>(&cached_lowest), sizeof(cached_lowest)) | 189 | .write(reinterpret_cast<const char*>(&cached_lowest), sizeof(cached_lowest)) |
| 190 | .write(reinterpret_cast<const char*>(&cached_highest), sizeof(cached_highest)) | 190 | .write(reinterpret_cast<const char*>(&cached_highest), sizeof(cached_highest)) |
| 191 | .write(reinterpret_cast<const char*>(&viewport_transform_state), | ||
| 192 | sizeof(viewport_transform_state)) | ||
| 191 | .write(reinterpret_cast<const char*>(&stage), sizeof(stage)) | 193 | .write(reinterpret_cast<const char*>(&stage), sizeof(stage)) |
| 192 | .write(reinterpret_cast<const char*>(code.data()), code_size); | 194 | .write(reinterpret_cast<const char*>(code.data()), code_size); |
| 193 | for (const auto& [key, type] : texture_types) { | 195 | for (const auto& [key, type] : texture_types) { |
| @@ -309,6 +311,12 @@ Shader::TextureType GraphicsEnvironment::ReadTextureType(u32 handle) { | |||
| 309 | handle); | 311 | handle); |
| 310 | } | 312 | } |
| 311 | 313 | ||
| 314 | u32 GraphicsEnvironment::ReadViewportTransformState() { | ||
| 315 | const auto& regs{maxwell3d->regs}; | ||
| 316 | viewport_transform_state = regs.viewport_transform_enabled; | ||
| 317 | return viewport_transform_state; | ||
| 318 | } | ||
| 319 | |||
| 312 | ComputeEnvironment::ComputeEnvironment(Tegra::Engines::KeplerCompute& kepler_compute_, | 320 | ComputeEnvironment::ComputeEnvironment(Tegra::Engines::KeplerCompute& kepler_compute_, |
| 313 | Tegra::MemoryManager& gpu_memory_, GPUVAddr program_base_, | 321 | Tegra::MemoryManager& gpu_memory_, GPUVAddr program_base_, |
| 314 | u32 start_address_) | 322 | u32 start_address_) |
| @@ -340,6 +348,10 @@ Shader::TextureType ComputeEnvironment::ReadTextureType(u32 handle) { | |||
| 340 | return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); | 348 | return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); |
| 341 | } | 349 | } |
| 342 | 350 | ||
| 351 | u32 ComputeEnvironment::ReadViewportTransformState() { | ||
| 352 | return viewport_transform_state; | ||
| 353 | } | ||
| 354 | |||
| 343 | void FileEnvironment::Deserialize(std::ifstream& file) { | 355 | void FileEnvironment::Deserialize(std::ifstream& file) { |
| 344 | u64 code_size{}; | 356 | u64 code_size{}; |
| 345 | u64 num_texture_types{}; | 357 | u64 num_texture_types{}; |
| @@ -352,6 +364,7 @@ void FileEnvironment::Deserialize(std::ifstream& file) { | |||
| 352 | .read(reinterpret_cast<char*>(&start_address), sizeof(start_address)) | 364 | .read(reinterpret_cast<char*>(&start_address), sizeof(start_address)) |
| 353 | .read(reinterpret_cast<char*>(&read_lowest), sizeof(read_lowest)) | 365 | .read(reinterpret_cast<char*>(&read_lowest), sizeof(read_lowest)) |
| 354 | .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) | 366 | .read(reinterpret_cast<char*>(&read_highest), sizeof(read_highest)) |
| 367 | .read(reinterpret_cast<char*>(&viewport_transform_state), sizeof(viewport_transform_state)) | ||
| 355 | .read(reinterpret_cast<char*>(&stage), sizeof(stage)); | 368 | .read(reinterpret_cast<char*>(&stage), sizeof(stage)); |
| 356 | code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64))); | 369 | code = std::make_unique<u64[]>(Common::DivCeil(code_size, sizeof(u64))); |
| 357 | file.read(reinterpret_cast<char*>(code.get()), code_size); | 370 | file.read(reinterpret_cast<char*>(code.get()), code_size); |
| @@ -409,6 +422,10 @@ Shader::TextureType FileEnvironment::ReadTextureType(u32 handle) { | |||
| 409 | return it->second; | 422 | return it->second; |
| 410 | } | 423 | } |
| 411 | 424 | ||
| 425 | u32 FileEnvironment::ReadViewportTransformState() { | ||
| 426 | return viewport_transform_state; | ||
| 427 | } | ||
| 428 | |||
| 412 | u32 FileEnvironment::LocalMemorySize() const { | 429 | u32 FileEnvironment::LocalMemorySize() const { |
| 413 | return local_memory_size; | 430 | return local_memory_size; |
| 414 | } | 431 | } |