Skip to content

Commit

Permalink
framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuoya committed Jul 6, 2021
1 parent ee52a9c commit 6b02304
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ android {
externalNativeBuild {
cmake {
path "../../../CMakeLists.txt"
version "3.10.2"
version '3.18.1'
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/android/app/src/main/assets/3dstdb-zh_CN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,12 @@
000400000012CB00 = 铲子骑士
0004000000119A00 = 铲子骑士 无尽宝藏
0004000000181100 = 香缇和海盗的诅咒
00040000000B7C00 = 蒸汽世界
00040000001B2D00 = 蒸汽世界 2
00040000000ED400 = 蒸汽世界 挖掘
00040000000B7C00 = 蒸汽世界 挖掘
00040000001BBF00 = 蒸汽世界 挖掘2
00040000001B2D00 = 蒸汽世界 挖掘2
0004000000157C00 = 蒸汽世界 大劫掠
000400000012D900 = 蒸汽世界 大劫掠
000400000004A700 = 深渊传说
000400000012F500 = 世界传说 Reve Unitia
000400000016A900 = 泰拉瑞亚
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

import org.citra.emu.R;
import org.json.JSONArray;
Expand Down Expand Up @@ -129,6 +132,8 @@ protected void onCreate(Bundle savedInstanceState) {

private void openUrl(String url) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
getSystemService(ClipboardManager.class).setPrimaryClip(ClipData.newPlainText("URL", url));
Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show();
startActivity(browserIntent);
}
}
1 change: 1 addition & 0 deletions src/android/app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<string name="create_failed">创建失败!</string>
<string name="cia_install_success">安装成功!</string>
<string name="delete_success">删除成功!</string>
<string name="copy_success">复制成功!</string>
<string name="keyboard_please_input">请输入:</string>
<string name="input_text_max_length">输入长度限制:%1$d.</string>
<string name="text_amiibo_hint">Amiibo 目录是空的!</string>
Expand Down
1 change: 1 addition & 0 deletions src/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<string name="create_failed">Create Failed!</string>
<string name="cia_install_success">Install Success!</string>
<string name="delete_success">Delete Success!</string>
<string name="copy_success">Copy Success!</string>
<string name="keyboard_please_input">Please Input:</string>
<string name="input_text_max_length">Max input length: %1$d.</string>
<string name="text_amiibo_hint">The amiibo directory is empty!</string>
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/renderer_opengl/gl_rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void RasterizerOpenGL::OnFrameUpdate() {
const u32 current_frame = VideoCore::GetCurrentFrame();
if (current_frame >= last_clean_frame + CLEAN_FRAME_INTERVAL) {
res_cache.CleanUp(last_clean_frame);
shader_program_manager->CleanUp(last_clean_frame);
// shader_program_manager->CleanUp(last_clean_frame);
last_clean_frame = current_frame;
}
}
Expand Down
46 changes: 31 additions & 15 deletions src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,15 +926,15 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, ScaleMatc
if (match_res_scale != ScaleMatch::Exact) {
// This surface may have a subrect of another surface with a higher res_scale, find
// it to adjust our params
SurfaceParams find_params = params;
Surface expandable = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(
surface_cache, find_params, match_res_scale);
surface_cache, params, match_res_scale);
if (expandable != nullptr && expandable->res_scale > target_res_scale) {
target_res_scale = expandable->res_scale;
}

// Keep res_scale when reinterpreting d24s8 -> rgba8
if (params.pixel_format == PixelFormat::RGBA8) {
SurfaceParams find_params = params;
find_params.pixel_format = PixelFormat::D24S8;
expandable = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(
surface_cache, find_params, match_res_scale);
Expand Down Expand Up @@ -994,7 +994,7 @@ SurfaceRect_Tuple RasterizerCacheOpenGL::GetSurfaceSubRect(const SurfaceParams&

// Check for a surface we can expand before creating a new one
if (surface == nullptr) {
if (match_res_scale == ScaleMatch::Exact && aligned_params.height < 512) {
if (match_res_scale == ScaleMatch::Exact && aligned_params.height <= 512) {
SurfaceParams expand_params = aligned_params;
expand_params.addr -= expand_params.size;
surface = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(surface_cache, expand_params,
Expand Down Expand Up @@ -1351,22 +1351,38 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
} else {
std::tie(color_surface, color_rect) =
GetSurfaceSubRect(color_params, ScaleMatch::Exact, false);
// adjust depth surface
if (depth_surface && color_rect.bottom > 0) {
SurfaceParams new_params = depth_params;
new_params.height = color_rect.top / color_surface->res_scale;
new_params.UpdateParams();
remove_surfaces.emplace(depth_surface);
std::tie(depth_surface, depth_rect) =
GetSurfaceSubRect(new_params, ScaleMatch::Exact, false);
depth_rect.bottom += color_rect.bottom;
}
}
}

Common::Rectangle<u32> fb_rect{};
if (color_surface != nullptr && depth_surface != nullptr) {
fb_rect = color_rect;
// Color and Depth surfaces must have the same dimensions and offsets
if (color_rect != depth_rect) {
color_surface = GetSurface(color_params, ScaleMatch::Exact, false);
depth_surface = GetSurface(depth_params, ScaleMatch::Exact, false);
fb_rect = color_surface->GetScaledRect();
if (color_surface != nullptr) {
if (depth_surface != nullptr && color_rect != depth_rect) {
// Color and Depth surfaces must have the same dimensions and offsets
auto new_color_surface = GetSurface(color_params, ScaleMatch::Exact, false);
if (new_color_surface != color_surface) {
remove_surfaces.emplace(color_surface);
color_surface = new_color_surface;
}
color_rect = color_surface->GetScaledRect();
if (color_rect != depth_rect) {
auto new_depth_surface = GetSurface(depth_params, ScaleMatch::Exact, false);
if (new_depth_surface != depth_surface) {
remove_surfaces.emplace(depth_surface);
depth_surface = new_depth_surface;
}
}
}
} else if (color_surface != nullptr) {
fb_rect = color_rect;
} else if (depth_surface != nullptr) {
fb_rect = depth_rect;
color_rect = depth_rect;
}

if (color_surface != nullptr) {
Expand All @@ -1382,7 +1398,7 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
depth_surface->last_used_frame = VideoCore::GetCurrentFrame();
}

return std::make_tuple(color_surface, depth_surface, fb_rect);
return std::make_tuple(color_surface, depth_surface, color_rect);
}

Surface RasterizerCacheOpenGL::GetFillSurface(const GPU::Regs::MemoryFillConfig& config) {
Expand Down

0 comments on commit 6b02304

Please sign in to comment.