mirror of
https://github.com/izzy2lost/Super3.git
synced 2026-07-05 15:18:38 -07:00
fix some graphic glitches
This commit is contained in:
@@ -377,7 +377,7 @@ void CNew3D::RenderFrame(void)
|
||||
#ifdef __ANDROID__
|
||||
if (!m_new3dAccurate) {
|
||||
// Android/GLES: basic mesh path (no multi-pass transparency compositing yet).
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
m_nfPairs[i].zNear = -std::numeric_limits<float>::max();
|
||||
m_nfPairs[i].zFar = std::numeric_limits<float>::max();
|
||||
}
|
||||
@@ -425,15 +425,17 @@ void CNew3D::RenderFrame(void)
|
||||
for (int pri = 0; pri <= 3; pri++) {
|
||||
if (SkipLayer(pri)) continue;
|
||||
|
||||
// Opaque pass.
|
||||
// Reset depth per priority so layer ordering matches the hardware behavior.
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Opaque pass (non-overlay).
|
||||
SetRenderStates();
|
||||
m_r3dShader.DiscardAlpha(true);
|
||||
glDisable(GL_BLEND);
|
||||
RenderScene(pri, false, Layer::colour);
|
||||
RenderScene(pri, true, Layer::colour);
|
||||
DisableRenderStates();
|
||||
|
||||
// Translucent pass (rough): draw both layers with blending.
|
||||
// Translucent pass (rough): non-overlay with blending.
|
||||
SetRenderStates();
|
||||
m_r3dShader.DiscardAlpha(false);
|
||||
glEnable(GL_BLEND);
|
||||
@@ -441,6 +443,25 @@ void CNew3D::RenderFrame(void)
|
||||
glDepthMask(GL_FALSE);
|
||||
RenderScene(pri, false, Layer::trans1);
|
||||
RenderScene(pri, false, Layer::trans2);
|
||||
glDepthMask(GL_TRUE);
|
||||
DisableRenderStates();
|
||||
|
||||
// Clear depth so high-priority polys are not occluded by lower-priority geometry.
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Opaque pass (overlay).
|
||||
SetRenderStates();
|
||||
m_r3dShader.DiscardAlpha(true);
|
||||
glDisable(GL_BLEND);
|
||||
RenderScene(pri, true, Layer::colour);
|
||||
DisableRenderStates();
|
||||
|
||||
// Translucent pass (overlay).
|
||||
SetRenderStates();
|
||||
m_r3dShader.DiscardAlpha(false);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask(GL_FALSE);
|
||||
RenderScene(pri, true, Layer::trans1);
|
||||
RenderScene(pri, true, Layer::trans2);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void AttachRegisters(const uint32_t *regPtr);
|
||||
bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes, unsigned totalXRes, unsigned totalYRes);
|
||||
|
||||
const uint32_t* GetFrameBufferRGBA() const { return m_frame.data(); }
|
||||
const uint32_t* GetFrameBufferARGB() const { return m_frame.data(); }
|
||||
const uint32_t* GetTopSurfaceARGB() const { return m_topSurface.data(); }
|
||||
unsigned GetFrameWidth() const { return m_xPixels; }
|
||||
unsigned GetFrameHeight() const { return m_yPixels; }
|
||||
|
||||
@@ -6,16 +6,16 @@ plugins {
|
||||
android {
|
||||
namespace = "com.izzy2lost.super3"
|
||||
compileSdk = 36
|
||||
buildToolsVersion = "36.1.0"
|
||||
ndkVersion = "29.0.14206865"
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.izzy2lost.super3"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
|
||||
versionCode = 10
|
||||
versionName = "1.0.9"
|
||||
|
||||
ndkVersion = "29.0.14206865"
|
||||
versionCode = 11
|
||||
versionName = "1.1.0"
|
||||
|
||||
ndk {
|
||||
abiFilters += listOf("arm64-v8a")
|
||||
@@ -54,11 +54,9 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
buildToolsVersion = "36.1.0"
|
||||
ndkVersion = "29.0.14206865"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -69,7 +67,3 @@ dependencies {
|
||||
implementation("androidx.recyclerview:recyclerview:1.4.0")
|
||||
implementation("com.google.android.material:material:1.14.0-alpha07")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
{
|
||||
if (m_presenter && m_render2d && m_render2d->HasFrame())
|
||||
{
|
||||
const uint32_t* pixels = m_render2d->GetFrameBufferRGBA();
|
||||
const uint32_t* pixels = m_render2d->GetFrameBufferARGB();
|
||||
m_presenter->UpdateFrameARGB(pixels, (int)m_render2d->GetFrameWidth(), (int)m_render2d->GetFrameHeight());
|
||||
m_presenter->Render(false);
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ extern "C" int SDL_main(int argc, char* argv[]) {
|
||||
presenter.SetStretch(wideBackground);
|
||||
host.RunFrame();
|
||||
if (host.render2d.HasFrame()) {
|
||||
const uint32_t* pixels = host.render2d.GetFrameBufferRGBA();
|
||||
const uint32_t* pixels = host.render2d.GetFrameBufferARGB();
|
||||
presenter.UpdateFrameARGB(pixels, (int)host.render2d.GetFrameWidth(), (int)host.render2d.GetFrameHeight());
|
||||
presenter.Render(false);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
#include "Util/NewConfig.h"
|
||||
|
||||
namespace {
|
||||
static inline uint8_t GetA(uint32_t argb) { return static_cast<uint8_t>(argb >> 24); }
|
||||
static inline uint8_t GetR(uint32_t argb) { return static_cast<uint8_t>(argb >> 16); }
|
||||
static inline uint8_t GetG(uint32_t argb) { return static_cast<uint8_t>(argb >> 8); }
|
||||
static inline uint8_t GetB(uint32_t argb) { return static_cast<uint8_t>(argb >> 0); }
|
||||
// Palette data from Model 3 hardware is in little-endian format (ABGR when viewed as 32-bit).
|
||||
// We extract and store in ARGB format (0xAARRGGBB) for the presenter.
|
||||
static inline uint8_t GetA(uint32_t abgr) { return static_cast<uint8_t>(abgr >> 24); }
|
||||
static inline uint8_t GetR(uint32_t abgr) { return static_cast<uint8_t>(abgr >> 0); }
|
||||
static inline uint8_t GetG(uint32_t abgr) { return static_cast<uint8_t>(abgr >> 8); }
|
||||
static inline uint8_t GetB(uint32_t abgr) { return static_cast<uint8_t>(abgr >> 16); }
|
||||
static inline uint32_t ARGB(uint8_t a, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
return (uint32_t(a) << 24) | (uint32_t(r) << 16) | (uint32_t(g) << 8) | uint32_t(b);
|
||||
|
||||
Reference in New Issue
Block a user