Cocoa Port:

- Add shader-based equivalents to the following pixel scalers: 2xBRZ, 3xBRZ, 4xBRZ, 5xBRZ. (And yes, these are exact GLSL ports of Zenju's xBRZ scalers, not Hyllian's xBR scalers. These shaders are very demanding on your GPU, so users with older GPUs may want to continue using the CPU-based versions instead.)
- Add a preliminary GPU tiering system to help detect GPU capabilities and allow for better optimizations to be used on newer GPUs.
- Do some optimizations to the following shaders: Bicubic B-Spline, Bicubic Mitchell-Netravali, Lanczos3, EPX.
- Change the shader-based EPX+ color comparisons to be more true to the original CPU-based algorithm.
- Improve color blending on the Deposterize shader.
This commit is contained in:
rogerman 2015-02-04 01:22:13 +00:00
parent f0bef635c2
commit baeb5313d2
2 changed files with 2688 additions and 309 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,18 +39,32 @@ enum
OutputFilterTypeID_Lanczos3 = 5 OutputFilterTypeID_Lanczos3 = 5
}; };
enum ShaderSupportTier
{
ShaderSupport_Unsupported = 0,
ShaderSupport_BottomTier = 1,
ShaderSupport_LowTier = 2,
ShaderSupport_MidTier = 3,
ShaderSupport_HighTier = 4,
ShaderSupport_TopTier = 5,
ShaderSupport_FutureTier = 6,
};
class OGLInfo class OGLInfo
{ {
protected: protected:
unsigned int _versionMajor; unsigned int _versionMajor;
unsigned int _versionMinor; unsigned int _versionMinor;
unsigned int _versionRevision; unsigned int _versionRevision;
ShaderSupportTier _shaderSupport;
bool _isVBOSupported; bool _isVBOSupported;
bool _isPBOSupported; bool _isPBOSupported;
bool _isShaderSupported; bool _isShaderSupported;
bool _isFBOSupported; bool _isFBOSupported;
ShaderSupportTier DetermineShaderSupport();
public: public:
OGLInfo(); OGLInfo();
virtual ~OGLInfo() {}; virtual ~OGLInfo() {};
@ -61,6 +75,7 @@ public:
bool IsPBOSupported(); bool IsPBOSupported();
bool IsShaderSupported(); bool IsShaderSupported();
bool IsFBOSupported(); bool IsFBOSupported();
ShaderSupportTier GetShaderSupport();
virtual void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet) = 0; virtual void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet) = 0;
virtual bool IsExtensionPresent(const std::set<std::string> &oglExtensionSet, const std::string &extensionName) const = 0; virtual bool IsExtensionPresent(const std::set<std::string> &oglExtensionSet, const std::string &extensionName) const = 0;
@ -87,7 +102,7 @@ public:
OGLInfo_2_1(); OGLInfo_2_1();
}; };
class OGLInfo_3_2 : public OGLInfo_2_0 class OGLInfo_3_2 : public OGLInfo_2_1
{ {
public: public:
OGLInfo_3_2(); OGLInfo_3_2();
@ -101,6 +116,7 @@ protected:
GLuint _vertexID; GLuint _vertexID;
GLuint _fragmentID; GLuint _fragmentID;
GLuint _programID; GLuint _programID;
ShaderSupportTier _shaderSupport;
virtual GLuint LoadShaderOGL(GLenum shaderType, const char *shaderProgram); virtual GLuint LoadShaderOGL(GLenum shaderType, const char *shaderProgram);
virtual bool LinkOGL(); virtual bool LinkOGL();
@ -109,6 +125,8 @@ public:
OGLShaderProgram(); OGLShaderProgram();
virtual ~OGLShaderProgram(); virtual ~OGLShaderProgram();
ShaderSupportTier GetShaderSupport();
void SetShaderSupport(const ShaderSupportTier theTier);
GLuint GetVertexShaderID(); GLuint GetVertexShaderID();
void SetVertexShaderOGL(const char *shaderProgram); void SetVertexShaderOGL(const char *shaderProgram);
GLuint GetFragmentShaderID(); GLuint GetFragmentShaderID();
@ -194,13 +212,14 @@ class OGLDisplayLayer : public OGLVideoLayer
protected: protected:
bool _canUseShaderBasedFilters; bool _canUseShaderBasedFilters;
bool _canUseShaderOutput; bool _canUseShaderOutput;
ShaderSupportTier _shaderSupport;
bool _needUploadVertices; bool _needUploadVertices;
bool _useDeposterize; bool _useDeposterize;
bool _useShaderBasedPixelScaler; bool _useShaderBasedPixelScaler;
bool _filtersPreferGPU; bool _filtersPreferGPU;
int _outputFilter; int _outputFilter;
int _pixelScaler; VideoFilterTypeID _pixelScaler;
OGLFilterDeposterize *_filterDeposterize; OGLFilterDeposterize *_filterDeposterize;
OGLFilter *_shaderFilter; OGLFilter *_shaderFilter;
@ -210,7 +229,7 @@ protected:
VideoFilter *_vfDual; VideoFilter *_vfDual;
VideoFilter *_vf; VideoFilter *_vf;
uint32_t *_vfMasterDstBuffer; uint32_t *_vfMasterDstBuffer;
int _displayMode; int _displayMode;
int _displayOrder; int _displayOrder;
int _displayOrientation; int _displayOrientation;
@ -284,7 +303,8 @@ public:
virtual void SetOutputFilterOGL(const int filterID); virtual void SetOutputFilterOGL(const int filterID);
int GetPixelScaler(); int GetPixelScaler();
virtual void SetPixelScalerOGL(const int filterID); virtual void SetPixelScalerOGL(const int filterID);
virtual void SetCPUFilterOGL(const VideoFilterTypeID videoFilterTypeID); virtual bool SetGPUPixelScalerOGL(const VideoFilterTypeID filterID);
virtual void SetCPUPixelScalerOGL(const VideoFilterTypeID filterID);
virtual void LoadFrameOGL(const uint16_t *frameData, GLsizei w, GLsizei h); virtual void LoadFrameOGL(const uint16_t *frameData, GLsizei w, GLsizei h);
virtual void ProcessOGL(); virtual void ProcessOGL();
virtual void RenderOGL(); virtual void RenderOGL();