mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-25 05:49:34 +00:00
Remove use of OpenGL.h
This commit is contained in:
parent
8460b08b09
commit
80ed169e24
|
@ -476,6 +476,7 @@
|
|||
<ClInclude Include="..\..\src\OpenGL.h" />
|
||||
<ClInclude Include="..\..\src\PaletteTexture.h" />
|
||||
<ClInclude Include="..\..\src\Performance.h" />
|
||||
<ClInclude Include="..\..\src\Platform.h" />
|
||||
<ClInclude Include="..\..\src\PluginAPI.h" />
|
||||
<ClInclude Include="..\..\src\PostProcessor.h" />
|
||||
<ClInclude Include="..\..\src\RDP.h" />
|
||||
|
|
|
@ -643,5 +643,8 @@
|
|||
<ClInclude Include="..\..\src\BufferCopy\PBOBinder.h">
|
||||
<Filter>Header Files\BufferCopy</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Platform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -251,7 +251,7 @@ void RDRAMtoColorBuffer::copyFromRDRAM(u32 _address, bool _bCFB)
|
|||
|
||||
const u32 cycleType = gDP.otherMode.cycleType;
|
||||
gDP.otherMode.cycleType = G_CYC_COPY;
|
||||
CombinerInfo::get().setPolygonMode(OGLRender::rsTexRect);
|
||||
CombinerInfo::get().setPolygonMode(DrawingState::TexRect);
|
||||
CombinerInfo::get().update();
|
||||
gDP.otherMode.cycleType = cycleType;
|
||||
glEnable(GL_BLEND);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <stdio.h>
|
||||
#include <osal_files.h>
|
||||
|
||||
#include "OpenGL.h"
|
||||
#include "Combiner.h"
|
||||
#include "Debug.h"
|
||||
#include "gDP.h"
|
||||
|
@ -12,6 +11,8 @@
|
|||
#include "RSP.h"
|
||||
#include "Graphics/Context.h"
|
||||
|
||||
using namespace graphics;
|
||||
|
||||
static int saRGBExpanded[] =
|
||||
{
|
||||
G_GCI_COMBINED, G_GCI_TEXEL0, G_GCI_TEXEL1, G_GCI_PRIMITIVE,
|
||||
|
@ -91,13 +92,7 @@ CombinerInfo & CombinerInfo::get()
|
|||
void CombinerInfo::init()
|
||||
{
|
||||
m_pCurrent = nullptr;
|
||||
GLint numBinaryFormats = 0;
|
||||
#ifdef GL_NUM_PROGRAM_BINARY_FORMATS
|
||||
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &numBinaryFormats);
|
||||
#endif
|
||||
m_bShaderCacheSupported = config.generalEmulation.enableShadersStorage != 0 &&
|
||||
OGLVideo::isExtensionSupported(GET_PROGRAM_BINARY_EXTENSION) &&
|
||||
numBinaryFormats > 0;
|
||||
m_bShaderCacheSupported = config.generalEmulation.enableShadersStorage != 0 && gfxContext.isSupported(SpecialFeatures::ShaderProgramBinary);
|
||||
|
||||
m_shadersLoaded = 0;
|
||||
if (m_bShaderCacheSupported && !_loadShadersStorage()) {
|
||||
|
@ -107,7 +102,7 @@ void CombinerInfo::init()
|
|||
}
|
||||
|
||||
if (m_combiners.empty()) {
|
||||
setPolygonMode(OGLRender::rsTexRect);
|
||||
setPolygonMode(DrawingState::TexRect);
|
||||
gDP.otherMode.cycleType = G_CYC_COPY;
|
||||
setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0));
|
||||
gDP.otherMode.cycleType = G_CYC_FILL;
|
||||
|
@ -195,7 +190,7 @@ void SimplifyCycle( CombineCycle *cc, CombinerStage *stage )
|
|||
}
|
||||
|
||||
//ShaderCombiner * CombinerInfo::_compile(u64 mux) const
|
||||
graphics::CombinerProgram * CombinerInfo::_compile(u64 mux) const
|
||||
CombinerProgram * CombinerInfo::_compile(u64 mux) const
|
||||
{
|
||||
gDPCombine combine;
|
||||
|
||||
|
@ -305,24 +300,11 @@ void CombinerInfo::setMonochromeCombiner()
|
|||
}
|
||||
}
|
||||
|
||||
graphics::ShaderProgram * CombinerInfo::getTexrectCopyProgram()
|
||||
ShaderProgram * CombinerInfo::getTexrectCopyProgram()
|
||||
{
|
||||
return m_texrectCopyProgram.get();
|
||||
}
|
||||
|
||||
void CombinerInfo::setPolygonMode(OGLRender::RENDER_STATE _renderState)
|
||||
{
|
||||
switch (_renderState) {
|
||||
case OGLRender::rsRect:
|
||||
case OGLRender::rsTexRect:
|
||||
m_rectMode = true;
|
||||
break;
|
||||
default:
|
||||
m_rectMode = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CombinerInfo::setPolygonMode(DrawingState _drawingState)
|
||||
{
|
||||
switch (_drawingState) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <memory>
|
||||
|
||||
#include "GLideN64.h"
|
||||
#include "OpenGL.h"
|
||||
#include "GraphicsDrawer.h"
|
||||
#include "gDP.h"
|
||||
#include "CombinerKey.h"
|
||||
|
@ -137,7 +136,6 @@ public:
|
|||
|
||||
static CombinerInfo & get();
|
||||
|
||||
void setPolygonMode(OGLRender::RENDER_STATE _renderState);
|
||||
void setPolygonMode(DrawingState _drawingState);
|
||||
bool isRectMode() const { return m_rectMode; }
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <malloc.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include "OpenGL.h"
|
||||
#include "Combiner.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
|
@ -15,10 +14,6 @@
|
|||
#include <Graphics/Parameters.h>
|
||||
#include "DisplayWindow.h"
|
||||
|
||||
const GLuint ZlutImageUnit = 0;
|
||||
const GLuint TlutImageUnit = 1;
|
||||
const GLuint depthImageUnit = 2;
|
||||
|
||||
using namespace graphics;
|
||||
|
||||
DepthBuffer::DepthBuffer() : m_address(0), m_width(0), m_ulx(0), m_uly(0), m_lrx(0), m_lry(0),
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//****************************************************************
|
||||
|
||||
#include "N64.h"
|
||||
#include "OpenGL.h"
|
||||
#include "gDP.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
#include "DepthBufferRender.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "gSP.h"
|
||||
#include "gDP.h"
|
||||
#include "GBI.h"
|
||||
#include "OpenGL.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "gSP.h"
|
||||
#include "gDP.h"
|
||||
#include "GBI.h"
|
||||
#include "OpenGL.h"
|
||||
|
||||
void F3DEX2CBFD_Vtx( u32 w0, u32 w1 )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "OpenGL.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
#include "N64.h"
|
||||
|
@ -124,7 +123,7 @@ void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTextu
|
|||
bufTarget.textureHandle = _pTexture->name;
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
}
|
||||
assert(checkFBO());
|
||||
assert(!gfxContext.isFramebufferError());
|
||||
}
|
||||
|
||||
bool FrameBuffer::_isMarioTennisScoreboard() const
|
||||
|
@ -175,7 +174,7 @@ void FrameBuffer::init(u32 _address, u32 _endAddress, u16 _format, u16 _size, u1
|
|||
_initTexture(_width, _height, _format, _size, m_pResolveTexture);
|
||||
m_resolveFBO = gfxContext.createFramebuffer();
|
||||
_setAndAttachTexture(m_resolveFBO, m_pResolveTexture, 0, false);
|
||||
assert(checkFBO());
|
||||
assert(!gfxContext.isFramebufferError());
|
||||
|
||||
gfxContext.bindFramebuffer(bufferTarget::FRAMEBUFFER, m_FBO);
|
||||
} else
|
||||
|
@ -792,7 +791,7 @@ void FrameBufferList::attachDepthBuffer()
|
|||
} else
|
||||
m_pCurrent->m_pDepthBuffer = nullptr;
|
||||
|
||||
assert(checkFBO());
|
||||
assert(!gfxContext.isFramebufferError());
|
||||
}
|
||||
|
||||
void FrameBufferList::clearDepthBuffer(DepthBuffer * _pDepthBuffer)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "FrameBufferInfoAPI.h"
|
||||
#include "FrameBufferInfo.h"
|
||||
#include "Config.h"
|
||||
#include "OpenGL.h"
|
||||
#include "gSP.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
#include "RSP.h"
|
||||
|
|
19
src/GBI.cpp
19
src/GBI.cpp
|
@ -28,8 +28,9 @@
|
|||
#include "ZSort.h"
|
||||
#include "CRC.h"
|
||||
#include "Log.h"
|
||||
#include "OpenGL.h"
|
||||
#include "Debug.h"
|
||||
#include "Graphics/Context.h"
|
||||
#include "Graphics/Parameters.h"
|
||||
|
||||
u32 last_good_ucode = (u32) -1;
|
||||
|
||||
|
@ -192,25 +193,25 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
|||
#ifndef GLESX
|
||||
if (m_pCurrent->NoN) {
|
||||
// Disable near and far plane clipping
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
gfxContext.enable(graphics::enable::DEPTH_CLAMP, true);
|
||||
// Enable Far clipping plane in vertex shader
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
gfxContext.enable(graphics::enable::CLIP_DISTANCE0, true);
|
||||
} else {
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
glDisable(GL_CLIP_DISTANCE0);
|
||||
gfxContext.enable(graphics::enable::DEPTH_CLAMP, false);
|
||||
gfxContext.enable(graphics::enable::CLIP_DISTANCE0, false);
|
||||
}
|
||||
#endif
|
||||
} else if (m_pCurrent->NoN != _pCurrent->NoN) {
|
||||
#ifndef GLESX
|
||||
if (_pCurrent->NoN) {
|
||||
// Disable near and far plane clipping
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
gfxContext.enable(graphics::enable::DEPTH_CLAMP, true);
|
||||
// Enable Far clipping plane in vertex shader
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
gfxContext.enable(graphics::enable::CLIP_DISTANCE0, true);
|
||||
}
|
||||
else {
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
glDisable(GL_CLIP_DISTANCE0);
|
||||
gfxContext.enable(graphics::enable::DEPTH_CLAMP, false);
|
||||
gfxContext.enable(graphics::enable::CLIP_DISTANCE0, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -125,6 +125,11 @@ s32 Context::getTextureUnpackAlignment() const
|
|||
return m_impl->getTextureUnpackAlignment();
|
||||
}
|
||||
|
||||
s32 Context::getMaxTextureSize() const
|
||||
{
|
||||
return m_impl->getMaxTextureSize();
|
||||
}
|
||||
|
||||
void Context::bindImageTexture(const BindImageTextureParameters & _params)
|
||||
{
|
||||
m_impl->bindImageTexture(_params);
|
||||
|
@ -264,12 +269,17 @@ f32 Context::getMaxLineWidth()
|
|||
return m_impl->getMaxLineWidth();
|
||||
}
|
||||
|
||||
bool Context::isSupported(SpecialFeatures _feature) const
|
||||
{
|
||||
return m_impl->isSupported(_feature);
|
||||
}
|
||||
|
||||
bool Context::isError() const
|
||||
{
|
||||
return m_impl->isError();
|
||||
}
|
||||
|
||||
bool Context::isSupported(SpecialFeatures _feature) const
|
||||
bool Context::isFramebufferError() const
|
||||
{
|
||||
return m_impl->isSupported(_feature);
|
||||
return m_impl->isFramebufferError();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace graphics {
|
|||
BlitFramebuffer,
|
||||
WeakBlitFramebuffer,
|
||||
DepthFramebufferTextures,
|
||||
ShaderProgramBinary,
|
||||
ImageTextures
|
||||
};
|
||||
|
||||
|
@ -122,6 +123,8 @@ namespace graphics {
|
|||
|
||||
s32 getTextureUnpackAlignment() const;
|
||||
|
||||
s32 getMaxTextureSize() const;
|
||||
|
||||
struct BindImageTextureParameters {
|
||||
Parameter imageUnit;
|
||||
ObjectHandle texture;
|
||||
|
@ -248,6 +251,8 @@ namespace graphics {
|
|||
|
||||
bool isError() const;
|
||||
|
||||
bool isFramebufferError() const;
|
||||
|
||||
static bool imageTextures;
|
||||
static bool multisampling;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace graphics {
|
|||
virtual void bindTexture(const Context::BindTextureParameters & _params) = 0;
|
||||
virtual void setTextureUnpackAlignment(s32 _param) = 0;
|
||||
virtual s32 getTextureUnpackAlignment() const = 0;
|
||||
virtual s32 getMaxTextureSize() const = 0;
|
||||
virtual void bindImageTexture(const Context::BindImageTextureParameters & _params) = 0;
|
||||
virtual FramebufferTextureFormats * getFramebufferTextureFormats() = 0;
|
||||
virtual ObjectHandle createFramebuffer() = 0;
|
||||
|
@ -58,8 +59,9 @@ namespace graphics {
|
|||
virtual f32 getMaxLineWidth() = 0;
|
||||
virtual void drawText(const char *_pText, float _x, float _y) = 0;
|
||||
virtual void getTextSize(const char *_pText, float & _w, float & _h) = 0;
|
||||
virtual bool isError() const = 0;
|
||||
virtual bool isSupported(SpecialFeatures _feature) const = 0;
|
||||
virtual bool isError() const = 0;
|
||||
virtual bool isFramebufferError() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <assert.h>
|
||||
#include <Combiner.h>
|
||||
#include <Graphics/OpenGLContext/opengl_CachedFunctions.h>
|
||||
#include <Graphics/OpenGLContext/opengl_Utils.h>
|
||||
#include "glsl_Utils.h"
|
||||
#include "glsl_CombinerProgramImpl.h"
|
||||
|
||||
|
@ -87,7 +88,7 @@ bool CombinerProgramImpl::getBinaryForm(std::vector<char> & _buffer)
|
|||
|
||||
GLenum binaryFormat;
|
||||
glGetProgramBinary(GLuint(m_program), binaryLength, &binaryLength, &binaryFormat, binary.data());
|
||||
if (isGLError())
|
||||
if (opengl::Utils::isGLError())
|
||||
return false;
|
||||
|
||||
u64 key = m_key.getMux();
|
||||
|
|
|
@ -195,6 +195,13 @@ s32 ContextImpl::getTextureUnpackAlignment() const
|
|||
return unpackAlignment;
|
||||
}
|
||||
|
||||
s32 ContextImpl::getMaxTextureSize() const
|
||||
{
|
||||
GLint maxTextureSize;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
return maxTextureSize;
|
||||
}
|
||||
|
||||
void ContextImpl::bindImageTexture(const graphics::Context::BindImageTextureParameters & _params)
|
||||
{
|
||||
if (glBindImageTexture != nullptr)
|
||||
|
@ -341,12 +348,6 @@ void ContextImpl::getTextSize(const char *_pText, float & _w, float & _h)
|
|||
{
|
||||
m_textDrawer->getTextSize(_pText, _w, _h);
|
||||
}
|
||||
|
||||
bool ContextImpl::isError() const
|
||||
{
|
||||
return Utils::isGLError();
|
||||
}
|
||||
|
||||
bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const
|
||||
{
|
||||
switch (_feature) {
|
||||
|
@ -361,6 +362,18 @@ bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const
|
|||
return m_glInfo.msaa;
|
||||
case graphics::SpecialFeatures::ImageTextures:
|
||||
return m_glInfo.imageTextures;
|
||||
case graphics::SpecialFeatures::ShaderProgramBinary:
|
||||
{
|
||||
GLint numBinaryFormats = 0;
|
||||
#ifdef GL_NUM_PROGRAM_BINARY_FORMATS
|
||||
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &numBinaryFormats);
|
||||
#endif
|
||||
|
||||
if (m_glInfo.isGLESX)
|
||||
return numBinaryFormats != 0 && Utils::isExtensionSupported("GL_OES_get_program_binary");
|
||||
|
||||
return numBinaryFormats != 0 && Utils::isExtensionSupported("GL_ARB_get_program_binary");
|
||||
}
|
||||
case graphics::SpecialFeatures::DepthFramebufferTextures:
|
||||
#ifndef USE_DEPTH_RENDERBUFFER
|
||||
return true;
|
||||
|
@ -370,3 +383,13 @@ bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ContextImpl::isError() const
|
||||
{
|
||||
return Utils::isGLError();
|
||||
}
|
||||
|
||||
bool ContextImpl::isFramebufferError() const
|
||||
{
|
||||
return Utils::isFramebufferError();
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ namespace opengl {
|
|||
|
||||
s32 getTextureUnpackAlignment() const override;
|
||||
|
||||
s32 getMaxTextureSize() const override;
|
||||
|
||||
void bindImageTexture(const graphics::Context::BindImageTextureParameters & _params) override;
|
||||
|
||||
/*---------------Framebuffer-------------*/
|
||||
|
@ -123,9 +125,11 @@ namespace opengl {
|
|||
|
||||
void getTextSize(const char *_pText, float & _w, float & _h) override;
|
||||
|
||||
bool isSupported(graphics::SpecialFeatures _feature) const override;
|
||||
|
||||
bool isError() const override;
|
||||
|
||||
bool isSupported(graphics::SpecialFeatures _feature) const override;
|
||||
bool isFramebufferError() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CachedFunctions> m_cachedFunctions;
|
||||
|
|
|
@ -97,3 +97,38 @@ bool Utils::isGLError()
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Utils::isFramebufferError()
|
||||
{
|
||||
GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
switch (e) {
|
||||
// case GL_FRAMEBUFFER_UNDEFINED:
|
||||
// printf("FBO Undefined\n");
|
||||
// break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
LOG(LOG_ERROR, "[GlideN64]: FBO Incomplete Attachment\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
LOG(LOG_ERROR, "[GlideN64]: FBO Missing Attachment\n");
|
||||
break;
|
||||
// case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER :
|
||||
// printf("FBO Incomplete Draw Buffer\n");
|
||||
// break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
LOG(LOG_ERROR, "[GlideN64]: FBO Unsupported\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_COMPLETE:
|
||||
LOG(LOG_VERBOSE, "[GlideN64]: FBO OK\n");
|
||||
break;
|
||||
// case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||
// printf("framebuffer FRAMEBUFFER_DIMENSIONS\n");
|
||||
// break;
|
||||
// case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
||||
// printf("framebuffer INCOMPLETE_FORMATS\n");
|
||||
// break;
|
||||
default:
|
||||
LOG(LOG_ERROR, "[GlideN64]: FBO Problem?\n");
|
||||
}
|
||||
|
||||
return e != GL_FRAMEBUFFER_COMPLETE;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace opengl {
|
|||
{
|
||||
static bool isExtensionSupported(const char * extension);
|
||||
static bool isGLError();
|
||||
static bool isFramebufferError();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include "Platform.h"
|
||||
#include "Graphics/Context.h"
|
||||
#include "Graphics/Parameters.h"
|
||||
#include "DisplayWindow.h"
|
||||
|
@ -803,7 +804,7 @@ void GraphicsDrawer::drawLine(int _v0, int _v1, float _width)
|
|||
if (!_canDraw())
|
||||
return;
|
||||
|
||||
GLfloat lineWidth = _width;
|
||||
f32 lineWidth = _width;
|
||||
if (config.frameBufferEmulation.nativeResFactor == 0)
|
||||
lineWidth *= dwnd().getScaleX();
|
||||
else
|
||||
|
@ -1063,7 +1064,7 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
|||
else {
|
||||
if (_params.texrectCmd && (gSP.changed | gDP.changed) != 0)
|
||||
_updateStates(DrawingState::TexRect);
|
||||
glDisable(GL_CULL_FACE);
|
||||
gfxContext.enable(enable::CULL_FACE, false);
|
||||
|
||||
if (CombinerInfo::get().isChanged()) {
|
||||
if (currentCombiner()->usesShade()) {
|
||||
|
@ -1328,15 +1329,17 @@ void GraphicsDrawer::drawOSD()
|
|||
if ((config.onScreenDisplay.fps | config.onScreenDisplay.vis | config.onScreenDisplay.percent) == 0)
|
||||
return;
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
|
||||
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
const GLint X = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const GLint Y = wnd.getHeightOffset();
|
||||
const GLint W = wnd.getWidth();
|
||||
const GLint H = wnd.getHeight();
|
||||
glViewport(X, Y, W, H);
|
||||
glScissor(X, Y, W, H);
|
||||
const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const s32 Y = wnd.getHeightOffset();
|
||||
const s32 W = wnd.getWidth();
|
||||
const s32 H = wnd.getHeight();
|
||||
|
||||
gfxContext.setViewport(X, Y, W, H);
|
||||
gfxContext.setScissor(X, Y, W, H);
|
||||
|
||||
gSP.changed |= CHANGED_VIEWPORT;
|
||||
gDP.changed |= CHANGED_SCISSOR;
|
||||
|
||||
|
@ -1523,7 +1526,7 @@ void GraphicsDrawer::_initStates()
|
|||
}
|
||||
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
glViewport(0, wnd.getHeightOffset(), wnd.getScreenWidth(), wnd.getScreenHeight());
|
||||
gfxContext.setViewport(0, wnd.getHeightOffset(), wnd.getScreenWidth(), wnd.getScreenHeight());
|
||||
|
||||
gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
//
|
||||
//****************************************************************
|
||||
|
||||
#include "OpenGL.h"
|
||||
#include "Platform.h"
|
||||
#include "Keys.h"
|
||||
|
||||
Glide64Keys::Glide64Keys()
|
||||
|
|
|
@ -78,7 +78,7 @@ void NoiseTexture::update()
|
|||
return;
|
||||
|
||||
PixelBufferBinder<PixelWriteBuffer> binder(m_pbuf.get());
|
||||
GLubyte* ptr = (GLubyte*)m_pbuf->getWriteBuffer(dataSize);
|
||||
u8* ptr = (u8*)m_pbuf->getWriteBuffer(dataSize);
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1163,7 +1163,7 @@ void OGLRender::_updateStates(RENDER_STATE _renderState) const
|
|||
OGLVideo & ogl = video();
|
||||
|
||||
CombinerInfo & cmbInfo = CombinerInfo::get();
|
||||
cmbInfo.setPolygonMode(_renderState);
|
||||
// cmbInfo.setPolygonMode(_renderState);
|
||||
cmbInfo.update();
|
||||
|
||||
if (gSP.changed & CHANGED_GEOMETRYMODE) {
|
||||
|
@ -1724,7 +1724,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
|
|||
gSP.changed &= ~CHANGED_GEOMETRYMODE; // Don't update cull mode
|
||||
if (!m_texrectDrawer.isEmpty()) {
|
||||
CombinerInfo & cmbInfo = CombinerInfo::get();
|
||||
cmbInfo.setPolygonMode(rsTexRect);
|
||||
// cmbInfo.setPolygonMode(rsTexRect);
|
||||
cmbInfo.update();
|
||||
// currentCombiner()->updateRenderState();
|
||||
_updateTextures(rsTexRect);
|
||||
|
|
|
@ -330,6 +330,4 @@ void initGLFunctions();
|
|||
bool checkFBO();
|
||||
bool isGLError();
|
||||
|
||||
void displayLoadProgress(const wchar_t *format, ...);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,7 +62,6 @@ void PaletteTexture::init()
|
|||
|
||||
// Generate Pixel Buffer Object. Initialize it with max buffer size.
|
||||
m_pbuf.reset(gfxContext.createPixelWriteBuffer(m_pTexture->textureBytes));
|
||||
isGLError();
|
||||
}
|
||||
|
||||
void PaletteTexture::destroy()
|
||||
|
@ -90,7 +89,7 @@ void PaletteTexture::update()
|
|||
m_paletteCRC256 = gDP.paletteCRC256;
|
||||
|
||||
PixelBufferBinder<PixelWriteBuffer> binder(m_pbuf.get());
|
||||
GLubyte* ptr = (GLubyte*)m_pbuf->getWriteBuffer(m_pTexture->textureBytes);
|
||||
u8* ptr = (u8*)m_pbuf->getWriteBuffer(m_pTexture->textureBytes);
|
||||
#ifdef GLESX
|
||||
u32 * palette = (u32*)ptr;
|
||||
#else
|
||||
|
|
22
src/Platform.h
Normal file
22
src/Platform.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#ifdef OS_WINDOWS
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "winlnxdefs.h"
|
||||
#endif
|
||||
|
||||
#ifdef __LIBRETRO__
|
||||
#include <glsm/glsmsym.h>
|
||||
#include <GLideN64_libretro.h>
|
||||
#endif
|
||||
|
||||
#ifdef PANDORA
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
|
||||
#endif // PLATFORM_H
|
|
@ -4,7 +4,6 @@
|
|||
#include "gSP.h"
|
||||
#include "PostProcessor.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "ShaderUtils.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include <Graphics/Context.h>
|
||||
|
@ -289,7 +288,7 @@ void _initFBO(ObjectHandle _FBO, CachedTexture * _pTexture)
|
|||
bufTarget.textureTarget = target::TEXTURE_2D;
|
||||
bufTarget.textureHandle = _pTexture->name;
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
assert(checkFBO());
|
||||
assert(!gfxContext.isFramebufferError());
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <memory>
|
||||
#include "Types.h"
|
||||
#include "OpenGL.h"
|
||||
#include "Textures.h"
|
||||
#include "Graphics/ObjectHandle.h"
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "GBI.h"
|
||||
#include "gDP.h"
|
||||
#include "gSP.h"
|
||||
#include "OpenGL.h"
|
||||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
#include "DisplayWindow.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <assert.h>
|
||||
#include "OpenGL.h"
|
||||
#include "S2DEX.h"
|
||||
#include "F3D.h"
|
||||
#include "F3DEX.h"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef S2DEX_H
|
||||
#define S2DEX_H
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
#define G_BGLT_LOADBLOCK 0x0033
|
||||
#define G_BGLT_LOADTILE 0xfff4
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "OpenGL.h"
|
||||
#include "S2DEX.h"
|
||||
#include "S2DEX2.h"
|
||||
#include "F3D.h"
|
||||
|
|
|
@ -162,7 +162,7 @@ int clipW(const SPVertex ** _vsrc, SPVertex * _vdst)
|
|||
return dsti;
|
||||
}
|
||||
|
||||
void renderTriangles(const SPVertex * _pVertices, const GLubyte * _pElements, u32 _numElements)
|
||||
void renderTriangles(const SPVertex * _pVertices, const u8 * _pElements, u32 _numElements)
|
||||
{
|
||||
//Current depth buffer can be null if we are loading from a save state
|
||||
if(depthBufferList().getCurrent() == nullptr)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef SOFTWARE_RENDER_H
|
||||
#define SOFTWARE_RENDER_H
|
||||
|
||||
#include "OpenGL.h"
|
||||
#include "gSP.h"
|
||||
|
||||
void renderTriangles(const SPVertex * _pVertices, const GLubyte * _pElements, u32 _numElements);
|
||||
void renderTriangles(const SPVertex * _pVertices, const u8 * _pElements, u32 _numElements);
|
||||
|
||||
#endif // SOFTWARE_RENDER_H
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <Graphics/Parameters.h>
|
||||
|
||||
#include "RSP.h"
|
||||
#include "OpenGL.h"
|
||||
#include "Config.h"
|
||||
#include "PluginAPI.h"
|
||||
#include "FrameBuffer.h"
|
||||
|
@ -110,8 +109,7 @@ void TextureFilterHandler::init()
|
|||
|
||||
m_options = _getConfigOptions();
|
||||
|
||||
GLint maxTextureSize;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
s32 maxTextureSize = gfxContext.getMaxTextureSize();
|
||||
wchar_t wRomName[32];
|
||||
::mbstowcs(wRomName, RSP.romname, 32);
|
||||
wchar_t txPath[PLUGIN_PATH_SIZE + 16];
|
||||
|
|
|
@ -19,6 +19,8 @@ private:
|
|||
u32 m_options;
|
||||
};
|
||||
|
||||
void displayLoadProgress(const wchar_t *format, ...);
|
||||
|
||||
extern TextureFilterHandler TFH;
|
||||
|
||||
#endif // TEXTUREFILTERHANDLER_H
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <algorithm>
|
||||
#include <thread> // std::this_thread::sleep_for
|
||||
#include <chrono> // std::chrono::seconds
|
||||
#include "OpenGL.h"
|
||||
#include "Textures.h"
|
||||
#include "GBI.h"
|
||||
#include "RSP.h"
|
||||
|
@ -513,7 +512,7 @@ void TextureCache::init()
|
|||
activateMSDummy(1);
|
||||
}
|
||||
|
||||
assert(!isGLError());
|
||||
assert(!gfxContext.isError());
|
||||
}
|
||||
|
||||
void TextureCache::destroy()
|
||||
|
@ -765,7 +764,7 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
|
|||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
|
||||
assert(!isGLError());
|
||||
assert(!gfxContext.isError());
|
||||
_updateCachedTexture(ghqTexInfo, _pTexture);
|
||||
return true;
|
||||
}
|
||||
|
@ -857,7 +856,7 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
}
|
||||
if (!bLoaded) {
|
||||
if (pTexture->realWidth % 2 != 0 && glInternalFormat != internalcolor::RGBA)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
gfxContext.setTextureUnpackAlignment(2);
|
||||
Context::InitTextureParams params;
|
||||
params.handle = pTexture->name;
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -931,7 +930,7 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
|
|||
params.dataType = Parameter(ghqTexInfo.pixel_type);
|
||||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
assert(!isGLError());
|
||||
assert(!gfxContext.isError());
|
||||
_updateCachedTexture(ghqTexInfo, _pTexture);
|
||||
return true;
|
||||
}
|
||||
|
@ -941,10 +940,12 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
|
|||
|
||||
void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
|
||||
{
|
||||
#ifndef GLES2
|
||||
if (!gfxContext.isSupported(SpecialFeatures::FragmentDepthWrite))
|
||||
return;
|
||||
|
||||
const u32 numTexels = _pTexture->realWidth * _pTexture->realHeight;
|
||||
_pTexture->textureBytes = numTexels * sizeof(GLfloat);
|
||||
GLfloat * pDestF = (GLfloat*)malloc(_pTexture->textureBytes);
|
||||
_pTexture->textureBytes = numTexels * sizeof(f32);
|
||||
f32 * pDestF = (f32*)malloc(_pTexture->textureBytes);
|
||||
assert(pDestF != nullptr);
|
||||
|
||||
for (u32 t = 0; t < numTexels; ++t)
|
||||
|
@ -962,7 +963,6 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
|
|||
params.data = pDestF;
|
||||
gfxContext.init2DTexture(params);
|
||||
free(pDestF);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1533,11 +1533,13 @@ void TextureCache::update(u32 _t)
|
|||
|
||||
m_misses++;
|
||||
|
||||
glActiveTexture( GL_TEXTURE0 + _t );
|
||||
|
||||
CachedTexture * pCurrent = _addTexture(crc);
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, GLuint(pCurrent->name) );
|
||||
Context::BindTextureParameters bindParams;
|
||||
bindParams.target = target::TEXTURE_2D;
|
||||
bindParams.texture = pCurrent->name;
|
||||
bindParams.textureUnitIndex = textureIndices::Tex[_t];
|
||||
gfxContext.bindTexture(bindParams);
|
||||
|
||||
pCurrent->address = gDP.loadInfo[pTile->tmem].texAddress;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <math.h>
|
||||
#include "Types.h"
|
||||
#include "VI.h"
|
||||
#include "OpenGL.h"
|
||||
#include "N64.h"
|
||||
#include "gSP.h"
|
||||
#include "gDP.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include "Performance.h"
|
||||
#include "Debug.h"
|
||||
#include "DisplayWindow.h"
|
||||
#include <Graphics/Context.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -93,7 +93,7 @@ void VI_UpdateSize()
|
|||
void VI_UpdateScreen()
|
||||
{
|
||||
if (VI.lastOrigin == -1) // Workaround for Mupen64Plus issue with initialization
|
||||
isGLError();
|
||||
gfxContext.isError();
|
||||
|
||||
if (ConfigOpen)
|
||||
return;
|
||||
|
@ -173,7 +173,6 @@ void VI_UpdateScreen()
|
|||
}
|
||||
|
||||
if (VI.lastOrigin == -1) { // Workaround for Mupen64Plus issue with initialization
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "Types.h"
|
||||
#include "Debug.h"
|
||||
#include "convert.h"
|
||||
#include "OpenGL.h"
|
||||
#include "CRC.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "gSP.h"
|
||||
#include "gDP.h"
|
||||
#include "3DMath.h"
|
||||
#include "OpenGL.h"
|
||||
#include "CRC.h"
|
||||
#include <string.h>
|
||||
#include "convert.h"
|
||||
|
|
Loading…
Reference in New Issue
Block a user