Cocoa Port: Do some code cleanup.
This commit is contained in:
parent
a09763f8c3
commit
fc9b4831a0
|
@ -5280,26 +5280,6 @@ GLuint OGLFilter::GetDstTexID()
|
||||||
return this->_texDstID;
|
return this->_texDstID;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLsizei OGLFilter::GetSrcWidth()
|
|
||||||
{
|
|
||||||
return this->_srcWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLsizei OGLFilter::GetSrcHeight()
|
|
||||||
{
|
|
||||||
return this->_srcHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLsizei OGLFilter::GetDstWidth()
|
|
||||||
{
|
|
||||||
return this->_dstWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLsizei OGLFilter::GetDstHeight()
|
|
||||||
{
|
|
||||||
return this->_dstHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OGLFilter::SetSrcSizeOGL(GLsizei w, GLsizei h)
|
void OGLFilter::SetSrcSizeOGL(GLsizei w, GLsizei h)
|
||||||
{
|
{
|
||||||
this->_srcWidth = w;
|
this->_srcWidth = w;
|
||||||
|
@ -5328,17 +5308,27 @@ GLfloat OGLFilter::GetScale()
|
||||||
return this->_scale;
|
return this->_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLFilter::SetScaleOGL(GLfloat scale)
|
void OGLFilter::SetScaleOGL(GLfloat scale, void *buffer)
|
||||||
{
|
{
|
||||||
this->_scale = scale;
|
this->_scale = scale;
|
||||||
this->_dstWidth = this->_srcWidth * this->_scale;
|
this->_dstWidth = this->_srcWidth * this->_scale;
|
||||||
this->_dstHeight = this->_srcHeight * this->_scale;
|
this->_dstHeight = this->_srcHeight * this->_scale;
|
||||||
|
|
||||||
uint32_t *tempDstBuffer = (uint32_t *)calloc(this->_dstWidth * this->_dstHeight, sizeof(uint32_t));
|
bool usedInternalAllocation = false;
|
||||||
|
if (buffer == NULL)
|
||||||
|
{
|
||||||
|
buffer = (uint32_t *)calloc(this->_dstWidth * this->_dstHeight, sizeof(uint32_t));
|
||||||
|
usedInternalAllocation = true;
|
||||||
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDstID);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texDstID);
|
||||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_dstWidth, this->_dstHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, tempDstBuffer);
|
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_dstWidth, this->_dstHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||||
free(tempDstBuffer);
|
|
||||||
|
if (usedInternalAllocation)
|
||||||
|
{
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OGLFilter::RunFilterOGL(GLuint srcTexID)
|
GLuint OGLFilter::RunFilterOGL(GLuint srcTexID)
|
||||||
|
@ -5795,6 +5785,7 @@ void OGLImage::SetPixelScalerOGL(const int filterID)
|
||||||
bool OGLImage::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
bool OGLImage::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
{
|
{
|
||||||
bool willUseShaderBasedPixelScaler = true;
|
bool willUseShaderBasedPixelScaler = true;
|
||||||
|
GLuint currentHQnxLUT = 0;
|
||||||
|
|
||||||
if (!this->_canUseShaderBasedFilters || filterID == VideoFilterTypeID_None)
|
if (!this->_canUseShaderBasedFilters || filterID == VideoFilterTypeID_None)
|
||||||
{
|
{
|
||||||
|
@ -5803,8 +5794,6 @@ bool OGLImage::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
}
|
}
|
||||||
|
|
||||||
OGLShaderProgram *shaderFilterProgram = _shaderFilter->GetProgram();
|
OGLShaderProgram *shaderFilterProgram = _shaderFilter->GetProgram();
|
||||||
VideoFilterAttributes vfAttr = VideoFilter::GetAttributesByID((VideoFilterTypeID)filterID);
|
|
||||||
GLfloat vfScale = (GLfloat)vfAttr.scaleMultiply / (GLfloat)vfAttr.scaleDivide;
|
|
||||||
|
|
||||||
switch (filterID)
|
switch (filterID)
|
||||||
{
|
{
|
||||||
|
@ -5841,148 +5830,44 @@ bool OGLImage::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2X:
|
case VideoFilterTypeID_LQ2X:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texLQ2xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texLQ2xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2XS:
|
case VideoFilterTypeID_LQ2XS:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texLQ2xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texLQ2xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2X:
|
case VideoFilterTypeID_HQ2X:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ2xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ2xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2XS:
|
case VideoFilterTypeID_HQ2XS:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ2xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ2xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ3X:
|
case VideoFilterTypeID_HQ3X:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ3xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ3xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ3XS:
|
case VideoFilterTypeID_HQ3XS:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ3xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ3xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ4X:
|
case VideoFilterTypeID_HQ4X:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ4xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ4xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ4XS:
|
case VideoFilterTypeID_HQ4XS:
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
|
||||||
glBindTexture(GL_TEXTURE_3D, this->_texHQ4xLUT);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, _useShader150);
|
||||||
|
currentHQnxLUT = this->_texHQ4xLUT;
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_2xBRZ:
|
case VideoFilterTypeID_2xBRZ:
|
||||||
{
|
{
|
||||||
|
@ -6063,11 +5948,29 @@ bool OGLImage::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentHQnxLUT != 0)
|
||||||
|
{
|
||||||
|
glUseProgram(shaderFilterProgram->GetProgramID());
|
||||||
|
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
||||||
|
glUniform1i(uniformTexSampler, 0);
|
||||||
|
|
||||||
|
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
||||||
|
glUniform1i(uniformTexSampler, 1);
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (willUseShaderBasedPixelScaler)
|
if (willUseShaderBasedPixelScaler)
|
||||||
{
|
{
|
||||||
_shaderFilter->SetScaleOGL(vfScale);
|
const VideoFilterAttributes vfAttr = VideoFilter::GetAttributesByID((VideoFilterTypeID)filterID);
|
||||||
|
const GLfloat vfScale = (GLfloat)vfAttr.scaleMultiply / (GLfloat)vfAttr.scaleDivide;
|
||||||
|
|
||||||
|
_shaderFilter->SetScaleOGL(vfScale, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0 + 1);
|
||||||
|
glBindTexture(GL_TEXTURE_3D, currentHQnxLUT);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
return willUseShaderBasedPixelScaler;
|
return willUseShaderBasedPixelScaler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6136,7 +6039,7 @@ void OGLImage::ProcessOGL()
|
||||||
if (this->_useShaderBasedPixelScaler)
|
if (this->_useShaderBasedPixelScaler)
|
||||||
{
|
{
|
||||||
this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID);
|
this->_texVideoPixelScalerID = this->_shaderFilter->RunFilterOGL(this->_texVideoSourceID);
|
||||||
this->UpdateTexCoords(this->_shaderFilter->GetDstWidth(), this->_shaderFilter->GetDstHeight());
|
this->UpdateTexCoords(this->_vf->GetDstWidth(), this->_vf->GetDstHeight());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6554,13 +6457,13 @@ OGLDisplayLayer::OGLDisplayLayer(OGLVideoOutput *oglVO)
|
||||||
|
|
||||||
glBindVertexArrayDESMUME(0);
|
glBindVertexArrayDESMUME(0);
|
||||||
|
|
||||||
_useShader150 = _output->GetContextInfo()->IsUsingShader150();
|
const bool useShader150 = _output->GetContextInfo()->IsUsingShader150();
|
||||||
_shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
const ShaderSupportTier shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
||||||
if (_output->GetContextInfo()->IsShaderSupported())
|
if (_output->GetContextInfo()->IsShaderSupported())
|
||||||
{
|
{
|
||||||
_finalOutputProgram = new OGLShaderProgram;
|
_finalOutputProgram = new OGLShaderProgram;
|
||||||
_finalOutputProgram->SetShaderSupport(_shaderSupport);
|
_finalOutputProgram->SetShaderSupport(shaderSupport);
|
||||||
_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, _useShader150);
|
_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, useShader150);
|
||||||
|
|
||||||
const GLuint finalOutputProgramID = _finalOutputProgram->GetProgramID();
|
const GLuint finalOutputProgramID = _finalOutputProgram->GetProgramID();
|
||||||
glUseProgram(finalOutputProgramID);
|
glUseProgram(finalOutputProgramID);
|
||||||
|
@ -6578,12 +6481,12 @@ OGLDisplayLayer::OGLDisplayLayer(OGLVideoOutput *oglVO)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 2; i++)
|
for (size_t i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
_filterDeposterize[i] = new OGLFilterDeposterize(GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, _shaderSupport, _useShader150);
|
_filterDeposterize[i] = new OGLFilterDeposterize(GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT, shaderSupport, useShader150);
|
||||||
|
|
||||||
_shaderFilter[i] = new OGLFilter(_vf[i]->GetSrcWidth(), _vf[i]->GetSrcHeight(), 1);
|
_shaderFilter[i] = new OGLFilter(_vf[i]->GetSrcWidth(), _vf[i]->GetSrcHeight(), 1);
|
||||||
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
||||||
shaderFilterProgram->SetShaderSupport(_shaderSupport);
|
shaderFilterProgram->SetShaderSupport(shaderSupport);
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -6713,51 +6616,54 @@ OutputFilterTypeID OGLDisplayLayer::SetOutputFilterOGL(const OutputFilterTypeID
|
||||||
|
|
||||||
if (this->_output->CanFilterOnGPU())
|
if (this->_output->CanFilterOnGPU())
|
||||||
{
|
{
|
||||||
|
const bool useShader150 = _output->GetContextInfo()->IsUsingShader150();
|
||||||
|
const ShaderSupportTier shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
||||||
|
|
||||||
outputFilter = filterID;
|
outputFilter = filterID;
|
||||||
|
|
||||||
switch (filterID)
|
switch (filterID)
|
||||||
{
|
{
|
||||||
case OutputFilterTypeID_NearestNeighbor:
|
case OutputFilterTypeID_NearestNeighbor:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OutputFilterTypeID_Bilinear:
|
case OutputFilterTypeID_Bilinear:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, useShader150);
|
||||||
this->_displayTexFilter[0] = GL_LINEAR;
|
this->_displayTexFilter[0] = GL_LINEAR;
|
||||||
this->_displayTexFilter[1] = GL_LINEAR;
|
this->_displayTexFilter[1] = GL_LINEAR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OutputFilterTypeID_BicubicBSpline:
|
case OutputFilterTypeID_BicubicBSpline:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterBicubicBSplineFragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterBicubicBSplineFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OutputFilterTypeID_BicubicMitchell:
|
case OutputFilterTypeID_BicubicMitchell:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterBicubicMitchellNetravaliFragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterBicubicMitchellNetravaliFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OutputFilterTypeID_Lanczos2:
|
case OutputFilterTypeID_Lanczos2:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterLanczos2FragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterLanczos2FragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OutputFilterTypeID_Lanczos3:
|
case OutputFilterTypeID_Lanczos3:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_HighTier)
|
if (shaderSupport >= ShaderSupport_HighTier)
|
||||||
{
|
{
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample6x6Output_VertShader_110, FilterLanczos3FragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample6x6Output_VertShader_110, FilterLanczos3FragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else if (this->_shaderSupport >= ShaderSupport_MidTier)
|
else if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample5x5Output_VertShader_110, FilterLanczos3FragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample5x5Output_VertShader_110, FilterLanczos3FragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterLanczos3FragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(BicubicSample4x4Output_VertShader_110, FilterLanczos3FragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, _useShader150);
|
this->_finalOutputProgram->SetVertexAndFragmentShaderOGL(Sample1x1OutputVertShader_100, PassthroughOutputFragShader_110, useShader150);
|
||||||
outputFilter = OutputFilterTypeID_NearestNeighbor;
|
outputFilter = OutputFilterTypeID_NearestNeighbor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6778,6 +6684,7 @@ OutputFilterTypeID OGLDisplayLayer::SetOutputFilterOGL(const OutputFilterTypeID
|
||||||
bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
{
|
{
|
||||||
bool willUseShaderBasedPixelScaler = true;
|
bool willUseShaderBasedPixelScaler = true;
|
||||||
|
GLuint currentHQnxLUT = 0;
|
||||||
|
|
||||||
if (!this->_output->CanFilterOnGPU() || filterID == VideoFilterTypeID_None)
|
if (!this->_output->CanFilterOnGPU() || filterID == VideoFilterTypeID_None)
|
||||||
{
|
{
|
||||||
|
@ -6788,196 +6695,92 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
for (size_t i = 0; i < 2; i++)
|
for (size_t i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
OGLShaderProgram *shaderFilterProgram = _shaderFilter[i]->GetProgram();
|
||||||
VideoFilterAttributes vfAttr = VideoFilter::GetAttributesByID((VideoFilterTypeID)filterID);
|
const bool useShader150 = _output->GetContextInfo()->IsUsingShader150();
|
||||||
GLfloat vfScale = (GLfloat)vfAttr.scaleMultiply / (GLfloat)vfAttr.scaleDivide;
|
const ShaderSupportTier shaderSupport = _output->GetContextInfo()->GetShaderSupport();
|
||||||
|
|
||||||
switch (filterID)
|
switch (filterID)
|
||||||
{
|
{
|
||||||
case VideoFilterTypeID_Nearest1_5X:
|
case VideoFilterTypeID_Nearest1_5X:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_Nearest2X:
|
case VideoFilterTypeID_Nearest2X:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_Scanline:
|
case VideoFilterTypeID_Scanline:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, Scalar2xScanlineFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, Scalar2xScanlineFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_EPX:
|
case VideoFilterTypeID_EPX:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, Scalar2xEPXFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, Scalar2xEPXFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_EPXPlus:
|
case VideoFilterTypeID_EPXPlus:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, Scalar2xEPXPlusFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, Scalar2xEPXPlusFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_2xSaI:
|
case VideoFilterTypeID_2xSaI:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scalar2xSaIFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scalar2xSaIFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_Super2xSaI:
|
case VideoFilterTypeID_Super2xSaI:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, ScalarSuper2xSaIFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, ScalarSuper2xSaIFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_SuperEagle:
|
case VideoFilterTypeID_SuperEagle:
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, ScalarSuperEagle2xFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, ScalarSuperEagle2xFragShader_110, useShader150);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2X:
|
case VideoFilterTypeID_LQ2X:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_LQ2XS:
|
case VideoFilterTypeID_LQ2XS:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexLQ2xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerLQ2xSFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2X:
|
case VideoFilterTypeID_HQ2X:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ2XS:
|
case VideoFilterTypeID_HQ2XS:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ2xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ2xSFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ3X:
|
case VideoFilterTypeID_HQ3X:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ3XS:
|
case VideoFilterTypeID_HQ3XS:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ3xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ3xSFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ4X:
|
case VideoFilterTypeID_HQ4X:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_HQ4XS:
|
case VideoFilterTypeID_HQ4XS:
|
||||||
{
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, useShader150);
|
||||||
glActiveTexture(GL_TEXTURE0 + 1);
|
currentHQnxLUT = ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT();
|
||||||
glBindTexture(GL_TEXTURE_3D, ((const OGLClientFetchObject &)this->_output->GetFetchObject()).GetTexHQ4xLUT());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
|
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample3x3_VertShader_110, ScalerHQ4xSFragShader_110, _useShader150);
|
|
||||||
|
|
||||||
glUseProgram(shaderFilterProgram->GetProgramID());
|
|
||||||
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
|
||||||
glUniform1i(uniformTexSampler, 0);
|
|
||||||
|
|
||||||
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
|
||||||
glUniform1i(uniformTexSampler, 1);
|
|
||||||
glUseProgram(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case VideoFilterTypeID_2xBRZ:
|
case VideoFilterTypeID_2xBRZ:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_MidTier)
|
if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler2xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler2xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else if (this->_shaderSupport >= ShaderSupport_LowTier)
|
else if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scaler2xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scaler2xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6988,13 +6791,13 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
|
|
||||||
case VideoFilterTypeID_3xBRZ:
|
case VideoFilterTypeID_3xBRZ:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_MidTier)
|
if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler3xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler3xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else if (this->_shaderSupport >= ShaderSupport_LowTier)
|
else if (shaderSupport >= ShaderSupport_LowTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scaler3xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample4x4_VertShader_110, Scaler3xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7005,9 +6808,9 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
|
|
||||||
case VideoFilterTypeID_4xBRZ:
|
case VideoFilterTypeID_4xBRZ:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_MidTier)
|
if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler4xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler4xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7018,9 +6821,9 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
|
|
||||||
case VideoFilterTypeID_5xBRZ:
|
case VideoFilterTypeID_5xBRZ:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_MidTier)
|
if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler5xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler5xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7031,9 +6834,9 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
|
|
||||||
case VideoFilterTypeID_6xBRZ:
|
case VideoFilterTypeID_6xBRZ:
|
||||||
{
|
{
|
||||||
if (this->_shaderSupport >= ShaderSupport_MidTier)
|
if (shaderSupport >= ShaderSupport_MidTier)
|
||||||
{
|
{
|
||||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler6xBRZFragShader_110, _useShader150);
|
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample5x5_VertShader_110, Scaler6xBRZFragShader_110, useShader150);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7047,14 +6850,32 @@ bool OGLDisplayLayer::SetGPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentHQnxLUT != 0)
|
||||||
|
{
|
||||||
|
glUseProgram(shaderFilterProgram->GetProgramID());
|
||||||
|
GLint uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "tex");
|
||||||
|
glUniform1i(uniformTexSampler, 0);
|
||||||
|
|
||||||
|
uniformTexSampler = glGetUniformLocation(shaderFilterProgram->GetProgramID(), "lut");
|
||||||
|
glUniform1i(uniformTexSampler, 1);
|
||||||
|
glUseProgram(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (willUseShaderBasedPixelScaler)
|
if (willUseShaderBasedPixelScaler)
|
||||||
{
|
{
|
||||||
|
const VideoFilterAttributes vfAttr = VideoFilter::GetAttributesByID((VideoFilterTypeID)filterID);
|
||||||
|
const GLfloat vfScale = (GLfloat)vfAttr.scaleMultiply / (GLfloat)vfAttr.scaleDivide;
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||||
this->_shaderFilter[i]->SetScaleOGL(vfScale);
|
this->_shaderFilter[i]->SetScaleOGL(vfScale, this->_vf[i]->GetDstBufferPtr());
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0 + 1);
|
||||||
|
glBindTexture(GL_TEXTURE_3D, currentHQnxLUT);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
return willUseShaderBasedPixelScaler;
|
return willUseShaderBasedPixelScaler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7102,7 +6923,7 @@ void OGLDisplayLayer::_ProcessDisplayByID(const NDSDisplayID displayID, GLsizei
|
||||||
|
|
||||||
if (isUsingCPUPixelScaler) // Hybrid CPU/GPU-based path (may cause a performance hit on pixel download)
|
if (isUsingCPUPixelScaler) // Hybrid CPU/GPU-based path (may cause a performance hit on pixel download)
|
||||||
{
|
{
|
||||||
this->_filterDeposterize[displayID]->DownloadDstBufferOGL(this->_vf[displayID]->GetSrcBufferPtr(), 0, this->_filterDeposterize[displayID]->GetSrcHeight());
|
this->_filterDeposterize[displayID]->DownloadDstBufferOGL(this->_vf[displayID]->GetSrcBufferPtr(), 0, this->_vf[displayID]->GetSrcHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7115,8 +6936,8 @@ void OGLDisplayLayer::_ProcessDisplayByID(const NDSDisplayID displayID, GLsizei
|
||||||
inoutTexID = this->_shaderFilter[displayID]->RunFilterOGL(inoutTexID);
|
inoutTexID = this->_shaderFilter[displayID]->RunFilterOGL(inoutTexID);
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||||
|
|
||||||
inoutWidth = this->_shaderFilter[displayID]->GetDstWidth();
|
inoutWidth = this->_vf[displayID]->GetDstWidth();
|
||||||
inoutHeight = this->_shaderFilter[displayID]->GetDstHeight();
|
inoutHeight = this->_vf[displayID]->GetDstHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -143,13 +143,9 @@ public:
|
||||||
|
|
||||||
OGLShaderProgram* GetProgram();
|
OGLShaderProgram* GetProgram();
|
||||||
GLuint GetDstTexID();
|
GLuint GetDstTexID();
|
||||||
GLsizei GetSrcWidth();
|
|
||||||
GLsizei GetSrcHeight();
|
|
||||||
GLsizei GetDstWidth();
|
|
||||||
GLsizei GetDstHeight();
|
|
||||||
virtual void SetSrcSizeOGL(GLsizei w, GLsizei h);
|
virtual void SetSrcSizeOGL(GLsizei w, GLsizei h);
|
||||||
GLfloat GetScale();
|
GLfloat GetScale();
|
||||||
void SetScaleOGL(GLfloat scale);
|
void SetScaleOGL(GLfloat scale, void *buffer);
|
||||||
virtual GLuint RunFilterOGL(GLuint srcTexID);
|
virtual GLuint RunFilterOGL(GLuint srcTexID);
|
||||||
void DownloadDstBufferOGL(uint32_t *dstBuffer, size_t lineOffset, size_t readLineCount);
|
void DownloadDstBufferOGL(uint32_t *dstBuffer, size_t lineOffset, size_t readLineCount);
|
||||||
};
|
};
|
||||||
|
@ -298,9 +294,6 @@ public:
|
||||||
class OGLDisplayLayer : public OGLVideoLayer
|
class OGLDisplayLayer : public OGLVideoLayer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool _useShader150;
|
|
||||||
ShaderSupportTier _shaderSupport;
|
|
||||||
|
|
||||||
OGLShaderProgram *_finalOutputProgram;
|
OGLShaderProgram *_finalOutputProgram;
|
||||||
OGLFilter *_filterDeposterize[2];
|
OGLFilter *_filterDeposterize[2];
|
||||||
OGLFilter *_shaderFilter[2];
|
OGLFilter *_shaderFilter[2];
|
||||||
|
@ -340,7 +333,6 @@ public:
|
||||||
void SetCPUPixelScalerOGL(const VideoFilterTypeID filterID);
|
void SetCPUPixelScalerOGL(const VideoFilterTypeID filterID);
|
||||||
|
|
||||||
void LoadNativeDisplayByID_OGL(const NDSDisplayID displayID);
|
void LoadNativeDisplayByID_OGL(const NDSDisplayID displayID);
|
||||||
|
|
||||||
void ProcessOGL();
|
void ProcessOGL();
|
||||||
virtual void RenderOGL();
|
virtual void RenderOGL();
|
||||||
virtual void FinishOGL(const u8 bufferIndex);
|
virtual void FinishOGL(const u8 bufferIndex);
|
||||||
|
|
Loading…
Reference in New Issue