rasterizer_cache: Don't use float for viewport
This commit is contained in:
@@ -31,10 +31,10 @@ FramebufferBase::FramebufferBase(const Pica::Regs& regs, const SurfaceBase* colo
|
||||
surfaces_rect.bottom, surfaces_rect.top);
|
||||
|
||||
// Update viewport
|
||||
viewport.x = static_cast<f32>(surfaces_rect.left + viewport_rect.left * res_scale);
|
||||
viewport.y = static_cast<f32>(surfaces_rect.bottom + viewport_rect.bottom * res_scale);
|
||||
viewport.width = static_cast<f32>(viewport_rect.GetWidth() * res_scale);
|
||||
viewport.height = static_cast<f32>(viewport_rect.GetHeight() * res_scale);
|
||||
viewport.x = static_cast<s32>(surfaces_rect.left) + viewport_rect.left * res_scale;
|
||||
viewport.y = static_cast<s32>(surfaces_rect.bottom) + viewport_rect.bottom * res_scale;
|
||||
viewport.width = static_cast<s32>(viewport_rect.GetWidth() * res_scale);
|
||||
viewport.height = static_cast<s32>(viewport_rect.GetHeight() * res_scale);
|
||||
|
||||
// Scissor checks are window-, not viewport-relative, which means that if the cached texture
|
||||
// sub-rect changes, the scissor bounds also need to be updated.
|
||||
|
@@ -16,10 +16,10 @@ namespace VideoCore {
|
||||
class SurfaceBase;
|
||||
|
||||
struct ViewportInfo {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 width;
|
||||
f32 height;
|
||||
s32 x;
|
||||
s32 y;
|
||||
s32 width;
|
||||
s32 height;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -389,8 +389,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
||||
const Framebuffer framebuffer =
|
||||
res_cache.GetFramebufferSurfaces(using_color_fb, using_depth_fb);
|
||||
const bool has_color = framebuffer.HasAttachment(SurfaceType::Color);
|
||||
const bool has_depth_stencil = framebuffer.HasAttachment(SurfaceType::DepthStencil);
|
||||
if (!has_color && (shadow_rendering || !has_depth_stencil)) {
|
||||
if (!has_color && shadow_rendering) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -427,15 +427,19 @@ void Surface::UploadCustom(const VideoCore::Material* material, u32 level) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, Handle(0));
|
||||
const auto upload = [&](u32 index, VideoCore::CustomTexture* texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, Handle(index));
|
||||
if (VideoCore::IsCustomFormatCompressed(custom_format)) {
|
||||
const GLsizei image_size = static_cast<GLsizei>(color->data.size());
|
||||
const GLsizei image_size = static_cast<GLsizei>(texture->data.size());
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, tuple.format,
|
||||
image_size, color->data.data());
|
||||
image_size, texture->data.data());
|
||||
} else {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, tuple.format, tuple.type,
|
||||
color->data.data());
|
||||
texture->data.data());
|
||||
}
|
||||
};
|
||||
|
||||
upload(0, color);
|
||||
|
||||
const VideoCore::TextureBlit blit = {
|
||||
.src_rect = filter_rect,
|
||||
@@ -449,15 +453,7 @@ void Surface::UploadCustom(const VideoCore::Material* material, u32 level) {
|
||||
if (!texture) {
|
||||
continue;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, Handle(i + 1));
|
||||
if (VideoCore::IsCustomFormatCompressed(custom_format)) {
|
||||
const GLsizei image_size = static_cast<GLsizei>(texture->data.size());
|
||||
glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, tuple.format,
|
||||
image_size, texture->data.data());
|
||||
} else {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, width, height, tuple.format, tuple.type,
|
||||
texture->data.data());
|
||||
}
|
||||
upload(i + 1, texture);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
Reference in New Issue
Block a user