diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/surface_params.cpp | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index f789da2c4..290ba438d 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp | |||
| @@ -16,11 +16,13 @@ namespace VideoCommon { | |||
| 16 | using VideoCore::Surface::ComponentTypeFromDepthFormat; | 16 | using VideoCore::Surface::ComponentTypeFromDepthFormat; |
| 17 | using VideoCore::Surface::ComponentTypeFromRenderTarget; | 17 | using VideoCore::Surface::ComponentTypeFromRenderTarget; |
| 18 | using VideoCore::Surface::ComponentTypeFromTexture; | 18 | using VideoCore::Surface::ComponentTypeFromTexture; |
| 19 | using VideoCore::Surface::PixelFormat; | ||
| 19 | using VideoCore::Surface::PixelFormatFromDepthFormat; | 20 | using VideoCore::Surface::PixelFormatFromDepthFormat; |
| 20 | using VideoCore::Surface::PixelFormatFromRenderTargetFormat; | 21 | using VideoCore::Surface::PixelFormatFromRenderTargetFormat; |
| 21 | using VideoCore::Surface::PixelFormatFromTextureFormat; | 22 | using VideoCore::Surface::PixelFormatFromTextureFormat; |
| 22 | using VideoCore::Surface::SurfaceTarget; | 23 | using VideoCore::Surface::SurfaceTarget; |
| 23 | using VideoCore::Surface::SurfaceTargetFromTextureType; | 24 | using VideoCore::Surface::SurfaceTargetFromTextureType; |
| 25 | using VideoCore::Surface::SurfaceType; | ||
| 24 | 26 | ||
| 25 | SurfaceTarget TextureType2SurfaceTarget(Tegra::Shader::TextureType type, bool is_array) { | 27 | SurfaceTarget TextureType2SurfaceTarget(Tegra::Shader::TextureType type, bool is_array) { |
| 26 | switch (type) { | 28 | switch (type) { |
| @@ -71,6 +73,24 @@ SurfaceParams SurfaceParams::CreateForTexture(Core::System& system, | |||
| 71 | params.tile_width_spacing = params.is_tiled ? (1 << config.tic.tile_width_spacing.Value()) : 1; | 73 | params.tile_width_spacing = params.is_tiled ? (1 << config.tic.tile_width_spacing.Value()) : 1; |
| 72 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), | 74 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), |
| 73 | params.srgb_conversion); | 75 | params.srgb_conversion); |
| 76 | params.type = GetFormatType(params.pixel_format); | ||
| 77 | if (entry.IsShadow() && params.type == SurfaceType::ColorTexture) { | ||
| 78 | switch (params.pixel_format) { | ||
| 79 | case PixelFormat::R16F: { | ||
| 80 | params.pixel_format = PixelFormat::Z16; | ||
| 81 | break; | ||
| 82 | } | ||
| 83 | case PixelFormat::R32F: { | ||
| 84 | params.pixel_format = PixelFormat::Z32F; | ||
| 85 | break; | ||
| 86 | } | ||
| 87 | default: { | ||
| 88 | UNIMPLEMENTED_MSG("Unimplemented shadow convert format: {}", | ||
| 89 | static_cast<u32>(params.pixel_format)); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | params.type = GetFormatType(params.pixel_format); | ||
| 93 | } | ||
| 74 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); | 94 | params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); |
| 75 | params.type = GetFormatType(params.pixel_format); | 95 | params.type = GetFormatType(params.pixel_format); |
| 76 | // TODO: on 1DBuffer we should use the tic info. | 96 | // TODO: on 1DBuffer we should use the tic info. |
| @@ -79,20 +99,24 @@ SurfaceParams SurfaceParams::CreateForTexture(Core::System& system, | |||
| 79 | params.width = config.tic.Width(); | 99 | params.width = config.tic.Width(); |
| 80 | params.height = config.tic.Height(); | 100 | params.height = config.tic.Height(); |
| 81 | params.depth = config.tic.Depth(); | 101 | params.depth = config.tic.Depth(); |
| 102 | params.pitch = params.is_tiled ? 0 : config.tic.Pitch(); | ||
| 103 | if (params.target == SurfaceTarget::TextureCubemap || | ||
| 104 | params.target == SurfaceTarget::TextureCubeArray) { | ||
| 105 | params.depth *= 6; | ||
| 106 | } | ||
| 107 | params.num_levels = config.tic.max_mip_level + 1; | ||
| 108 | params.emulated_levels = std::min(params.num_levels, params.MaxPossibleMipmap()); | ||
| 109 | params.is_layered = params.IsLayered(); | ||
| 82 | } else { | 110 | } else { |
| 83 | params.target = SurfaceTarget::TextureBuffer; | 111 | params.target = SurfaceTarget::TextureBuffer; |
| 84 | params.width = config.tic.Width(); | 112 | params.width = config.tic.Width(); |
| 85 | params.height = 0; | 113 | params.pitch = params.width * params.GetBytesPerPixel(); |
| 86 | params.depth = 0; | 114 | params.height = 1; |
| 115 | params.depth = 1; | ||
| 116 | params.num_levels = 1; | ||
| 117 | params.emulated_levels = 1; | ||
| 118 | params.is_layered = false; | ||
| 87 | } | 119 | } |
| 88 | if (params.target == SurfaceTarget::TextureCubemap || | ||
| 89 | params.target == SurfaceTarget::TextureCubeArray) { | ||
| 90 | params.depth *= 6; | ||
| 91 | } | ||
| 92 | params.pitch = params.is_tiled ? 0 : config.tic.Pitch(); | ||
| 93 | params.num_levels = config.tic.max_mip_level + 1; | ||
| 94 | params.emulated_levels = std::min(params.num_levels, params.MaxPossibleMipmap()); | ||
| 95 | params.is_layered = params.IsLayered(); | ||
| 96 | return params; | 120 | return params; |
| 97 | } | 121 | } |
| 98 | 122 | ||