From f0e8760dc4c374b8fd712669d7df53ec4b012048 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sat, 21 Mar 2015 21:18:00 +0000 Subject: [PATCH] =?UTF-8?q?Cocoa=20Port:=20-=20Fix=20compiling=20when=20us?= =?UTF-8?q?ing=20Xcode=203.=20-=20Don=E2=80=99t=20set=20the=20output=20fra?= =?UTF-8?q?me=20size=20with=20multiple=20glViewport()=20calls=20per=20fram?= =?UTF-8?q?e.=20Just=20set=20it=20once=20for=20the=20output.=20-=20Do=20so?= =?UTF-8?q?me=20minor=20code=20cleanup.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desmume/src/cocoa/OGLDisplayOutput.cpp | 28 +++++++++----------------- desmume/src/cocoa/OGLDisplayOutput.h | 6 ++---- desmume/src/cocoa/cocoa_input.h | 1 + 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/desmume/src/cocoa/OGLDisplayOutput.cpp b/desmume/src/cocoa/OGLDisplayOutput.cpp index 30d5d2730..3b3dc3349 100644 --- a/desmume/src/cocoa/OGLDisplayOutput.cpp +++ b/desmume/src/cocoa/OGLDisplayOutput.cpp @@ -4520,7 +4520,7 @@ void OGLFilter::SetScaleOGL(GLfloat scale) free(tempDstBuffer); } -GLuint OGLFilter::RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight) +GLuint OGLFilter::RunFilterOGL(GLuint srcTexID) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, this->_fboID); glBindVertexArrayDESMUME(this->_vaoID); @@ -4534,7 +4534,6 @@ GLuint OGLFilter::RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei v glBindVertexArrayDESMUME(0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, viewportWidth, viewportHeight); return this->GetDstTexID(); } @@ -4576,7 +4575,7 @@ OGLFilterDeposterize::~OGLFilterDeposterize() glDeleteTextures(1, &this->_texIntermediateID); } -GLuint OGLFilterDeposterize::RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight) +GLuint OGLFilterDeposterize::RunFilterOGL(GLuint srcTexID) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, this->_fboID); glBindVertexArrayDESMUME(this->_vaoID); @@ -4595,7 +4594,6 @@ GLuint OGLFilterDeposterize::RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth glBindVertexArrayDESMUME(0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, viewportWidth, viewportHeight); return this->GetDstTexID(); } @@ -4906,6 +4904,8 @@ void OGLImage::UploadTransformationOGL() glRotatef(0.0f, 0.0f, 0.0f, 1.0f); glScalef(s, s, 1.0f); } + + glViewport(0, 0, this->_viewportWidth, this->_viewportHeight); } int OGLImage::GetOutputFilter() @@ -5283,7 +5283,7 @@ void OGLImage::ProcessOGL() // Source if (this->_useDeposterize) { - this->_texVideoSourceID = this->_filterDeposterize->RunFilterOGL(this->_texVideoInputDataID, this->_viewportWidth, this->_viewportHeight); + this->_texVideoSourceID = this->_filterDeposterize->RunFilterOGL(this->_texVideoInputDataID); if (isUsingCPUPixelScaler) // Hybrid CPU/GPU-based path (may cause a performance hit on pixel download) { @@ -5304,7 +5304,7 @@ void OGLImage::ProcessOGL() glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID, this->_viewportWidth, this->_viewportHeight); + this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID); this->UpdateTexCoords(this->_shaderFilter->GetDstWidth(), this->_shaderFilter->GetDstHeight()); } @@ -5659,16 +5659,6 @@ void OGLDisplayLayer::SetRotation(GLfloat theRotation) this->_rotation = theRotation; } -bool OGLDisplayLayer::GetBilinear() -{ - return (this->_displayTexFilter == GL_LINEAR); -} - -void OGLDisplayLayer::SetBilinear(bool useBilinear) -{ - this->_displayTexFilter = (useBilinear) ? GL_LINEAR : GL_NEAREST; -} - bool OGLDisplayLayer::GetSourceDeposterize() { return this->_useDeposterize; @@ -5835,6 +5825,8 @@ void OGLDisplayLayer::UploadTransformationOGL() glRotatef(CLOCKWISE_DEGREES(this->_rotation), 0.0f, 0.0f, 1.0f); glScalef(s, s, 1.0f); } + + glViewport(0, 0, this->_viewportWidth, this->_viewportHeight); } int OGLDisplayLayer::GetOutputFilter() @@ -6237,7 +6229,7 @@ void OGLDisplayLayer::ProcessOGL() // Source if (this->_useDeposterize) { - this->_texVideoSourceID = this->_filterDeposterize->RunFilterOGL(this->_texVideoInputDataID, this->_viewportWidth, this->_viewportHeight); + this->_texVideoSourceID = this->_filterDeposterize->RunFilterOGL(this->_texVideoInputDataID); if (isUsingCPUPixelScaler) // Hybrid CPU/GPU-based path (may cause a performance hit on pixel download) { @@ -6260,7 +6252,7 @@ void OGLDisplayLayer::ProcessOGL() glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID, this->_viewportWidth, this->_viewportHeight); + this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID); this->UpdateTexCoords(this->_shaderFilter->GetDstWidth(), this->_shaderFilter->GetDstHeight()); } diff --git a/desmume/src/cocoa/OGLDisplayOutput.h b/desmume/src/cocoa/OGLDisplayOutput.h index 4cbd92a0f..d505b4575 100644 --- a/desmume/src/cocoa/OGLDisplayOutput.h +++ b/desmume/src/cocoa/OGLDisplayOutput.h @@ -151,7 +151,7 @@ public: void SetSrcSizeOGL(GLsizei w, GLsizei h); GLfloat GetScale(); void SetScaleOGL(GLfloat scale); - virtual GLuint RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight); + virtual GLuint RunFilterOGL(GLuint srcTexID); void DownloadDstBufferOGL(uint32_t *dstBuffer, size_t lineOffset, size_t readLineCount); }; @@ -164,7 +164,7 @@ public: OGLFilterDeposterize(GLsizei srcWidth, GLsizei srcHeight, ShaderSupportTier theTier, bool useShader150); ~OGLFilterDeposterize(); - virtual GLuint RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight); + virtual GLuint RunFilterOGL(GLuint srcTexID); }; class OGLVideoLayer @@ -362,8 +362,6 @@ public: void SetGapScalar(GLfloat theScalar); GLfloat GetRotation(); void SetRotation(GLfloat theRotation); - bool GetBilinear(); - void SetBilinear(bool useBilinear); bool GetSourceDeposterize(); void SetSourceDeposterize(bool useDeposterize); diff --git a/desmume/src/cocoa/cocoa_input.h b/desmume/src/cocoa/cocoa_input.h index 1c86e4198..5021d1528 100644 --- a/desmume/src/cocoa/cocoa_input.h +++ b/desmume/src/cocoa/cocoa_input.h @@ -93,6 +93,7 @@ typedef struct id delegate; float micLevel; BOOL autohold; + BOOL hardwareMicMute; BOOL _isAutoholdCleared; BOOL _useHardwareMic; size_t _availableMicSamples;