1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-30 08:24:05 +00:00

Merge pull request #4 from DaMarkov/no-window-mode

Fixes GLideN64 crashes
This commit is contained in:
Blake Warner 2022-02-27 11:08:33 -05:00 committed by GitHub
commit af0bea46f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 98 additions and 36 deletions

View File

@ -300,9 +300,12 @@ void CombinerInfo::setCombine(u64 _mux )
m_pCurrent = iter->second;
} else {
m_pCurrent = Combiner_Compile(key);
if (m_pCurrent)
{
m_pCurrent->update(true);
m_combiners[m_pCurrent->getKey()] = m_pCurrent;
}
}
m_bChanged = true;
}

View File

@ -54,6 +54,7 @@ void Context::destroy()
void Context::setClampMode(ClampMode _mode)
{
if (m_impl)
m_impl->setClampMode(_mode);
}
@ -64,6 +65,7 @@ ClampMode Context::getClampMode()
void Context::enable(EnableParam _parameter, bool _enable)
{
if (m_impl)
m_impl->enable(_parameter, _enable);
}
@ -79,116 +81,139 @@ void Context::cullFace(CullModeParam _parameter)
void Context::enableDepthWrite(bool _enable)
{
if (m_impl)
m_impl->enableDepthWrite(_enable);
}
void Context::setDepthCompare(CompareParam _mode)
{
if (m_impl)
m_impl->setDepthCompare(_mode);
}
void Context::setViewport(s32 _x, s32 _y, s32 _width, s32 _height)
{
if (m_impl)
m_impl->setViewport(_x, _y, _width, _height);
}
void Context::setScissor(s32 _x, s32 _y, s32 _width, s32 _height)
{
if (m_impl)
m_impl->setScissor(_x, _y, _width, _height);
}
void Context::setBlending(BlendParam _sfactor, BlendParam _dfactor)
{
if (m_impl)
m_impl->setBlending(_sfactor, _dfactor);
}
void graphics::Context::setBlendingSeparate(BlendParam _sfactorcolor, BlendParam _dfactorcolor, BlendParam _sfactoralpha, BlendParam _dfactoralpha)
{
if (m_impl)
m_impl->setBlendingSeparate(_sfactorcolor, _dfactorcolor, _sfactoralpha, _dfactoralpha);
}
void Context::setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha)
{
if (m_impl)
m_impl->setBlendColor(_red, _green, _blue, _alpha);
}
void Context::clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha)
{
if (m_impl)
m_impl->clearColorBuffer(_red, _green, _blue, _alpha);
}
void Context::clearDepthBuffer()
{
if (m_impl)
m_impl->clearDepthBuffer();
}
void Context::setPolygonOffset(f32 _factor, f32 _units)
{
if (m_impl)
m_impl->setPolygonOffset(_factor, _units);
}
ObjectHandle Context::createTexture(Parameter _target)
{
if (!m_impl) return ObjectHandle(0);
return m_impl->createTexture(_target);
}
void Context::deleteTexture(ObjectHandle _name)
{
if (m_impl)
m_impl->deleteTexture(_name);
}
void Context::init2DTexture(const InitTextureParams & _params)
{
if (m_impl)
m_impl->init2DTexture(_params);
}
void Context::update2DTexture(const UpdateTextureDataParams & _params)
{
if (m_impl)
m_impl->update2DTexture(_params);
}
void Context::setTextureParameters(const TexParameters & _parameters)
{
if (m_impl)
m_impl->setTextureParameters(_parameters);
}
void Context::bindTexture(const BindTextureParameters & _params)
{
if (m_impl)
m_impl->bindTexture(_params);
}
void Context::setTextureUnpackAlignment(s32 _param)
{
if (m_impl)
m_impl->setTextureUnpackAlignment(_param);
}
s32 Context::getTextureUnpackAlignment() const
{
if (!m_impl) return 0;
return m_impl->getTextureUnpackAlignment();
}
s32 Context::getMaxTextureSize() const
{
if (!m_impl) return 0;
return m_impl->getMaxTextureSize();
}
f32 Context::getMaxAnisotropy() const
{
if (!m_impl) return 0.0f;
return m_impl->getMaxAnisotropy();
}
void Context::bindImageTexture(const BindImageTextureParameters & _params)
{
if (m_impl)
m_impl->bindImageTexture(_params);
}
u32 Context::convertInternalTextureFormat(u32 _format) const
{
if (!m_impl) return 0;
return m_impl->convertInternalTextureFormat(_format);
}
void Context::textureBarrier()
{
if (m_impl)
m_impl->textureBarrier();
}
@ -201,16 +226,19 @@ const FramebufferTextureFormats & Context::getFramebufferTextureFormats()
ObjectHandle Context::createFramebuffer()
{
if (!m_impl) return ObjectHandle(0);
return m_impl->createFramebuffer();
}
void Context::deleteFramebuffer(ObjectHandle _name)
{
if (m_impl)
m_impl->deleteFramebuffer(_name);
}
void Context::bindFramebuffer(BufferTargetParam _target, ObjectHandle _name)
{
if (m_impl)
m_impl->bindFramebuffer(_target, _name);
}
@ -221,11 +249,13 @@ ObjectHandle Context::createRenderbuffer()
void Context::initRenderbuffer(const InitRenderbufferParams & _params)
{
if (m_impl)
m_impl->initRenderbuffer(_params);
}
void Context::addFrameBufferRenderTarget(const FrameBufferRenderTarget & _params)
{
if (m_impl)
m_impl->addFrameBufferRenderTarget(_params);
}
@ -236,6 +266,7 @@ bool Context::blitFramebuffers(const BlitFramebuffersParams & _params)
void Context::setDrawBuffers(u32 _num)
{
if (m_impl)
m_impl->setDrawBuffers(_num);
}
@ -253,92 +284,109 @@ ColorBufferReader * Context::createColorBufferReader(CachedTexture * _pTexture)
bool Context::isCombinerProgramBuilderObsolete()
{
if (!m_impl) return false;
return m_impl->isCombinerProgramBuilderObsolete();
}
void Context::resetCombinerProgramBuilder()
{
if (m_impl)
m_impl->resetCombinerProgramBuilder();
}
CombinerProgram * Context::createCombinerProgram(Combiner & _color, Combiner & _alpha, const CombinerKey & _key)
{
if (!m_impl) return nullptr;
return m_impl->createCombinerProgram(_color, _alpha, _key);
}
bool Context::saveShadersStorage(const Combiners & _combiners)
{
if (!m_impl) return false;
return m_impl->saveShadersStorage(_combiners);
}
bool Context::loadShadersStorage(Combiners & _combiners)
{
if (!m_impl) return false;
return m_impl->loadShadersStorage(_combiners);
}
ShaderProgram * Context::createDepthFogShader()
{
if (!m_impl) return nullptr;
return m_impl->createDepthFogShader();
}
TexrectDrawerShaderProgram * Context::createTexrectDrawerDrawShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectDrawerDrawShader();
}
ShaderProgram * Context::createTexrectDrawerClearShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectDrawerClearShader();
}
ShaderProgram * Context::createTexrectUpscaleCopyShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectUpscaleCopyShader();
}
ShaderProgram * Context::createTexrectColorAndDepthUpscaleCopyShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectColorAndDepthUpscaleCopyShader();
}
ShaderProgram * Context::createTexrectDownscaleCopyShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectDownscaleCopyShader();
}
ShaderProgram * Context::createTexrectColorAndDepthDownscaleCopyShader()
{
if (!m_impl) return nullptr;
return m_impl->createTexrectColorAndDepthDownscaleCopyShader();
}
ShaderProgram * Context::createGammaCorrectionShader()
{
if (!m_impl) return nullptr;
return m_impl->createGammaCorrectionShader();
}
ShaderProgram * Context::createFXAAShader()
{
if (!m_impl) return nullptr;
return m_impl->createFXAAShader();
}
TextDrawerShaderProgram * Context::createTextDrawerShader()
{
if (!m_impl) return nullptr;
return m_impl->createTextDrawerShader();
}
void Context::resetShaderProgram()
{
if (m_impl)
m_impl->resetShaderProgram();
}
void Context::drawTriangles(const DrawTriangleParameters & _params)
{
if (m_impl)
m_impl->drawTriangles(_params);
}
void Context::drawRects(const DrawRectParameters & _params)
{
if (m_impl)
m_impl->drawRects(_params);
}
@ -349,20 +397,24 @@ void Context::drawLine(f32 _width, SPVertex * _vertices)
f32 Context::getMaxLineWidth()
{
if (!m_impl) return 0.0f;
return m_impl->getMaxLineWidth();
}
s32 Context::getMaxMSAALevel()
{
if (!m_impl) return 0;
return m_impl->getMaxMSAALevel();
}
bool Context::isError() const
{
if (!m_impl) return false;
return m_impl->isError();
}
bool Context::isFramebufferError() const
{
if (!m_impl) return false;
return m_impl->isFramebufferError();
}

View File

@ -292,6 +292,8 @@ namespace graphics {
bool isFramebufferError() const;
operator bool () const { return m_impl.get(); }
static bool Multisampling;
static bool BlitFramebuffer;
static bool WeakBlitFramebuffer;

View File

@ -106,6 +106,8 @@ void NoiseTexture::_fillTextureData()
void NoiseTexture::init()
{
if (!gfxContext)
return;
if (m_texData[0].empty())
_fillTextureData();

View File

@ -36,6 +36,9 @@ TexrectDrawer::TexrectDrawer()
void TexrectDrawer::init()
{
if (!gfxContext)
return;
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
m_FBO = gfxContext.createFramebuffer();