Cocoa Port:
- Do a huge refactor of the display code. - Add support for shader-based filters. - New feature: The display pipeline has been separated into three parts - Source --> Pixel Scale --> Output. Different sets of filters may be applied to each part of the pipeline. - Add the following source filters: Deposterize - Add the following output filters: Bicubic (B-Spline), Bicubic (Mitchell-Netravali), Lanczos2, Lanczos3. - Add shader-based equivalents to the following pixel scalers: Nearest 2x, Scanline, EPX, EPX+, Super Eagle, 2xSaI, Super 2xSaI. These will be used instead of the CPU-based scalers if "Run filters on GPU if possible" is enabled (default is enabled). - Remove the following pixel scalers from the UI: Nearest 1.5x, Nearest+ 1.5x, Bilinear 2x, EPX 1.5x, EPX+ 1.5x. The reasoning behind this is because these pixel scalers aren't necessary due to the automatic sizing of display view to window. Also, the new output filters make it so that running similar pixel scalers along with an output filter will always yield superior results.
This commit is contained in:
parent
d16070ecb4
commit
db358049b9
|
@ -12,8 +12,12 @@
|
|||
<true/>
|
||||
<key>CoreControl_SpeedScalar</key>
|
||||
<real>1</real>
|
||||
<key>DisplayView_Deposterize</key>
|
||||
<false/>
|
||||
<key>DisplayView_Mode</key>
|
||||
<integer>2</integer>
|
||||
<key>DisplayView_OutputFilter</key>
|
||||
<integer>1</integer>
|
||||
<key>DisplayView_Rotation</key>
|
||||
<integer>0</integer>
|
||||
<key>DisplayView_ShowHUD</key>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -27,87 +27,280 @@
|
|||
#include <string>
|
||||
#include "../filter/videofilter.h"
|
||||
|
||||
class OGLVideoOutput;
|
||||
|
||||
class OGLVideoOutput
|
||||
enum
|
||||
{
|
||||
OutputFilterTypeID_NearestNeighbor = 0,
|
||||
OutputFilterTypeID_Bilinear = 1,
|
||||
OutputFilterTypeID_BicubicBSpline = 2,
|
||||
OutputFilterTypeID_BicubicMitchell = 3,
|
||||
OutputFilterTypeID_Lanczos2 = 4,
|
||||
OutputFilterTypeID_Lanczos3 = 5
|
||||
};
|
||||
|
||||
class OGLInfo
|
||||
{
|
||||
protected:
|
||||
unsigned int _versionMajor;
|
||||
unsigned int _versionMinor;
|
||||
unsigned int _versionRevision;
|
||||
|
||||
bool _isVBOSupported;
|
||||
bool _isPBOSupported;
|
||||
bool _isShaderSupported;
|
||||
bool _isFBOSupported;
|
||||
|
||||
public:
|
||||
OGLInfo();
|
||||
virtual ~OGLInfo() {};
|
||||
|
||||
static OGLInfo* GetVersionedObjectOGL();
|
||||
|
||||
bool IsVBOSupported();
|
||||
bool IsPBOSupported();
|
||||
bool IsShaderSupported();
|
||||
bool IsFBOSupported();
|
||||
|
||||
virtual void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet) = 0;
|
||||
virtual bool IsExtensionPresent(const std::set<std::string> &oglExtensionSet, const std::string &extensionName) const = 0;
|
||||
};
|
||||
|
||||
class OGLInfo_1_2 : public OGLInfo
|
||||
{
|
||||
public:
|
||||
OGLInfo_1_2();
|
||||
|
||||
virtual void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet);
|
||||
virtual bool IsExtensionPresent(const std::set<std::string> &oglExtensionSet, const std::string &extensionName) const;
|
||||
};
|
||||
|
||||
class OGLInfo_2_0 : public OGLInfo_1_2
|
||||
{
|
||||
public:
|
||||
OGLInfo_2_0();
|
||||
};
|
||||
|
||||
class OGLInfo_2_1 : public OGLInfo_2_0
|
||||
{
|
||||
public:
|
||||
OGLInfo_2_1();
|
||||
};
|
||||
|
||||
class OGLInfo_3_2 : public OGLInfo_2_0
|
||||
{
|
||||
public:
|
||||
OGLInfo_3_2();
|
||||
|
||||
virtual void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet);
|
||||
};
|
||||
|
||||
class OGLShaderProgram
|
||||
{
|
||||
protected:
|
||||
GLuint _vertexID;
|
||||
GLuint _fragmentID;
|
||||
GLuint _programID;
|
||||
|
||||
virtual GLuint LoadShaderOGL(GLenum shaderType, const char *shaderProgram);
|
||||
virtual bool LinkOGL();
|
||||
|
||||
public:
|
||||
OGLShaderProgram();
|
||||
virtual ~OGLShaderProgram();
|
||||
|
||||
GLuint GetVertexShaderID();
|
||||
void SetVertexShaderOGL(const char *shaderProgram);
|
||||
GLuint GetFragmentShaderID();
|
||||
void SetFragmentShaderOGL(const char *shaderProgram);
|
||||
void SetVertexAndFragmentShaderOGL(const char *vertShaderProgram, const char *fragShaderProgram);
|
||||
GLuint GetProgramID();
|
||||
};
|
||||
|
||||
class OGLFilter
|
||||
{
|
||||
private:
|
||||
void OGLFilterInit(GLsizei srcWidth, GLsizei srcHeight, GLfloat scale);
|
||||
|
||||
protected:
|
||||
OGLShaderProgram *_program;
|
||||
GLuint _texDstID;
|
||||
GLint _texCoordBuffer[8];
|
||||
|
||||
GLuint _fboID;
|
||||
GLuint _vaoID;
|
||||
GLuint _vboVtxID;
|
||||
GLuint _vboTexCoordID;
|
||||
GLuint _vboElementID;
|
||||
|
||||
GLfloat _scale;
|
||||
GLsizei _srcWidth;
|
||||
GLsizei _srcHeight;
|
||||
GLsizei _dstWidth;
|
||||
GLsizei _dstHeight;
|
||||
|
||||
public:
|
||||
OGLFilter();
|
||||
OGLFilter(GLsizei srcWidth, GLsizei srcHeight, GLfloat scale);
|
||||
virtual ~OGLFilter();
|
||||
static void GetSupport(int vfTypeID, bool *outSupportCPU, bool *outSupportShader);
|
||||
|
||||
OGLShaderProgram* GetProgram();
|
||||
GLuint GetDstTexID();
|
||||
GLsizei GetDstWidth();
|
||||
GLsizei GetDstHeight();
|
||||
void SetSrcSizeOGL(GLsizei w, GLsizei h);
|
||||
GLfloat GetScale();
|
||||
void SetScaleOGL(GLfloat scale);
|
||||
virtual GLuint RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight);
|
||||
void DownloadDstBufferOGL(uint32_t *dstBuffer, size_t lineOffset, size_t readLineCount);
|
||||
};
|
||||
|
||||
class OGLFilterDeposterize : public OGLFilter
|
||||
{
|
||||
protected:
|
||||
GLuint _texIntermediateID;
|
||||
|
||||
public:
|
||||
OGLFilterDeposterize(GLsizei srcWidth, GLsizei srcHeight);
|
||||
~OGLFilterDeposterize();
|
||||
|
||||
virtual GLuint RunFilterOGL(GLuint srcTexID, GLsizei viewportWidth, GLsizei viewportHeight);
|
||||
};
|
||||
|
||||
class OGLVideoLayer
|
||||
{
|
||||
protected:
|
||||
OGLVideoOutput *_output;
|
||||
GLsizei _viewportWidth;
|
||||
GLsizei _viewportHeight;
|
||||
|
||||
public:
|
||||
OGLVideoLayer() {};
|
||||
~OGLVideoLayer() {};
|
||||
|
||||
void SetViewportSizeOGL(GLsizei w, GLsizei h)
|
||||
{
|
||||
this->_viewportWidth = w;
|
||||
this->_viewportHeight = h;
|
||||
};
|
||||
|
||||
virtual void ProcessOGL(const uint16_t *videoData, GLsizei w, GLsizei h) {};
|
||||
virtual void RenderOGL() {};
|
||||
};
|
||||
|
||||
class OGLDisplayLayer : public OGLVideoLayer
|
||||
{
|
||||
protected:
|
||||
bool _canUseShaderBasedFilters;
|
||||
bool _canUseShaderOutput;
|
||||
|
||||
bool _needUploadVertices;
|
||||
bool _useDeposterize;
|
||||
bool _useShaderBasedPixelScaler;
|
||||
bool _filtersPreferGPU;
|
||||
int _outputFilter;
|
||||
int _pixelScaler;
|
||||
|
||||
OGLFilterDeposterize *_filterDeposterize;
|
||||
OGLFilter *_shaderFilter;
|
||||
OGLShaderProgram *_finalOutputProgram;
|
||||
|
||||
VideoFilter *_vfSingle;
|
||||
VideoFilter *_vfDual;
|
||||
VideoFilter *_vf;
|
||||
|
||||
bool _isShaderSupported;
|
||||
double _normalWidth;
|
||||
double _normalHeight;
|
||||
int _displayMode;
|
||||
int _displayOrder;
|
||||
int _displayOrientation;
|
||||
|
||||
GLint _displayTexFilter;
|
||||
GLsizei _viewportWidth;
|
||||
GLsizei _viewportHeight;
|
||||
double _normalWidth;
|
||||
double _normalHeight;
|
||||
GLfloat _gapScalar;
|
||||
GLfloat _rotation;
|
||||
|
||||
GLvoid *_glTexBack;
|
||||
GLint _displayTexFilter;
|
||||
GLuint _texCPUFilterDstID;
|
||||
GLsizei _glTexBackWidth;
|
||||
GLsizei _glTexBackHeight;
|
||||
|
||||
GLuint _displayTexID;
|
||||
GLint vtxBuffer[4 * 8];
|
||||
GLfloat texCoordBuffer[2 * 8];
|
||||
size_t _vtxBufferOffset;
|
||||
|
||||
GLuint _texInputVideoDataID;
|
||||
GLuint _texOutputVideoDataID;
|
||||
GLuint _texPrevOutputVideoDataID;
|
||||
GLuint _vaoMainStatesID;
|
||||
GLuint _vboVertexID;
|
||||
GLuint _vboTexCoordID;
|
||||
GLuint _vboElementID;
|
||||
GLuint _vaoMainStatesID;
|
||||
GLuint _vertexShaderID;
|
||||
GLuint _fragmentShaderID;
|
||||
GLuint _shaderProgram;
|
||||
|
||||
GLint _uniformAngleDegrees;
|
||||
GLint _uniformScalar;
|
||||
GLint _uniformViewSize;
|
||||
GLint _uniformFinalOutputAngleDegrees;
|
||||
GLint _uniformFinalOutputScalar;
|
||||
GLint _uniformFinalOutputViewSize;
|
||||
|
||||
GLint vtxBuffer[4 * 8];
|
||||
GLfloat texCoordBuffer[2 * 8];
|
||||
GLubyte vtxIndexBuffer[12];
|
||||
size_t _vtxBufferOffset;
|
||||
virtual void UploadVerticesOGL();
|
||||
virtual void UploadTexCoordsOGL();
|
||||
virtual void UploadTransformationOGL();
|
||||
|
||||
void CalculateDisplayNormalSize(double *w, double *h);
|
||||
void UpdateVertices();
|
||||
void UpdateTexCoords(GLfloat s, GLfloat t);
|
||||
|
||||
void GetExtensionSetOGL(std::set<std::string> *oglExtensionSet);
|
||||
bool IsExtensionPresent(const std::set<std::string> &oglExtensionSet, const std::string &extensionName) const;
|
||||
bool SetupShadersOGL(const char *vertexProgram, const char *fragmentProgram);
|
||||
void SetupShaderIO_OGL();
|
||||
public:
|
||||
OGLDisplayLayer(OGLVideoOutput *oglVO);
|
||||
~OGLDisplayLayer();
|
||||
|
||||
bool GetFiltersPreferGPU();
|
||||
void SetFiltersPreferGPUOGL(bool preferGPU);
|
||||
|
||||
int GetMode();
|
||||
void SetMode(int dispMode);
|
||||
int GetOrientation();
|
||||
void SetOrientation(int dispOrientation);
|
||||
int GetOrder();
|
||||
void SetOrder(int dispOrder);
|
||||
GLfloat GetGapScalar();
|
||||
void SetGapScalar(GLfloat theScalar);
|
||||
GLfloat GetRotation();
|
||||
void SetRotation(GLfloat theRotation);
|
||||
bool GetBilinear();
|
||||
void SetBilinear(bool useBilinear);
|
||||
bool GetSourceDeposterize();
|
||||
void SetSourceDeposterize(bool useDeposterize);
|
||||
|
||||
bool CanUseShaderBasedFilters();
|
||||
void GetNormalSize(double *w, double *h);
|
||||
|
||||
int GetOutputFilter();
|
||||
virtual void SetOutputFilterOGL(const int filterID);
|
||||
int GetPixelScaler();
|
||||
virtual void SetPixelScalerOGL(const int filterID);
|
||||
virtual void SetCPUFilterOGL(const VideoFilterTypeID videoFilterTypeID);
|
||||
virtual void ProcessOGL(const uint16_t *videoData, GLsizei w, GLsizei h);
|
||||
virtual void RenderOGL();
|
||||
};
|
||||
|
||||
class OGLVideoOutput
|
||||
{
|
||||
protected:
|
||||
OGLInfo *_info;
|
||||
GLsizei _viewportWidth;
|
||||
GLsizei _viewportHeight;
|
||||
std::vector<OGLVideoLayer *> *_layerList;
|
||||
|
||||
public:
|
||||
OGLVideoOutput();
|
||||
~OGLVideoOutput();
|
||||
|
||||
virtual void InitializeOGL();
|
||||
virtual void TerminateOGL();
|
||||
|
||||
virtual void UploadVerticesOGL();
|
||||
virtual void UploadTexCoordsOGL();
|
||||
virtual void UploadDisplayTextureOGL(const GLvoid *textureData, const GLenum texPixelFormat, const GLenum texPixelType, GLsizei texWidth, GLsizei texHeight);
|
||||
|
||||
virtual void PrerenderOGL(const GLvoid *textureData, GLsizei texWidth, GLsizei texHeight);
|
||||
virtual void InitLayers();
|
||||
virtual OGLInfo* GetInfo();
|
||||
virtual GLsizei GetViewportWidth();
|
||||
virtual GLsizei GetViewportHeight();
|
||||
OGLDisplayLayer* GetDisplayLayer();
|
||||
|
||||
virtual void ProcessOGL(const uint16_t *videoData, GLsizei w, GLsizei h);
|
||||
virtual void RenderOGL();
|
||||
virtual void SetViewportSizeOGL(GLsizei w, GLsizei h);
|
||||
virtual void UpdateDisplayTransformationOGL();
|
||||
virtual void SetVideoFilterOGL(const VideoFilterTypeID videoFilterTypeID);
|
||||
|
||||
int GetDisplayMode();
|
||||
void SetDisplayMode(int dispMode);
|
||||
int GetDisplayOrientation();
|
||||
void SetDisplayOrientation(int dispOrientation);
|
||||
GLfloat GetGapScalar();
|
||||
void SetGapScalar(GLfloat theScalar);
|
||||
GLfloat GetRotation();
|
||||
void SetRotation(GLfloat theRotation);
|
||||
bool GetDisplayBilinear();
|
||||
void SetDisplayBilinearOGL(bool useBilinear);
|
||||
int GetDisplayOrder();
|
||||
void SetDisplayOrder(int dispOrder);
|
||||
};
|
||||
|
||||
#endif // _OGLDISPLAYOUTPUT_H_
|
||||
|
|
|
@ -423,12 +423,12 @@ enum
|
|||
MESSAGE_RESIZE_VIEW,
|
||||
MESSAGE_TRANSFORM_VIEW,
|
||||
MESSAGE_REDRAW_VIEW,
|
||||
MESSAGE_REPROCESS_AND_REDRAW,
|
||||
MESSAGE_SET_GPU_STATE_FLAGS,
|
||||
MESSAGE_CHANGE_DISPLAY_TYPE,
|
||||
MESSAGE_CHANGE_DISPLAY_ORIENTATION,
|
||||
MESSAGE_CHANGE_DISPLAY_ORDER,
|
||||
MESSAGE_CHANGE_DISPLAY_GAP,
|
||||
MESSAGE_CHANGE_VIDEO_FILTER,
|
||||
MESSAGE_SET_RENDER3D_METHOD,
|
||||
MESSAGE_SET_RENDER3D_HIGH_PRECISION_COLOR_INTERPOLATION,
|
||||
MESSAGE_SET_RENDER3D_EDGE_MARKING,
|
||||
|
|
|
@ -135,9 +135,6 @@ typedef struct
|
|||
- (void) doDisplayOrientationChanged:(NSInteger)displayOrientationID;
|
||||
- (void) doDisplayOrderChanged:(NSInteger)displayOrderID;
|
||||
- (void) doDisplayGapChanged:(float)displayGapScalar;
|
||||
- (void) doBilinearOutputChanged:(BOOL)useBilinear;
|
||||
- (void) doVerticalSyncChanged:(BOOL)useVerticalSync;
|
||||
- (void) doVideoFilterChanged:(NSInteger)videoFilterTypeID;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -176,9 +173,9 @@ typedef struct
|
|||
- (void) handleResizeView:(NSData *)rectData;
|
||||
- (void) handleTransformView:(NSData *)transformData;
|
||||
- (void) handleRedrawView;
|
||||
- (void) handleReprocessAndRedraw;
|
||||
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData;
|
||||
- (void) handleChangeDisplayOrder:(NSData *)displayOrderIdData;
|
||||
- (void) handleChangeDisplayGap:(NSData *)displayGapScalarData;
|
||||
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData;
|
||||
|
||||
@end
|
||||
|
|
|
@ -858,6 +858,10 @@
|
|||
[self handleEmuFrameProcessed:[messageComponents objectAtIndex:0] attributes:[messageComponents objectAtIndex:1]];
|
||||
break;
|
||||
|
||||
case MESSAGE_REPROCESS_AND_REDRAW:
|
||||
[self handleReprocessAndRedraw];
|
||||
break;
|
||||
|
||||
case MESSAGE_RESIZE_VIEW:
|
||||
[self handleResizeView:[messageComponents objectAtIndex:0]];
|
||||
break;
|
||||
|
@ -882,10 +886,6 @@
|
|||
[self handleChangeDisplayGap:[messageComponents objectAtIndex:0]];
|
||||
break;
|
||||
|
||||
case MESSAGE_CHANGE_VIDEO_FILTER:
|
||||
[self handleChangeVideoFilter:[messageComponents objectAtIndex:0]];
|
||||
break;
|
||||
|
||||
default:
|
||||
[super handlePortMessage:portMessage];
|
||||
break;
|
||||
|
@ -939,6 +939,11 @@
|
|||
[(id<CocoaDSDisplayVideoDelegate>)delegate doRedraw];
|
||||
}
|
||||
|
||||
- (void) handleReprocessAndRedraw
|
||||
{
|
||||
[self handleEmuFrameProcessed:self.frameData attributes:self.frameAttributesData];
|
||||
}
|
||||
|
||||
- (void) handleChangeDisplayOrientation:(NSData *)displayOrientationIdData
|
||||
{
|
||||
if (delegate == nil || ![delegate respondsToSelector:@selector(doDisplayOrientationChanged:)])
|
||||
|
@ -972,16 +977,4 @@
|
|||
[(id<CocoaDSDisplayVideoDelegate>)delegate doDisplayGapChanged:gapScalar];
|
||||
}
|
||||
|
||||
- (void) handleChangeVideoFilter:(NSData *)videoFilterTypeIdData
|
||||
{
|
||||
if (delegate == nil || ![delegate respondsToSelector:@selector(doVideoFilterChanged:)])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const NSInteger theType = *(NSInteger *)[videoFilterTypeIdData bytes];
|
||||
[(id<CocoaDSDisplayVideoDelegate>)delegate doVideoFilterChanged:theType];
|
||||
[self handleEmuFrameProcessed:self.frameData attributes:self.frameAttributesData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -37,6 +37,15 @@ class OGLVideoOutput;
|
|||
InputManager *inputManager;
|
||||
OGLVideoOutput *oglv;
|
||||
CGFloat _displayRotation;
|
||||
BOOL canUseShaderBasedFilters;
|
||||
|
||||
BOOL _useVerticalSync;
|
||||
|
||||
OSSpinLock spinlockUseVerticalSync;
|
||||
OSSpinLock spinlockVideoFiltersPreferGPU;
|
||||
OSSpinLock spinlockOutputFilter;
|
||||
OSSpinLock spinlockSourceDeposterize;
|
||||
OSSpinLock spinlockPixelScaler;
|
||||
|
||||
// OpenGL context
|
||||
NSOpenGLContext *context;
|
||||
|
@ -44,6 +53,12 @@ class OGLVideoOutput;
|
|||
}
|
||||
|
||||
@property (retain) InputManager *inputManager;
|
||||
@property (readonly) BOOL canUseShaderBasedFilters;
|
||||
@property (assign) BOOL useVerticalSync;
|
||||
@property (assign) BOOL videoFiltersPreferGPU;
|
||||
@property (assign) BOOL sourceDeposterize;
|
||||
@property (assign) NSInteger outputFilter;
|
||||
@property (assign) NSInteger pixelScaler;
|
||||
|
||||
- (void) drawVideoFrame;
|
||||
- (NSPoint) dsPointFromEvent:(NSEvent *)theEvent;
|
||||
|
@ -75,13 +90,10 @@ class OGLVideoOutput;
|
|||
NSSize _normalSize;
|
||||
double _displayScale;
|
||||
double _displayRotation;
|
||||
BOOL _useBilinearOutput;
|
||||
BOOL _useVerticalSync;
|
||||
NSInteger _displayMode;
|
||||
NSInteger _displayOrientation;
|
||||
NSInteger _displayOrder;
|
||||
double _displayGap;
|
||||
NSInteger _videoFilterType;
|
||||
NSInteger screenshotFileFormat;
|
||||
|
||||
NSSize _minDisplayViewSize;
|
||||
|
@ -92,13 +104,10 @@ class OGLVideoOutput;
|
|||
OSSpinLock spinlockNormalSize;
|
||||
OSSpinLock spinlockScale;
|
||||
OSSpinLock spinlockRotation;
|
||||
OSSpinLock spinlockUseBilinearOutput;
|
||||
OSSpinLock spinlockUseVerticalSync;
|
||||
OSSpinLock spinlockDisplayMode;
|
||||
OSSpinLock spinlockDisplayOrientation;
|
||||
OSSpinLock spinlockDisplayOrder;
|
||||
OSSpinLock spinlockDisplayGap;
|
||||
OSSpinLock spinlockVideoFilterType;
|
||||
}
|
||||
|
||||
@property (readonly) IBOutlet NSObject *dummyObject;
|
||||
|
@ -114,13 +123,14 @@ class OGLVideoOutput;
|
|||
@property (readonly) NSSize normalSize;
|
||||
@property (assign) double displayScale;
|
||||
@property (assign) double displayRotation;
|
||||
@property (assign) BOOL useBilinearOutput;
|
||||
@property (assign) BOOL useVerticalSync;
|
||||
@property (assign) BOOL videoFiltersPreferGPU;
|
||||
@property (assign) BOOL videoSourceDeposterize;
|
||||
@property (assign) NSInteger videoOutputFilter;
|
||||
@property (assign) NSInteger videoPixelScaler;
|
||||
@property (assign) NSInteger displayMode;
|
||||
@property (assign) NSInteger displayOrientation;
|
||||
@property (assign) NSInteger displayOrder;
|
||||
@property (assign) double displayGap;
|
||||
@property (assign) NSInteger videoFilterType;
|
||||
@property (assign) NSInteger screenshotFileFormat;
|
||||
@property (assign) BOOL isMinSizeNormal;
|
||||
@property (assign) BOOL isShowingStatusBar;
|
||||
|
@ -153,9 +163,9 @@ class OGLVideoOutput;
|
|||
- (IBAction) changeDisplayOrientation:(id)sender;
|
||||
- (IBAction) changeDisplayOrder:(id)sender;
|
||||
- (IBAction) changeDisplayGap:(id)sender;
|
||||
- (IBAction) toggleBilinearFilteredOutput:(id)sender;
|
||||
- (IBAction) toggleVerticalSync:(id)sender;
|
||||
- (IBAction) changeVideoFilter:(id)sender;
|
||||
- (IBAction) toggleVideoSourceDeposterize:(id)sender;
|
||||
- (IBAction) changeVideoOutputFilter:(id)sender;
|
||||
- (IBAction) changeVideoPixelScaler:(id)sender;
|
||||
|
||||
- (IBAction) writeDefaultsDisplayRotation:(id)sender;
|
||||
- (IBAction) writeDefaultsDisplayGap:(id)sender;
|
||||
|
|
|
@ -48,13 +48,14 @@
|
|||
@dynamic normalSize;
|
||||
@dynamic displayScale;
|
||||
@dynamic displayRotation;
|
||||
@dynamic useBilinearOutput;
|
||||
@dynamic useVerticalSync;
|
||||
@dynamic videoFiltersPreferGPU;
|
||||
@dynamic videoSourceDeposterize;
|
||||
@dynamic videoOutputFilter;
|
||||
@dynamic videoPixelScaler;
|
||||
@dynamic displayMode;
|
||||
@dynamic displayOrientation;
|
||||
@dynamic displayOrder;
|
||||
@dynamic displayGap;
|
||||
@dynamic videoFilterType;
|
||||
@synthesize screenshotFileFormat;
|
||||
@dynamic isMinSizeNormal;
|
||||
@dynamic isShowingStatusBar;
|
||||
|
@ -81,13 +82,10 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
spinlockNormalSize = OS_SPINLOCK_INIT;
|
||||
spinlockScale = OS_SPINLOCK_INIT;
|
||||
spinlockRotation = OS_SPINLOCK_INIT;
|
||||
spinlockUseBilinearOutput = OS_SPINLOCK_INIT;
|
||||
spinlockUseVerticalSync = OS_SPINLOCK_INIT;
|
||||
spinlockDisplayMode = OS_SPINLOCK_INIT;
|
||||
spinlockDisplayOrientation = OS_SPINLOCK_INIT;
|
||||
spinlockDisplayOrder = OS_SPINLOCK_INIT;
|
||||
spinlockDisplayGap = OS_SPINLOCK_INIT;
|
||||
spinlockVideoFilterType = OS_SPINLOCK_INIT;
|
||||
|
||||
screenshotFileFormat = NSTIFFFileType;
|
||||
|
||||
|
@ -224,42 +222,6 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
return angleDegrees;
|
||||
}
|
||||
|
||||
- (void) setUseBilinearOutput:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseBilinearOutput);
|
||||
_useBilinearOutput = theState;
|
||||
OSSpinLockUnlock(&spinlockUseBilinearOutput);
|
||||
|
||||
[[self view] doBilinearOutputChanged:theState];
|
||||
}
|
||||
|
||||
- (BOOL) useBilinearOutput
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseBilinearOutput);
|
||||
const BOOL theState = _useBilinearOutput;
|
||||
OSSpinLockUnlock(&spinlockUseBilinearOutput);
|
||||
|
||||
return theState;
|
||||
}
|
||||
|
||||
- (void) setUseVerticalSync:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseVerticalSync);
|
||||
_useVerticalSync = theState;
|
||||
OSSpinLockUnlock(&spinlockUseVerticalSync);
|
||||
|
||||
[[self view] doVerticalSyncChanged:theState];
|
||||
}
|
||||
|
||||
- (BOOL) useVerticalSync
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseVerticalSync);
|
||||
const BOOL theState = _useVerticalSync;
|
||||
OSSpinLockUnlock(&spinlockUseVerticalSync);
|
||||
|
||||
return theState;
|
||||
}
|
||||
|
||||
- (void) setDisplayMode:(NSInteger)displayModeID
|
||||
{
|
||||
NSSize newDisplaySize = NSMakeSize(GPU_DISPLAY_WIDTH, GPU_DISPLAY_HEIGHT);
|
||||
|
@ -416,22 +378,48 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
return gapScalar;
|
||||
}
|
||||
|
||||
- (void) setVideoFilterType:(NSInteger)typeID
|
||||
- (void) setVideoFiltersPreferGPU:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFilterType);
|
||||
_videoFilterType = typeID;
|
||||
OSSpinLockUnlock(&spinlockVideoFilterType);
|
||||
|
||||
[CocoaDSUtil messageSendOneWayWithInteger:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_CHANGE_VIDEO_FILTER integerValue:typeID];
|
||||
[[self view] setVideoFiltersPreferGPU:theState];
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (NSInteger) videoFilterType
|
||||
- (BOOL) videoFiltersPreferGPU
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFilterType);
|
||||
const NSInteger typeID = _videoFilterType;
|
||||
OSSpinLockUnlock(&spinlockVideoFilterType);
|
||||
|
||||
return typeID;
|
||||
return [[self view] videoFiltersPreferGPU];
|
||||
}
|
||||
|
||||
- (void) setVideoSourceDeposterize:(BOOL)theState
|
||||
{
|
||||
[[self view] setSourceDeposterize:theState];
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (BOOL) videoSourceDeposterize
|
||||
{
|
||||
return [[self view] sourceDeposterize];
|
||||
}
|
||||
|
||||
- (void) setVideoOutputFilter:(NSInteger)filterID
|
||||
{
|
||||
[[self view] setOutputFilter:filterID];
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (NSInteger) videoOutputFilter
|
||||
{
|
||||
return [[self view] outputFilter];
|
||||
}
|
||||
|
||||
- (void) setVideoPixelScaler:(NSInteger)filterID
|
||||
{
|
||||
[[self view] setPixelScaler:filterID];
|
||||
[CocoaDSUtil messageSendOneWay:[[self cdsVideoOutput] receivePort] msgID:MESSAGE_REPROCESS_AND_REDRAW];
|
||||
}
|
||||
|
||||
- (NSInteger) videoPixelScaler
|
||||
{
|
||||
return [[self view] pixelScaler];
|
||||
}
|
||||
|
||||
- (void) setIsMinSizeNormal:(BOOL)theState
|
||||
|
@ -533,9 +521,11 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
[self setDisplayOrder:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayViewCombo_Order"]];
|
||||
[self setDisplayScale:([[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Size"] / 100.0)];
|
||||
[self setDisplayRotation:[[NSUserDefaults standardUserDefaults] doubleForKey:@"DisplayView_Rotation"]];
|
||||
[self setVideoFilterType:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"]];
|
||||
[self setUseBilinearOutput:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseBilinearOutput"]];
|
||||
[self setUseVerticalSync:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseVerticalSync"]];
|
||||
[self setVideoFiltersPreferGPU:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_FiltersPreferGPU"]];
|
||||
[self setVideoSourceDeposterize:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_Deposterize"]];
|
||||
[self setVideoOutputFilter:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"]];
|
||||
[self setVideoPixelScaler:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_VideoFilter"]];
|
||||
[[self view] setUseVerticalSync:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseVerticalSync"]];
|
||||
}
|
||||
|
||||
- (double) resizeWithTransform:(NSSize)normalBounds scalar:(double)scalar rotation:(double)angleDegrees
|
||||
|
@ -861,19 +851,19 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
[self setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
|
||||
}
|
||||
|
||||
- (IBAction) toggleBilinearFilteredOutput:(id)sender
|
||||
- (IBAction) toggleVideoSourceDeposterize:(id)sender
|
||||
{
|
||||
[self setUseBilinearOutput:([self useBilinearOutput]) ? NO : YES];
|
||||
[self setVideoSourceDeposterize:![self videoSourceDeposterize]];
|
||||
}
|
||||
|
||||
- (IBAction) toggleVerticalSync:(id)sender
|
||||
- (IBAction) changeVideoOutputFilter:(id)sender
|
||||
{
|
||||
[self setUseVerticalSync:([self useVerticalSync]) ? NO : YES];
|
||||
[self setVideoOutputFilter:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||
}
|
||||
|
||||
- (IBAction) changeVideoFilter:(id)sender
|
||||
- (IBAction) changeVideoPixelScaler:(id)sender
|
||||
{
|
||||
[self setVideoFilterType:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||
[self setVideoPixelScaler:[CocoaDSUtil getIBActionSenderTag:sender]];
|
||||
}
|
||||
|
||||
- (IBAction) writeDefaultsDisplayRotation:(id)sender
|
||||
|
@ -893,9 +883,11 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
|
||||
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self videoFilterType] forKey:@"DisplayView_VideoFilter"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self useBilinearOutput] forKey:@"DisplayView_UseBilinearOutput"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self useVerticalSync] forKey:@"DisplayView_UseVerticalSync"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self videoFiltersPreferGPU] forKey:@"DisplayView_FiltersPreferGPU"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[self videoSourceDeposterize] forKey:@"DisplayView_Deposterize"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self videoOutputFilter] forKey:@"DisplayView_OutputFilter"];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:[self videoPixelScaler] forKey:@"DisplayView_VideoFilter"];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:[[self view] useVerticalSync] forKey:@"DisplayView_UseVerticalSync"];
|
||||
}
|
||||
|
||||
#pragma mark NSUserInterfaceValidations Protocol
|
||||
|
@ -991,25 +983,42 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(toggleBilinearFilteredOutput:))
|
||||
else if (theAction == @selector(changeVideoOutputFilter:))
|
||||
{
|
||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||
{
|
||||
[(NSMenuItem *)theItem setState:([self useBilinearOutput]) ? NSOnState : NSOffState];
|
||||
[(NSMenuItem *)theItem setState:([self videoOutputFilter] == [theItem tag]) ? NSOnState : NSOffState];
|
||||
enable = ([theItem tag] == OutputFilterTypeID_NearestNeighbor || [theItem tag] == OutputFilterTypeID_Bilinear) || [[self view] canUseShaderBasedFilters];
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(toggleVideoSourceDeposterize:))
|
||||
{
|
||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||
{
|
||||
[(NSMenuItem *)theItem setState:([self videoSourceDeposterize]) ? NSOnState : NSOffState];
|
||||
enable = [[self view] canUseShaderBasedFilters];
|
||||
}
|
||||
|
||||
enable = [[self view] canUseShaderBasedFilters];
|
||||
}
|
||||
else if (theAction == @selector(toggleVerticalSync:))
|
||||
{
|
||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||
{
|
||||
[(NSMenuItem *)theItem setState:([self useVerticalSync]) ? NSOnState : NSOffState];
|
||||
[(NSMenuItem *)theItem setState:([[self view] useVerticalSync]) ? NSOnState : NSOffState];
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(changeVideoFilter:))
|
||||
else if (theAction == @selector(changeVideoPixelScaler:))
|
||||
{
|
||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||
{
|
||||
[(NSMenuItem *)theItem setState:([self videoFilterType] == [theItem tag]) ? NSOnState : NSOffState];
|
||||
[(NSMenuItem *)theItem setState:([self videoPixelScaler] == [theItem tag]) ? NSOnState : NSOffState];
|
||||
|
||||
bool isSupportingCPU = false;
|
||||
bool isSupportingShader = false;
|
||||
OGLFilter::GetSupport([theItem tag], &isSupportingCPU, &isSupportingShader);
|
||||
|
||||
enable = isSupportingCPU || (isSupportingShader && [[self view] canUseShaderBasedFilters]);
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(toggleStatusBar:))
|
||||
|
@ -1079,10 +1088,6 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
// Setup default values per user preferences.
|
||||
[self setupUserDefaults];
|
||||
|
||||
// Set the video filter source size now since the proper size is needed on initialization.
|
||||
// If we don't do this, new windows could draw incorrectly.
|
||||
[CocoaDSUtil messageSendOneWayWithInteger:[cdsVideoOutput receivePort] msgID:MESSAGE_CHANGE_VIDEO_FILTER integerValue:[self videoFilterType]];
|
||||
|
||||
// Add the video thread to the output list.
|
||||
[emuControl addOutputToCore:cdsVideoOutput];
|
||||
}
|
||||
|
@ -1257,6 +1262,12 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
@implementation DisplayView
|
||||
|
||||
@synthesize inputManager;
|
||||
@synthesize canUseShaderBasedFilters;
|
||||
@dynamic useVerticalSync;
|
||||
@dynamic videoFiltersPreferGPU;
|
||||
@dynamic sourceDeposterize;
|
||||
@dynamic outputFilter;
|
||||
@dynamic pixelScaler;
|
||||
|
||||
- (id)initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
|
@ -1267,7 +1278,6 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
}
|
||||
|
||||
inputManager = nil;
|
||||
oglv = new OGLVideoOutput();
|
||||
|
||||
// Initialize the OpenGL context
|
||||
NSOpenGLPixelFormatAttribute attributes[] = {
|
||||
|
@ -1285,9 +1295,25 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
|
||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->InitializeOGL();
|
||||
oglv = new OGLVideoOutput();
|
||||
oglv->InitLayers();
|
||||
oglv->GetDisplayLayer()->SetFiltersPreferGPUOGL(true);
|
||||
oglv->GetDisplayLayer()->SetSourceDeposterize(false);
|
||||
oglv->GetDisplayLayer()->SetOutputFilterOGL(OutputFilterTypeID_Bilinear);
|
||||
oglv->GetDisplayLayer()->SetPixelScalerOGL(VideoFilterTypeID_None);
|
||||
CGLSetCurrentContext(prevContext);
|
||||
|
||||
OGLDisplayLayer *displayLayer = oglv->GetDisplayLayer();
|
||||
canUseShaderBasedFilters = (displayLayer->CanUseShaderBasedFilters()) ? YES : NO;
|
||||
|
||||
_useVerticalSync = NO;
|
||||
|
||||
spinlockUseVerticalSync = OS_SPINLOCK_INIT;
|
||||
spinlockVideoFiltersPreferGPU = OS_SPINLOCK_INIT;
|
||||
spinlockOutputFilter = OS_SPINLOCK_INIT;
|
||||
spinlockSourceDeposterize = OS_SPINLOCK_INIT;
|
||||
spinlockPixelScaler = OS_SPINLOCK_INIT;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1295,18 +1321,120 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
{
|
||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->TerminateOGL();
|
||||
delete oglv;
|
||||
CGLSetCurrentContext(prevContext);
|
||||
|
||||
[self setInputManager:nil];
|
||||
[context clearDrawable];
|
||||
[context release];
|
||||
|
||||
delete oglv;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark Dynamic Property Methods
|
||||
|
||||
- (void) setUseVerticalSync:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseVerticalSync);
|
||||
_useVerticalSync = theState;
|
||||
OSSpinLockUnlock(&spinlockUseVerticalSync);
|
||||
|
||||
const GLint swapInt = (theState) ? 1 : 0;
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
CGLSetParameter(cglDisplayContext, kCGLCPSwapInterval, &swapInt);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (BOOL) useVerticalSync
|
||||
{
|
||||
OSSpinLockLock(&spinlockUseVerticalSync);
|
||||
const BOOL theState = _useVerticalSync;
|
||||
OSSpinLockUnlock(&spinlockUseVerticalSync);
|
||||
|
||||
return theState;
|
||||
}
|
||||
|
||||
- (void) setVideoFiltersPreferGPU:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFiltersPreferGPU);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->GetDisplayLayer()->SetFiltersPreferGPUOGL((theState) ? true : false);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
|
||||
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU);
|
||||
}
|
||||
|
||||
- (BOOL) videoFiltersPreferGPU
|
||||
{
|
||||
OSSpinLockLock(&spinlockVideoFiltersPreferGPU);
|
||||
const BOOL theState = (oglv->GetDisplayLayer()->GetFiltersPreferGPU()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockVideoFiltersPreferGPU);
|
||||
|
||||
return theState;
|
||||
}
|
||||
|
||||
- (void) setSourceDeposterize:(BOOL)theState
|
||||
{
|
||||
OSSpinLockLock(&spinlockSourceDeposterize);
|
||||
oglv->GetDisplayLayer()->SetSourceDeposterize((theState) ? true : false);
|
||||
OSSpinLockUnlock(&spinlockSourceDeposterize);
|
||||
}
|
||||
|
||||
- (BOOL) sourceDeposterize
|
||||
{
|
||||
OSSpinLockLock(&spinlockSourceDeposterize);
|
||||
const BOOL theState = (oglv->GetDisplayLayer()->GetSourceDeposterize()) ? YES : NO;
|
||||
OSSpinLockUnlock(&spinlockSourceDeposterize);
|
||||
|
||||
return theState;
|
||||
}
|
||||
|
||||
- (void) setOutputFilter:(NSInteger)filterID
|
||||
{
|
||||
OSSpinLockLock(&spinlockOutputFilter);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->GetDisplayLayer()->SetOutputFilterOGL(filterID);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
|
||||
OSSpinLockUnlock(&spinlockOutputFilter);
|
||||
}
|
||||
|
||||
- (NSInteger) outputFilter
|
||||
{
|
||||
OSSpinLockLock(&spinlockOutputFilter);
|
||||
const NSInteger filterID = oglv->GetDisplayLayer()->GetOutputFilter();
|
||||
OSSpinLockUnlock(&spinlockOutputFilter);
|
||||
|
||||
return filterID;
|
||||
}
|
||||
|
||||
- (void) setPixelScaler:(NSInteger)filterID
|
||||
{
|
||||
OSSpinLockLock(&spinlockPixelScaler);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->GetDisplayLayer()->SetPixelScalerOGL(filterID);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
|
||||
OSSpinLockUnlock(&spinlockPixelScaler);
|
||||
}
|
||||
|
||||
- (NSInteger) pixelScaler
|
||||
{
|
||||
OSSpinLockLock(&spinlockPixelScaler);
|
||||
const NSInteger filterID = oglv->GetDisplayLayer()->GetPixelScaler();
|
||||
OSSpinLockUnlock(&spinlockPixelScaler);
|
||||
|
||||
return filterID;
|
||||
}
|
||||
|
||||
#pragma mark Class Methods
|
||||
|
||||
- (void) drawVideoFrame
|
||||
|
@ -1645,31 +1773,28 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
|
||||
- (void)doProcessVideoFrame:(const void *)videoFrameData displayMode:(const NSInteger)frameDisplayMode width:(const NSInteger)frameWidth height:(const NSInteger)frameHeight
|
||||
{
|
||||
const bool didDisplayModeChange = (oglv->GetDisplayMode() != frameDisplayMode);
|
||||
if (didDisplayModeChange)
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
|
||||
if (display->GetMode() != frameDisplayMode)
|
||||
{
|
||||
oglv->SetDisplayMode(frameDisplayMode);
|
||||
display->SetMode(frameDisplayMode);
|
||||
}
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
|
||||
if (didDisplayModeChange)
|
||||
{
|
||||
oglv->UploadVerticesOGL();
|
||||
}
|
||||
|
||||
oglv->PrerenderOGL(videoFrameData, frameWidth, frameHeight);
|
||||
oglv->ProcessOGL((uint16_t *)videoFrameData, frameWidth, frameHeight);
|
||||
[self drawVideoFrame];
|
||||
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doResizeView:(NSRect)rect
|
||||
{
|
||||
const GLsizei w = (GLsizei)rect.size.width;
|
||||
const GLsizei h = (GLsizei)rect.size.height;
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->SetViewportSizeOGL(rect.size.width, rect.size.height);
|
||||
oglv->SetViewportSizeOGL(w, h);
|
||||
[self drawVideoFrame];
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
@ -1677,13 +1802,10 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
- (void)doTransformView:(const DisplayOutputTransformData *)transformData
|
||||
{
|
||||
_displayRotation = (GLfloat)transformData->rotation;
|
||||
oglv->SetRotation((GLfloat)transformData->rotation);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->UpdateDisplayTransformationOGL();
|
||||
[self drawVideoFrame];
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
display->SetRotation((GLfloat)transformData->rotation);
|
||||
[self doRedraw];
|
||||
}
|
||||
|
||||
- (void)doRedraw
|
||||
|
@ -1696,95 +1818,42 @@ static std::tr1::unordered_map<NSScreen *, DisplayWindowController *> _screenMap
|
|||
|
||||
- (void)doDisplayModeChanged:(NSInteger)displayModeID
|
||||
{
|
||||
oglv->SetDisplayMode(displayModeID);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->UpdateDisplayTransformationOGL();
|
||||
oglv->UploadVerticesOGL();
|
||||
[self drawVideoFrame];
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doBilinearOutputChanged:(BOOL)useBilinear
|
||||
{
|
||||
const bool c99_useBilinear = (useBilinear) ? true : false;
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->SetDisplayBilinearOGL(c99_useBilinear);
|
||||
[self drawVideoFrame];
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
display->SetMode(displayModeID);
|
||||
[self doRedraw];
|
||||
}
|
||||
|
||||
- (void)doDisplayOrientationChanged:(NSInteger)displayOrientationID
|
||||
{
|
||||
oglv->SetDisplayOrientation(displayOrientationID);
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
display->SetOrientation(displayOrientationID);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
|
||||
oglv->UploadVerticesOGL();
|
||||
|
||||
if (oglv->GetDisplayMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
if (display->GetMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
{
|
||||
oglv->UpdateDisplayTransformationOGL();
|
||||
[self drawVideoFrame];
|
||||
[self doRedraw];
|
||||
}
|
||||
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doDisplayOrderChanged:(NSInteger)displayOrderID
|
||||
{
|
||||
oglv->SetDisplayOrder(displayOrderID);
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
display->SetOrder(displayOrderID);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
|
||||
oglv->UploadVerticesOGL();
|
||||
if (oglv->GetDisplayMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
if (display->GetMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
{
|
||||
[self drawVideoFrame];
|
||||
[self doRedraw];
|
||||
}
|
||||
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doDisplayGapChanged:(float)displayGapScalar
|
||||
{
|
||||
oglv->SetGapScalar((GLfloat)displayGapScalar);
|
||||
OGLDisplayLayer *display = oglv->GetDisplayLayer();
|
||||
display->SetGapScalar((GLfloat)displayGapScalar);
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
|
||||
oglv->UploadVerticesOGL();
|
||||
|
||||
if (oglv->GetDisplayMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
if (display->GetMode() == DS_DISPLAY_TYPE_DUAL)
|
||||
{
|
||||
oglv->UpdateDisplayTransformationOGL();
|
||||
[self drawVideoFrame];
|
||||
[self doRedraw];
|
||||
}
|
||||
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doVerticalSyncChanged:(BOOL)useVerticalSync
|
||||
{
|
||||
const GLint swapInt = (useVerticalSync) ? 1 : 0;
|
||||
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
CGLSetParameter(cglDisplayContext, kCGLCPSwapInterval, &swapInt);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
- (void)doVideoFilterChanged:(NSInteger)videoFilterTypeID
|
||||
{
|
||||
CGLLockContext(cglDisplayContext);
|
||||
CGLSetCurrentContext(cglDisplayContext);
|
||||
oglv->SetVideoFilterOGL((const VideoFilterTypeID)videoFilterTypeID);
|
||||
CGLUnlockContext(cglDisplayContext);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -606,9 +606,11 @@
|
|||
const NSInteger displayOrientation = [(NSNumber *)[windowProperties valueForKey:@"displayOrientation"] integerValue];
|
||||
const NSInteger displayOrder = [(NSNumber *)[windowProperties valueForKey:@"displayOrder"] integerValue];
|
||||
const double displayGap = [(NSNumber *)[windowProperties valueForKey:@"displayGap"] doubleValue];
|
||||
const NSInteger videoFilterType = [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue];
|
||||
const BOOL videoFiltersPreferGPU = [(NSNumber *)[windowProperties valueForKey:@"videoFiltersPreferGPU"] boolValue];
|
||||
const BOOL videoSourceDeposterize = [(NSNumber *)[windowProperties valueForKey:@"videoSourceDeposterize"] boolValue];
|
||||
const NSInteger videoPixelScaler = [(NSNumber *)[windowProperties valueForKey:@"videoFilterType"] integerValue];
|
||||
const NSInteger videoOutputFilter = [(NSNumber *)[windowProperties valueForKey:@"videoOutputFilter"] integerValue];
|
||||
const NSInteger screenshotFileFormat = [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue];
|
||||
const BOOL useBilinearOutput = [(NSNumber *)[windowProperties valueForKey:@"useBilinearOutput"] boolValue];
|
||||
const BOOL useVerticalSync = [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue];
|
||||
const BOOL isMinSizeNormal = [(NSNumber *)[windowProperties valueForKey:@"isMinSizeNormal"] boolValue];
|
||||
const BOOL isShowingStatusBar = [(NSNumber *)[windowProperties valueForKey:@"isShowingStatusBar"] boolValue];
|
||||
|
@ -625,15 +627,17 @@
|
|||
|
||||
[windowController setIsMinSizeNormal:isMinSizeNormal];
|
||||
[windowController setIsShowingStatusBar:isShowingStatusBar];
|
||||
[windowController setVideoFilterType:videoFilterType];
|
||||
[windowController setVideoFiltersPreferGPU:videoFiltersPreferGPU];
|
||||
[windowController setVideoSourceDeposterize:videoSourceDeposterize];
|
||||
[windowController setVideoPixelScaler:videoPixelScaler];
|
||||
[windowController setVideoOutputFilter:videoOutputFilter];
|
||||
[windowController setDisplayMode:displayMode];
|
||||
[windowController setDisplayRotation:displayRotation];
|
||||
[windowController setDisplayOrientation:displayOrientation];
|
||||
[windowController setDisplayOrder:displayOrder];
|
||||
[windowController setDisplayGap:displayGap];
|
||||
[windowController setScreenshotFileFormat:screenshotFileFormat];
|
||||
[windowController setUseBilinearOutput:useBilinearOutput];
|
||||
[windowController setUseVerticalSync:useVerticalSync];
|
||||
[[windowController view] setUseVerticalSync:useVerticalSync];
|
||||
[windowController setDisplayScale:displayScale];
|
||||
|
||||
[[windowController masterWindow] setFrameOrigin:NSMakePoint(frameX, frameY)];
|
||||
|
@ -702,10 +706,12 @@
|
|||
[NSNumber numberWithInteger:[windowController displayOrientation]], @"displayOrientation",
|
||||
[NSNumber numberWithInteger:[windowController displayOrder]], @"displayOrder",
|
||||
[NSNumber numberWithDouble:[windowController displayGap]], @"displayGap",
|
||||
[NSNumber numberWithInteger:[windowController videoFilterType]], @"videoFilterType",
|
||||
[NSNumber numberWithBool:[windowController videoFiltersPreferGPU]], @"videoFiltersPreferGPU",
|
||||
[NSNumber numberWithInteger:[windowController videoPixelScaler]], @"videoFilterType",
|
||||
[NSNumber numberWithInteger:[windowController screenshotFileFormat]], @"screenshotFileFormat",
|
||||
[NSNumber numberWithBool:[windowController useBilinearOutput]], @"useBilinearOutput",
|
||||
[NSNumber numberWithBool:[windowController useVerticalSync]], @"useVerticalSync",
|
||||
[NSNumber numberWithInteger:[windowController videoOutputFilter]], @"videoOutputFilter",
|
||||
[NSNumber numberWithBool:[windowController videoSourceDeposterize]], @"videoSourceDeposterize",
|
||||
[NSNumber numberWithBool:[[windowController view] useVerticalSync]], @"useVerticalSync",
|
||||
[NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal",
|
||||
[NSNumber numberWithBool:[windowController isShowingStatusBar]], @"isShowingStatusBar",
|
||||
[NSNumber numberWithBool:isInFullScreenMode], @"isInFullScreenMode",
|
||||
|
|
Loading…
Reference in New Issue