mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-10-20 20:31:02 -05:00
Fix issues with bad graphics with manual conversions
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
This commit is contained in:
@@ -115,7 +115,7 @@ endif()
|
||||
include(FetchContent)
|
||||
|
||||
set(SFML_REPO_AUTHOR "SFML")
|
||||
set(SFML_REPO_BRANCH "bugfix/macos_joystick_unplugging")
|
||||
set(SFML_REPO_BRANCH "master")
|
||||
# Git shallow clone isn't shallow in cmake... This is bad. :/
|
||||
# Replace this if they ever fix it.
|
||||
if(SFML_CLONE_USE_GIT_SHALLOW)
|
||||
|
||||
@@ -132,6 +132,7 @@ private:
|
||||
InputVideoDataType curr_video_data_type;
|
||||
InputVideoDataType last_update_texture_data_type;
|
||||
PossibleSoftwareConvTypes texture_software_based_conv;
|
||||
bool reported_software_conv = false;
|
||||
CaptureStatus* capture_status;
|
||||
std::string win_title;
|
||||
sf::RenderWindow m_win;
|
||||
@@ -270,7 +271,8 @@ private:
|
||||
ConsumerMutex display_lock;
|
||||
ConsumerMutex *draw_lock;
|
||||
bool done_display;
|
||||
VideoOutputData *saved_buf;
|
||||
VideoOutputData* saved_buf;
|
||||
VideoOutputData* conv_buf;
|
||||
ScreenInfo loaded_info;
|
||||
ScreenOperations future_operations;
|
||||
ScreenOperations loaded_operations;
|
||||
@@ -356,7 +358,7 @@ private:
|
||||
void window_factory(bool is_main_thread);
|
||||
void opengl_error_out(std::string error_base, std::string error_str);
|
||||
void opengl_error_check(std::string error_base);
|
||||
bool single_update_texture(unsigned int m_texture, InputVideoDataType video_data_type, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height, bool manually_converted);
|
||||
bool single_update_texture(unsigned int m_texture, InputVideoDataType video_data_type, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height, bool manually_converted, VideoOutputData* selected_buf);
|
||||
void execute_single_update_texture(bool &manually_converted, bool do_full, bool is_top = false, bool is_second = false);
|
||||
void update_texture();
|
||||
int _choose_base_input_shader(bool is_top);
|
||||
|
||||
@@ -332,6 +332,10 @@ void TextRectangle::setTextWithLineWrapping(int x_limit) {
|
||||
}
|
||||
|
||||
void TextRectangle::setRealSize(int width, int height, bool check_previous) {
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
this->loaded_data.width = width;
|
||||
this->loaded_data.height = height;
|
||||
this->pos_x_center_contrib = 0;
|
||||
|
||||
@@ -123,6 +123,7 @@ WindowScreen::WindowScreen(ScreenType stype, CaptureStatus* capture_status, Disp
|
||||
WindowScreen::reset_operations(future_operations);
|
||||
this->done_display = true;
|
||||
this->saved_buf = new VideoOutputData;
|
||||
this->conv_buf = new VideoOutputData;
|
||||
this->win_title = NAME;
|
||||
if(this->m_stype == ScreenType::TOP) {
|
||||
this->win_title += "_top";
|
||||
@@ -169,6 +170,7 @@ WindowScreen::~WindowScreen() {
|
||||
this->possible_files.clear();
|
||||
this->possible_resolutions.clear();
|
||||
delete this->saved_buf;
|
||||
delete this->conv_buf;
|
||||
delete this->notification;
|
||||
this->destroy_menus();
|
||||
delete this->text_rectangle_pool;
|
||||
@@ -377,6 +379,9 @@ void WindowScreen::update_connection() {
|
||||
}
|
||||
|
||||
void WindowScreen::print_notification(std::string text, TextKind kind) {
|
||||
if (text == "")
|
||||
return;
|
||||
|
||||
this->notification->setText(text);
|
||||
this->notification->setRectangleKind(kind);
|
||||
this->notification->startTimer(true);
|
||||
@@ -608,8 +613,8 @@ void WindowScreen::opengl_error_check(std::string error_base) {
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowScreen::single_update_texture(unsigned int m_texture, InputVideoDataType video_data_type, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height, bool manually_converted) {
|
||||
if(!(this->saved_buf && m_texture))
|
||||
bool WindowScreen::single_update_texture(unsigned int m_texture, InputVideoDataType video_data_type, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height, bool manually_converted, VideoOutputData* selected_buf) {
|
||||
if(!(selected_buf && m_texture))
|
||||
return false;
|
||||
|
||||
this->opengl_error_check("Previous OpenGL Error");
|
||||
@@ -638,13 +643,15 @@ bool WindowScreen::single_update_texture(unsigned int m_texture, InputVideoDataT
|
||||
}
|
||||
|
||||
this->opengl_error_check("BindTexture OpenGL Error");
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast<GLint>(this->curr_frame_texture_pos * MAX_IN_VIDEO_WIDTH), static_cast<GLint>(0), static_cast<GLsizei>(width), static_cast<GLsizei>(height), format, type, ((uint8_t*)this->saved_buf) + (pos_y_data * width * format_size));
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast<GLint>(this->curr_frame_texture_pos * MAX_IN_VIDEO_WIDTH), static_cast<GLint>(0), static_cast<GLsizei>(width), static_cast<GLsizei>(height), format, type, ((uint8_t*)selected_buf) + (pos_y_data * width * format_size));
|
||||
GLenum glCheckInternalError = glGetError();
|
||||
while (glCheckInternalError != GL_NO_ERROR) {
|
||||
bool processed = false;
|
||||
if(glCheckInternalError == GL_INVALID_ENUM) {
|
||||
if((format != GL_RGB) || (type != GL_UNSIGNED_BYTE)) {
|
||||
UpdateOutText(this->own_out_text_data, "Switching to software-based texture updating", "", TEXT_KIND_NORMAL);
|
||||
if(!this->reported_software_conv)
|
||||
UpdateOutText(this->own_out_text_data, "Switching to software-based texture updating", "", TEXT_KIND_NORMAL);
|
||||
this->reported_software_conv = true;
|
||||
this->last_update_texture_data_type = video_data_type;
|
||||
this->texture_software_based_conv = TO_RGB_SOFTWARE_CONV;
|
||||
return true;
|
||||
@@ -652,7 +659,9 @@ bool WindowScreen::single_update_texture(unsigned int m_texture, InputVideoDataT
|
||||
}
|
||||
if(glCheckInternalError == GL_INVALID_OPERATION) {
|
||||
if((format != GL_RGBA) || (type != GL_UNSIGNED_BYTE)) {
|
||||
UpdateOutText(this->own_out_text_data, "Switching to software-based texture updating", "", TEXT_KIND_NORMAL);
|
||||
if (!this->reported_software_conv)
|
||||
UpdateOutText(this->own_out_text_data, "Switching to software-based texture updating", "", TEXT_KIND_NORMAL);
|
||||
this->reported_software_conv = true;
|
||||
this->last_update_texture_data_type = video_data_type;
|
||||
this->texture_software_based_conv = TO_RGBA_SOFTWARE_CONV;
|
||||
return true;
|
||||
@@ -752,24 +761,25 @@ void WindowScreen::execute_single_update_texture(bool &manually_converted, bool
|
||||
|
||||
unsigned int m_texture = target_texture->getNativeHandle();
|
||||
bool retry = true;
|
||||
VideoOutputData* target_buffer = this->saved_buf;
|
||||
while(retry) {
|
||||
bool software_based_conv = manually_converted || ((this->texture_software_based_conv != NO_SOFTWARE_CONV) && (video_data_type == this->last_update_texture_data_type));
|
||||
|
||||
if(software_based_conv) {
|
||||
if(!manually_converted) {
|
||||
if(this->texture_software_based_conv == TO_RGB_SOFTWARE_CONV)
|
||||
manualConvertOutputToRGB(this->saved_buf, this->saved_buf, pos_x_conv, pos_y_conv, full_width, full_height, video_data_type);
|
||||
manualConvertOutputToRGB(this->saved_buf, this->conv_buf, pos_x_conv, pos_y_conv, full_width, full_height, video_data_type);
|
||||
if(this->texture_software_based_conv == TO_RGBA_SOFTWARE_CONV)
|
||||
manualConvertOutputToRGBA(this->saved_buf, this->saved_buf, pos_x_conv, pos_y_conv, full_width, full_height, video_data_type);
|
||||
manualConvertOutputToRGBA(this->saved_buf, this->conv_buf, pos_x_conv, pos_y_conv, full_width, full_height, video_data_type);
|
||||
}
|
||||
target_buffer = this->conv_buf;
|
||||
manually_converted = true;
|
||||
}
|
||||
else {
|
||||
this->texture_software_based_conv = NO_SOFTWARE_CONV;
|
||||
this->last_update_texture_data_type = video_data_type;
|
||||
}
|
||||
|
||||
retry = this->single_update_texture(m_texture, video_data_type, pos_x_data, pos_y_data, width, height, manually_converted);
|
||||
retry = this->single_update_texture(m_texture, video_data_type, pos_x_data, pos_y_data, width, height, manually_converted, target_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user