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