Merge remote-tracking branch 'upstream/master'

This commit is contained in:
olebeck 2025-07-02 12:25:01 +02:00
commit ad861254be
21 changed files with 62 additions and 9 deletions

View File

@ -4,7 +4,7 @@ project(isle LANGUAGES CXX C VERSION 0.1)
if (EMSCRIPTEN)
add_compile_options(-pthread)
add_link_options(-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=2gb -sUSE_PTHREADS=1 -sPROXY_TO_PTHREAD=1 -sPTHREAD_POOL_SIZE_STRICT=0 -sFORCE_FILESYSTEM=1 -sWASMFS=1 -sEXIT_RUNTIME=1)
add_link_options(-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=2gb -sUSE_PTHREADS=1 -sPROXY_TO_PTHREAD=1 -sOFFSCREENCANVAS_SUPPORT=1 -sPTHREAD_POOL_SIZE_STRICT=0 -sFORCE_FILESYSTEM=1 -sWASMFS=1 -sEXIT_RUNTIME=1)
set(SDL_PTHREADS ON CACHE BOOL "Enable SDL pthreads" FORCE)
endif()

View File

@ -562,8 +562,10 @@
<tabstop>sound3DCheckBox</tabstop>
<tabstop>musicCheckBox</tabstop>
<tabstop>joystickCheckBox</tabstop>
<tabstop>fullscreenCheckBox</tabstop>
<tabstop>devicesList</tabstop>
<tabstop>okButton</tabstop>
<tabstop>launchButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops>
<resources>

View File

@ -49,12 +49,14 @@ if(NOT VITA)
endif()
find_library(OPENGL_ES2_LIBRARY NAMES GLESv2)
if(OPENGL_ES2_LIBRARY)
if(EMSCRIPTEN OR OPENGL_ES2_LIBRARY)
message(STATUS "Found OpenGL: enabling OpenGL ES 2.x renderer")
target_sources(miniwin PRIVATE src/d3drm/backends/opengles2/renderer.cpp)
list(APPEND GRAPHICS_BACKENDS USE_OPENGLES2)
if(OPENGL_ES2_LIBRARY)
target_link_libraries(miniwin PRIVATE ${OPENGL_ES2_LIBRARY})
else()
endif()
else()
message(STATUS "🧩 OpenGL ES 2.x support not enabled")
endif()
endif()

View File

@ -600,6 +600,10 @@ void Citro3DRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, con
C3D_ImmDrawEnd();
}
void Citro3DRenderer::SetDither(bool dither)
{
}
void Citro3DRenderer::Download(SDL_Surface* target)
{
MINIWIN_NOT_IMPLEMENTED();

View File

@ -278,6 +278,10 @@ void DirectX9Renderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, co
Actual_Draw2DImage(m_textures[textureId].dxTexture, srcRect, dstRect);
}
void DirectX9Renderer::SetDither(bool dither)
{
}
void DirectX9Renderer::Download(SDL_Surface* target)
{
Actual_Download(target);

View File

@ -1487,6 +1487,10 @@ void GXMRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const S
sceGxmPopUserMarker(this->context);
}
void GXMRenderer::SetDither(bool dither)
{
}
void GXMRenderer::Download(SDL_Surface* target)
{
SDL_Rect srcRect = {

View File

@ -321,9 +321,6 @@ void GL11_Draw2DImage(
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLint boundTexture = 0;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
float u1 = srcRect.x / cache.width;
float v1 = srcRect.y / cache.height;
float u2 = (srcRect.x + srcRect.w) / cache.width;
@ -357,3 +354,13 @@ void GL11_Download(SDL_Surface* target)
glFinish();
glReadPixels(0, 0, target->w, target->h, GL_RGBA, GL_UNSIGNED_BYTE, target->pixels);
}
void GL11_SetDither(bool dither)
{
if (dither) {
glEnable(GL_DITHER);
}
else {
glDisable(GL_DITHER);
}
}

View File

@ -87,4 +87,5 @@ void GL11_Draw2DImage(
float bottom,
float top
);
void GL11_SetDither(bool dither);
void GL11_Download(SDL_Surface* target);

View File

@ -384,6 +384,11 @@ void OpenGL1Renderer::Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, con
GL11_Draw2DImage(m_textures[textureId], srcRect, dstRect, left, right, bottom, top);
}
void OpenGL1Renderer::SetDither(bool dither)
{
GL11_SetDither(dither);
}
void OpenGL1Renderer::Download(SDL_Surface* target)
{
GL11_Download(m_renderedImage);

View File

@ -706,3 +706,13 @@ void OpenGLES2Renderer::Download(SDL_Surface* target)
SDL_DestroySurface(bufferClone);
}
void OpenGLES2Renderer::SetDither(bool dither)
{
if (dither) {
glEnable(GL_DITHER);
}
else {
glDisable(GL_DITHER);
}
}

View File

@ -942,6 +942,10 @@ void Direct3DRMSDL3GPURenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& sr
SDL_SetGPUScissor(m_renderPass, &fullViewport);
}
void Direct3DRMSDL3GPURenderer::SetDither(bool dither)
{
}
void Direct3DRMSDL3GPURenderer::Download(SDL_Surface* target)
{
if (!m_cmdbuf) {

View File

@ -788,6 +788,10 @@ void Direct3DRMSoftwareRenderer::Draw2DImage(Uint32 textureId, const SDL_Rect& s
SDL_LockSurface(surface);
}
void Direct3DRMSoftwareRenderer::SetDither(bool dither)
{
}
void Direct3DRMSoftwareRenderer::Download(SDL_Surface* target)
{
SDL_Rect srcRect = {

View File

@ -84,9 +84,7 @@ D3DRMRENDERQUALITY Direct3DRMDevice2Impl::GetQuality()
HRESULT Direct3DRMDevice2Impl::SetDither(BOOL dither)
{
if (dither) {
MINIWIN_NOT_IMPLEMENTED();
}
m_renderer->SetDither(dither);
return DD_OK;
}

View File

@ -53,6 +53,7 @@ class Direct3DRMRenderer : public IDirect3DDevice2 {
virtual void Flip() = 0;
virtual void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) = 0;
virtual void Download(SDL_Surface* target) = 0;
virtual void SetDither(bool dither) = 0;
protected:
int m_width, m_height;

View File

@ -50,6 +50,7 @@ class Citro3DRenderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture);

View File

@ -36,6 +36,7 @@ class DirectX9Renderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture);

View File

@ -134,6 +134,7 @@ class GXMRenderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture);

View File

@ -36,6 +36,7 @@ class OpenGL1Renderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture);

View File

@ -57,6 +57,7 @@ class OpenGLES2Renderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture);

View File

@ -67,6 +67,7 @@ class Direct3DRMSDL3GPURenderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
Direct3DRMSDL3GPURenderer(

View File

@ -49,6 +49,7 @@ class Direct3DRMSoftwareRenderer : public Direct3DRMRenderer {
void Flip() override;
void Draw2DImage(Uint32 textureId, const SDL_Rect& srcRect, const SDL_Rect& dstRect) override;
void Download(SDL_Surface* target) override;
void SetDither(bool dither) override;
private:
void ClearZBuffer();