diff options
| author | 2018-04-24 18:01:06 -0400 | |
|---|---|---|
| committer | 2018-04-24 22:31:46 -0400 | |
| commit | f1a4a004fb8423091b48ceffdbd1e696372d4dc4 (patch) | |
| tree | d325f360cccc55883840c8e27e3969d2acae2371 | |
| parent | gl_rasterizer_cache: Use GPU PAGE_BITS/SIZE, not CPU. (diff) | |
| download | yuzu-f1a4a004fb8423091b48ceffdbd1e696372d4dc4.tar.gz yuzu-f1a4a004fb8423091b48ceffdbd1e696372d4dc4.tar.xz yuzu-f1a4a004fb8423091b48ceffdbd1e696372d4dc4.zip | |
gl_rasterizer_cache: Use CHAR_BIT for bpp conversions instead of 8.
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index aef1c5979..501d15e98 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -82,7 +82,7 @@ static u16 GetResolutionScaleFactor() { | |||
| 82 | template <bool morton_to_gl, PixelFormat format> | 82 | template <bool morton_to_gl, PixelFormat format> |
| 83 | void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, Tegra::GPUVAddr base, | 83 | void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, Tegra::GPUVAddr base, |
| 84 | Tegra::GPUVAddr start, Tegra::GPUVAddr end) { | 84 | Tegra::GPUVAddr start, Tegra::GPUVAddr end) { |
| 85 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8; | 85 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; |
| 86 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); | 86 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); |
| 87 | const auto& gpu = Core::System::GetInstance().GPU(); | 87 | const auto& gpu = Core::System::GetInstance().GPU(); |
| 88 | 88 | ||
| @@ -358,9 +358,9 @@ bool CachedSurface::CanFill(const SurfaceParams& dest_surface, | |||
| 358 | boost::icl::last_next(fill_interval) <= end && // dest_surface is within our fill range | 358 | boost::icl::last_next(fill_interval) <= end && // dest_surface is within our fill range |
| 359 | dest_surface.FromInterval(fill_interval).GetInterval() == | 359 | dest_surface.FromInterval(fill_interval).GetInterval() == |
| 360 | fill_interval) { // make sure interval is a rectangle in dest surface | 360 | fill_interval) { // make sure interval is a rectangle in dest surface |
| 361 | if (fill_size * 8 != dest_surface.GetFormatBpp()) { | 361 | if (fill_size * CHAR_BIT != dest_surface.GetFormatBpp()) { |
| 362 | // Check if bits repeat for our fill_size | 362 | // Check if bits repeat for our fill_size |
| 363 | const u32 dest_bytes_per_pixel = std::max(dest_surface.GetFormatBpp() / 8, 1u); | 363 | const u32 dest_bytes_per_pixel = std::max(dest_surface.GetFormatBpp() / CHAR_BIT, 1u); |
| 364 | std::vector<u8> fill_test(fill_size * dest_bytes_per_pixel); | 364 | std::vector<u8> fill_test(fill_size * dest_bytes_per_pixel); |
| 365 | 365 | ||
| 366 | for (u32 i = 0; i < dest_bytes_per_pixel; ++i) | 366 | for (u32 i = 0; i < dest_bytes_per_pixel; ++i) |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index dfddcce90..55f1bdee8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -374,7 +374,7 @@ struct CachedSurface : SurfaceParams { | |||
| 374 | if (format == PixelFormat::Invalid) | 374 | if (format == PixelFormat::Invalid) |
| 375 | return 0; | 375 | return 0; |
| 376 | 376 | ||
| 377 | return SurfaceParams::GetFormatBpp(format) / 8; | 377 | return SurfaceParams::GetFormatBpp(format) / CHAR_BIT; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | std::unique_ptr<u8[]> gl_buffer; | 380 | std::unique_ptr<u8[]> gl_buffer; |