summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorGravatar liamwhite2024-02-27 09:40:33 -0500
committerGravatar GitHub2024-02-27 15:40:33 +0100
commitb2e129eaa5c97f216dcf02e2d853ca809ce392b7 (patch)
tree00008f3292759b20e529514b067bc798ae19b21d /src/video_core/renderer_opengl
parentbuffer_cache: avoid overflow in usage tracker (#13166) (diff)
downloadyuzu-b2e129eaa5c97f216dcf02e2d853ca809ce392b7.tar.gz
yuzu-b2e129eaa5c97f216dcf02e2d853ca809ce392b7.tar.xz
yuzu-b2e129eaa5c97f216dcf02e2d853ca809ce392b7.zip
vk_rasterizer: flip scissor y on lower left origin mode (#13122)
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 16af8e6bd..d376d86d8 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -370,27 +370,32 @@ void RasterizerOpenGL::DrawTexture() {
370 const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler); 370 const auto& sampler = texture_cache.GetGraphicsSampler(draw_texture_state.src_sampler);
371 const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture); 371 const auto& texture = texture_cache.GetImageView(draw_texture_state.src_texture);
372 372
373 const auto Scale = [&](auto dim) -> s32 {
374 return Settings::values.resolution_info.ScaleUp(static_cast<s32>(dim));
375 };
376
377 Region2D dst_region = {
378 Offset2D{.x = Scale(draw_texture_state.dst_x0), .y = Scale(draw_texture_state.dst_y0)},
379 Offset2D{.x = Scale(draw_texture_state.dst_x1), .y = Scale(draw_texture_state.dst_y1)}};
380 Region2D src_region = {
381 Offset2D{.x = Scale(draw_texture_state.src_x0), .y = Scale(draw_texture_state.src_y0)},
382 Offset2D{.x = Scale(draw_texture_state.src_x1), .y = Scale(draw_texture_state.src_y1)}};
383 Extent3D src_size = {static_cast<u32>(Scale(texture.size.width)),
384 static_cast<u32>(Scale(texture.size.height)), texture.size.depth};
385
373 if (device.HasDrawTexture()) { 386 if (device.HasDrawTexture()) {
374 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle()); 387 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle());
375 388
376 glDrawTextureNV(texture.DefaultHandle(), sampler->Handle(), draw_texture_state.dst_x0, 389 glDrawTextureNV(texture.DefaultHandle(), sampler->Handle(),
377 draw_texture_state.dst_y0, draw_texture_state.dst_x1, 390 static_cast<f32>(dst_region.start.x), static_cast<f32>(dst_region.start.y),
378 draw_texture_state.dst_y1, 0, 391 static_cast<f32>(dst_region.end.x), static_cast<f32>(dst_region.end.y), 0,
379 draw_texture_state.src_x0 / static_cast<float>(texture.size.width), 392 draw_texture_state.src_x0 / static_cast<float>(texture.size.width),
380 draw_texture_state.src_y0 / static_cast<float>(texture.size.height), 393 draw_texture_state.src_y0 / static_cast<float>(texture.size.height),
381 draw_texture_state.src_x1 / static_cast<float>(texture.size.width), 394 draw_texture_state.src_x1 / static_cast<float>(texture.size.width),
382 draw_texture_state.src_y1 / static_cast<float>(texture.size.height)); 395 draw_texture_state.src_y1 / static_cast<float>(texture.size.height));
383 } else { 396 } else {
384 Region2D dst_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x0),
385 .y = static_cast<s32>(draw_texture_state.dst_y0)},
386 Offset2D{.x = static_cast<s32>(draw_texture_state.dst_x1),
387 .y = static_cast<s32>(draw_texture_state.dst_y1)}};
388 Region2D src_region = {Offset2D{.x = static_cast<s32>(draw_texture_state.src_x0),
389 .y = static_cast<s32>(draw_texture_state.src_y0)},
390 Offset2D{.x = static_cast<s32>(draw_texture_state.src_x1),
391 .y = static_cast<s32>(draw_texture_state.src_y1)}};
392 blit_image.BlitColor(texture_cache.GetFramebuffer()->Handle(), texture.DefaultHandle(), 397 blit_image.BlitColor(texture_cache.GetFramebuffer()->Handle(), texture.DefaultHandle(),
393 sampler->Handle(), dst_region, src_region, texture.size); 398 sampler->Handle(), dst_region, src_region, src_size);
394 state_tracker.InvalidateState(); 399 state_tracker.InvalidateState();
395 } 400 }
396 401