]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
sourcescale shader parameter, horizontal and vertical texture size multiplier.
authorToni Wilen <twilen@winuae.net>
Sat, 16 Feb 2019 11:07:21 +0000 (13:07 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 16 Feb 2019 11:07:21 +0000 (13:07 +0200)
cfgfile.cpp
include/options.h
od-win32/direct3d.cpp
od-win32/direct3d.h
od-win32/direct3d11.cpp
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp

index d69f5fbfee3d3acf272ceb69d5319d8be362d4e2..0eee5ce2984d65b404e4ff319721aa59cbc9b178 100644 (file)
@@ -169,6 +169,7 @@ static const TCHAR *horizmode[] = { _T("vertical"), _T("lores"), _T("hires"), _T
 static const TCHAR *vertmode[] = { _T("horizontal"), _T("single"), _T("double"), _T("quadruple"), 0 };
 #ifdef GFXFILTER
 static const TCHAR *filtermode2[] = { _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0 };
+static const TCHAR *filtermode2v[] = { _T("-"), _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0 };
 #endif
 static const TCHAR *cartsmode[] = { _T("none"), _T("hrtmon"), 0 };
 static const TCHAR *idemode[] = { _T("none"), _T("a600/a1200"), _T("a4000"), 0 };
@@ -2210,7 +2211,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                                }
                        }
                }
-               cfgfile_dwrite_str (f, _T("gfx_filter_mode"), ext, filtermode2[gf->gfx_filter_filtermode]);
+               cfgfile_dwrite_str(f, _T("gfx_filter_mode"), ext, filtermode2[gf->gfx_filter_filtermodeh]);
+               cfgfile_dwrite_str(f, _T("gfx_filter_mode2"), ext, filtermode2v[gf->gfx_filter_filtermodev]);
                cfgfile_dwrite_ext (f, _T("gfx_filter_vert_zoomf"), ext, _T("%f"), gf->gfx_filter_vert_zoom);
                cfgfile_dwrite_ext (f, _T("gfx_filter_horiz_zoomf"), ext, _T("%f"), gf->gfx_filter_horiz_zoom);
                cfgfile_dwrite_ext (f, _T("gfx_filter_vert_zoom_multf"), ext, _T("%f"), gf->gfx_filter_vert_zoom_mult);
@@ -3712,12 +3714,20 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                        }
                        return 1;
                }
-               if (j == 0 && _tcscmp (option, _T("gfx_filter_mode")) == 0) {
-                       cfgfile_strval (option, value, _T("gfx_filter_mode"), &gf->gfx_filter_filtermode, filtermode2, 0);
+               if (j == 0 && _tcscmp(option, _T("gfx_filter_mode")) == 0) {
+                       cfgfile_strval(option, value, _T("gfx_filter_mode"), &gf->gfx_filter_filtermodeh, filtermode2, 0);
                        return 1;
                }
-               if (j == 1 && _tcscmp (option, _T("gfx_filter_mode_rtg")) == 0) {
-                       cfgfile_strval (option, value, _T("gfx_filter_mode_rtg"), &gf->gfx_filter_filtermode, filtermode2, 0);
+               if (j == 1 && _tcscmp(option, _T("gfx_filter_mode_rtg")) == 0) {
+                       cfgfile_strval(option, value, _T("gfx_filter_mode_rtg"), &gf->gfx_filter_filtermodeh, filtermode2, 0);
+                       return 1;
+               }
+               if (j == 0 && _tcscmp(option, _T("gfx_filter_mode2")) == 0) {
+                       cfgfile_strval(option, value, _T("gfx_filter_mode2"), &gf->gfx_filter_filtermodev, filtermode2v, 0);
+                       return 1;
+               }
+               if (j == 1 && _tcscmp(option, _T("gfx_filter_mode2_rtg")) == 0) {
+                       cfgfile_strval(option, value, _T("gfx_filter_mode2_rtg"), &gf->gfx_filter_filtermodev, filtermode2v, 0);
                        return 1;
                }
 
@@ -7766,7 +7776,8 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
                f->gfx_filter_horiz_zoom_mult = 1.0;
                f->gfx_filter_vert_zoom_mult = 1.0;
                f->gfx_filter_bilinear = 0;
-               f->gfx_filter_filtermode = 0;
+               f->gfx_filter_filtermodeh = 0;
+               f->gfx_filter_filtermodev = 0;
                f->gfx_filter_keep_aspect = 0;
                f->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
                f->gfx_filter_keep_autoscale_aspect = false;
index 503478f7c25ba2c8ece2e04409213d0397ae8ea6..de3f51c7c3872c1cc75b24d5d6d72b5b1e3b7b52 100644 (file)
@@ -359,7 +359,7 @@ struct gfx_filterdata
        float gfx_filter_horiz_offset, gfx_filter_vert_offset;
        int gfx_filter_left_border, gfx_filter_right_border;
        int gfx_filter_top_border, gfx_filter_bottom_border;
-       int gfx_filter_filtermode;
+       int gfx_filter_filtermodeh, gfx_filter_filtermodev;
        int gfx_filter_bilinear;
        int gfx_filter_noise, gfx_filter_blur;
        int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast;
index 21b0dfaadbb9d0df7d1c7f264744a3991cdfb648..5ffc90f1f559c195b6c2508d43ecab82760c0fa5 100644 (file)
@@ -117,6 +117,7 @@ struct shaderdata
        D3DXHANDLE m_InputDimsEffectHandle;
        D3DXHANDLE m_TargetDimsEffectHandle;
        D3DXHANDLE m_TexelSizeEffectHandle;
+       D3DXHANDLE m_ScaleEffectHandle;
        D3DXHANDLE m_SourceTextureEffectHandle;
        D3DXHANDLE m_WorkingTexture1EffectHandle;
        D3DXHANDLE m_WorkingTexture2EffectHandle;
@@ -194,7 +195,7 @@ struct d3dstruct
        int ledwidth, ledheight;
        int max_texture_w, max_texture_h;
        int tin_w, tin_h, tout_w, tout_h, window_h, window_w;
-       int t_depth, dmult, dmultx;
+       int t_depth, dmult, dmultxh, dmultxv;
        int required_sl_texture_w, required_sl_texture_h;
        int vsync2, guimode, maxscanline, variablerefresh;
        int resetcount;
@@ -469,6 +470,8 @@ static int psEffect_ParseParameters (struct d3dstruct *d3d, LPD3DXEFFECTCOMPILER
                                        s->m_TargetDimsEffectHandle = hParam;
                                else if (strcmpi(ParamDesc.Semantic, "texelsize") == 0)
                                        s->m_TexelSizeEffectHandle = hParam;
+                               else if (strcmpi(ParamDesc.Semantic, "sourcescale") == 0)
+                                       s->m_ScaleEffectHandle = hParam;
                        } else if(ParamDesc.Class == D3DXPC_SCALAR && ParamDesc.Type == D3DXPT_FLOAT) {
                                if(strcmpi(ParamDesc.Semantic, "SCALING") == 0)
                                        hr = effect->GetFloat(hParam, &d3d->m_scale);
@@ -1147,6 +1150,17 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, struct shaderdata
                        return 0;
                }
        }
+       if (s->m_ScaleEffectHandle) {
+               D3DXVECTOR4 fScale;
+               fScale.x = 1 << currprefs.gfx_resolution;
+               fScale.y = 1 << currprefs.gfx_vresolution;
+               fScale.w = fScale.z = 1;
+               hr = s->pEffect->SetVector(s->m_ScaleEffectHandle, &fScale);
+               if (FAILED(hr)) {
+                       write_log(_T("%s: SetTextures:SetVector:Scale %s\n"), D3DHEAD, D3D_ErrorString(hr));
+                       return 0;
+               }
+       }
        if (s->framecounterHandle)
                s->pEffect->SetFloat(s->framecounterHandle, timeframes);
 
@@ -1317,12 +1331,12 @@ static int createtexture (struct d3dstruct *d3d, int ow, int oh, int win_w, int
 
        int zw, zh;
 
-       if (ow > win_w * d3d->dmultx && oh > win_h * d3d->dmultx) {
+       if (ow > win_w * d3d->dmultxh && oh > win_h * d3d->dmultxv) {
                zw = ow;
                zh = oh;
        } else {
-               zw = win_w * d3d->dmultx;
-               zh = win_h * d3d->dmultx;
+               zw = win_w * d3d->dmultxh;
+               zh = win_h * d3d->dmultxv;
        }
        for (int i = 0; i < MAX_SHADERS; i++) {
                if (d3d->shaders[i].type == SHADERTYPE_BEFORE || d3d->shaders[i].type == SHADERTYPE_AFTER || d3d->shaders[i].type == SHADERTYPE_MIDDLE) {
@@ -2666,7 +2680,7 @@ static int getd3dadapter (IDirect3D9 *id3d)
        return D3DADAPTER_DEFAULT;
 }
 
-static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmult)
+static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
 {
        int monid = d3d - d3ddata;
        struct amigadisplay *ad = &adisplays[monid];
@@ -2892,7 +2906,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
                        write_log (_T("%s\n"), errmsg);
                        write_log (_T("%s: Retrying fullscreen with DirectDraw\n"), D3DHEAD);
                        if (ddraw_fs_hack_init (d3d)) {
-                               const TCHAR *err2 = D3D_init (ahwnd, monid, w_w, w_h, depth, freq, mmult);
+                               const TCHAR *err2 = D3D_init (ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv);
                                if (err2)
                                        ddraw_fs_hack_free (d3d);
                                return err2;
@@ -2901,7 +2915,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
                if (d3d->d3d_ex && D3DEX) {
                        write_log (_T("%s\n"), errmsg);
                        D3DEX = 0;
-                       return D3D_init(ahwnd, monid, w_w, w_h, depth, freq, mmult);
+                       return D3D_init(ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv);
                }
                D3D_free(monid, true);
                return errmsg;
@@ -2965,7 +2979,8 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
        if (!shaderon)
                write_log (_T("Using non-shader version\n"));
 
-       d3d->dmultx = mmult;
+       d3d->dmultxh = mmulth;
+       d3d->dmultxv = mmultv;
        d3d->dmult = S2X_getmult(d3d - d3ddata);
 
        d3d->window_w = w_w;
@@ -2976,8 +2991,10 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
                        D3DHEAD, w_w, w_h, d3d->max_texture_w, d3d->max_texture_h);
                return errmsg;
        }
-       while (d3d->dmultx > 1 && (w_w * d3d->dmultx > d3d->max_texture_w || w_h * d3d->dmultx > d3d->max_texture_h))
-               d3d->dmultx--;
+       while (d3d->dmultxh > 1 && w_w * d3d->dmultxh > d3d->max_texture_w)
+               d3d->dmultxh--;
+       while (d3d->dmultxv > 1 && w_h * d3d->dmultxv > d3d->max_texture_h)
+               d3d->dmultxv--;
 
        d3d->required_sl_texture_w = w_w;
        d3d->required_sl_texture_h = w_h;
@@ -3052,7 +3069,7 @@ struct d3d_initargs
        int w;
        int h;
        int depth;
-       int mmult;
+       int mmulth, mmultv;
        int *freq;
 };
 static struct d3d_initargs d3dargs;
@@ -3068,7 +3085,7 @@ static void *D3D_init_start (void *p)
        D3D_free2 (d3d);
        sleep_millis (1000);
        write_log (_T("Threaded D3D_init() start (init)\n"));
-       const TCHAR *t = D3D_init2 (d3d, d3dargs.hwnd, d3dargs.w, d3dargs.h,d3dargs.depth, d3dargs.freq, d3dargs.mmult);
+       const TCHAR *t = D3D_init2 (d3d, d3dargs.hwnd, d3dargs.w, d3dargs.h,d3dargs.depth, d3dargs.freq, d3dargs.mmulth, d3dargs.mmultv);
        if (t) {
                gui_message (_T("Threaded D3D_init() returned error '%s'\n"), t);
        }
@@ -3089,18 +3106,19 @@ static void *D3D_init_start (void *p)
        return NULL;
 }
 
-static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmult)
+static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
 {
        struct d3dstruct *d3d = &d3ddata[monid];
 
        if (!fakemodewaitms)
-               return D3D_init2 (d3d, ahwnd, w_w, w_h, depth, freq, mmult);
+               return D3D_init2 (d3d, ahwnd, w_w, w_h, depth, freq, mmulth, mmultv);
        d3d->fakemode = true;
        d3dargs.hwnd = ahwnd;
        d3dargs.w = w_w;
        d3dargs.h = w_h;
        d3dargs.depth = depth;
-       d3dargs.mmult = mmult;
+       d3dargs.mmulth = mmulth;
+       d3dargs.mmultv = mmultv;
        d3dargs.freq = freq;
        uae_start_thread_fast (D3D_init_start, NULL, &d3d->fakemodetid);
        return NULL;
@@ -3122,8 +3140,8 @@ static bool xD3D_alloctexture (int monid, int w, int h)
        d3d->tin_w = w * d3d->dmult;
        d3d->tin_h = h * d3d->dmult;
 
-       d3d->tout_w = d3d->tin_w * d3d->dmultx;
-       d3d->tout_h = d3d->tin_h * d3d->dmultx;
+       d3d->tout_w = d3d->tin_w * d3d->dmultxh;
+       d3d->tout_h = d3d->tin_h * d3d->dmultxv;
 
        if (d3d->fakemode)
                return false;
index 9f4ce5e042a15dfd4a40f9efb522167f47ba95c3..17d5f90086193c31c542249bfa6cb8e7298a8f43 100644 (file)
@@ -8,7 +8,7 @@ struct extoverlay
 };
 
 extern void(*D3D_free)(int, bool immediate);
-extern const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmult);
+extern const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmulth, int mmultv);
 extern bool(*D3D_alloctexture)(int, int, int);
 extern void(*D3D_refresh)(int);
 extern bool(*D3D_renderframe)(int, int,bool);
index e2d516a58148c34f2872d908c8016225803280d1..2cc8d4053e94e3ce19c2fbf1e4c4e5b277291d57 100644 (file)
@@ -41,7 +41,7 @@ using Microsoft::WRL::ComPtr;
 #include <Dwmapi.h>
 
 void (*D3D_free)(int, bool immediate);
-const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmult);
+const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmulth, int mmultv);
 bool (*D3D_alloctexture)(int, int, int);
 void(*D3D_refresh)(int);
 bool(*D3D_renderframe)(int, int,bool);
@@ -161,6 +161,7 @@ struct shaderdata11
        ID3DX11EffectVectorVariable *m_InputDimsEffectHandle;
        ID3DX11EffectVectorVariable *m_TargetDimsEffectHandle;
        ID3DX11EffectVectorVariable *m_TexelSizeEffectHandle;
+       ID3DX11EffectVectorVariable *m_ScaleEffectHandle;
        // Texture Handles
        ID3DX11EffectShaderResourceVariable *m_SourceTextureEffectHandle;
        ID3DX11EffectShaderResourceVariable *m_WorkingTexture1EffectHandle;
@@ -253,7 +254,7 @@ struct d3d11struct
        DXGI_FORMAT texformat;
        DXGI_FORMAT intformat;
        bool m_tearingSupport;
-       int dmult, dmultx;
+       int dmult, dmultxh, dmultxv;
        int xoffset, yoffset;
        float xmult, ymult;
        DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
@@ -489,6 +490,8 @@ static bool psEffect_ParseParameters(struct d3d11struct *d3d, ID3DX11Effect *eff
                                s->m_TargetDimsEffectHandle = hParam->AsVector();
                        else if (strcmpi(ParamDesc.Semantic, "texelsize") == 0)
                                s->m_TexelSizeEffectHandle = hParam->AsVector();
+                       else if (strcmpi(ParamDesc.Semantic, "sourcescale") == 0)
+                               s->m_ScaleEffectHandle = hParam->AsVector();
 
                        if (strcmpi(ParamDesc.Semantic, "SCALING") == 0)
                                s->m_scale = hParam->AsScalar();
@@ -1075,8 +1078,8 @@ static bool psEffect_LoadEffect(struct d3d11struct *d3d, const TCHAR *shaderfile
        allocfxdata(d3d, s);
        createfxvertices(d3d, s);
 
-       s->viewport.Width = (float)d3d->m_screenWidth * d3d->dmultx;
-       s->viewport.Height = (float)d3d->m_screenHeight * d3d->dmultx;
+       s->viewport.Width = (float)d3d->m_screenWidth * d3d->dmultxh;
+       s->viewport.Height = (float)d3d->m_screenHeight * d3d->dmultxv;
        s->viewport.MinDepth = 0.0f;
        s->viewport.MaxDepth = 1.0f;
        s->viewport.TopLeftX = 0.0f;
@@ -1227,6 +1230,13 @@ static int psEffect_SetTextures(ID3D11Texture2D *lpSourceTex, ID3D11ShaderResour
        if (s->m_TexelSizeEffectHandle) {
                s->m_TexelSizeEffectHandle->SetFloatVector((float*)&fTexelSize);
        }
+       if (s->m_ScaleEffectHandle) {
+               D3DXVECTOR4 fScale;
+               fScale.x = 1 << currprefs.gfx_resolution;
+               fScale.y = 1 << currprefs.gfx_vresolution;
+               fScale.w = fScale.z = 1;
+               s->m_ScaleEffectHandle->SetFloatVector((float*)&fScale);
+       }
        if (s->framecounterHandle) {
                s->framecounterHandle->SetFloat((float)timeframes);
        }
@@ -2067,12 +2077,12 @@ static bool createextratextures(struct d3d11struct *d3d, int ow, int oh, int win
 
        int zw, zh;
 
-       if (ow > win_w * d3d->dmultx && oh > win_h * d3d->dmultx) {
+       if (ow > win_w * d3d->dmultxh && oh > win_h * d3d->dmultxv) {
                zw = ow;
                zh = oh;
        } else {
-               zw = win_w * d3d->dmultx;
-               zh = win_h * d3d->dmultx;
+               zw = win_w * d3d->dmultxh;
+               zh = win_h * d3d->dmultxv;
        }
        for (int i = 0; i < MAX_SHADERS; i++) {
                struct shaderdata11 *s = &d3d->shaders[i];
@@ -3266,7 +3276,7 @@ static float xD3D_getrefreshrate(int monid)
        return d3d->vblank;
 }
 
-static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmult)
+static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv)
 {
        struct d3d11struct *d3d = &d3d11data[monid];
        struct amigadisplay *ad = &adisplays[monid];
@@ -3307,7 +3317,8 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
        d3d->texformat = DXGI_FORMAT_B8G8R8A8_UNORM;
        d3d->intformat = DXGI_FORMAT_B8G8R8A8_UNORM; // _SRGB;
        d3d->scrformat = DXGI_FORMAT_B8G8R8A8_UNORM;
-       d3d->dmultx = mmult;
+       d3d->dmultxh = mmulth;
+       d3d->dmultxv = mmultv;
 
        struct MultiDisplay *md = getdisplay(&currprefs, monid);
        POINT pt;
@@ -3892,16 +3903,16 @@ static void xD3D11_free(int monid, bool immediate)
        write_log(_T("D3D11 free end\n"));
 }
 
-static int xxD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmult)
+static int xxD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
 {
-       return xxD3D11_init2(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmult);
+       return xxD3D11_init2(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv);
 }
 
-static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmult)
+static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
 {
        if (!can_D3D11(false))
                return _T("D3D11 FAILED TO INIT");
-       int v = xxD3D11_init(ahwnd, monid, w_w, w_h, depth, freq, mmult);
+       int v = xxD3D11_init(ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv);
        if (v > 0)
                return NULL;
        xD3D11_free(monid, true);
@@ -4657,7 +4668,7 @@ static bool recheck(struct d3d11struct *d3d)
        d3d->delayedfs = 0;
        ShowWindow(d3d->ahwnd, SW_SHOWNORMAL);
        int freq = 0;
-       if (!xxD3D11_init2(d3d->ahwnd, d3d - d3d11data, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultx))
+       if (!xxD3D11_init2(d3d->ahwnd, d3d - d3d11data, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv))
                d3d->invalidmode = true;
        return false;
 }
@@ -4676,8 +4687,8 @@ static bool xD3D11_alloctexture(int monid, int w, int h)
        d3d->m_bitmapWidth2 = d3d->m_bitmapWidth;
        d3d->m_bitmapHeight2 = d3d->m_bitmapHeight;
        d3d->dmult = S2X_getmult(monid);
-       d3d->m_bitmapWidthX = d3d->m_bitmapWidth * d3d->dmultx;
-       d3d->m_bitmapHeightX = d3d->m_bitmapHeight * d3d->dmultx;
+       d3d->m_bitmapWidthX = d3d->m_bitmapWidth * d3d->dmultxh;
+       d3d->m_bitmapHeightX = d3d->m_bitmapHeight * d3d->dmultxv;
 
        v = CreateTexture(d3d);
        if (!v)
index f3ccc2f04d57eece94a857b496082a5c8aa849dd..955378f0844b4e371b2014c5ab4e4697faa46893 100644 (file)
@@ -915,11 +915,14 @@ bool S2X_init(int monid, int dw, int dh, int dd)
        amiga_depth = vb->pixbytes * 8;
 
        if (d3d) {
-               int m = currprefs.gf[ad->picasso_on].gfx_filter_filtermode + 1;
-               if (m < scale)
-                       m = scale;
-               temp_width = dst_width * m;
-               temp_height = dst_height * m;
+               int mh = currprefs.gf[ad->picasso_on].gfx_filter_filtermodeh + 1;
+               if (mh < scale)
+                       mh = scale;
+               temp_width = dst_width * mh;
+               int mv = currprefs.gf[ad->picasso_on].gfx_filter_filtermodev + 1;
+               if (mv < scale)
+                       mv = scale;
+               temp_height = dst_height * mv;
        } else {
                temp_width = dst_width * 2;
                temp_height = dst_height * 2;
index 76b2d4f898fbe747abcc57753a8795e2017cfd2a..6fd177ad30f5410f0a2d6a4b7a9c173499e44520 100644 (file)
@@ -2306,7 +2306,8 @@ int check_prefs_changed_gfx (void)
                c |= gf->gfx_filter_horiz_zoom_mult != gfc->gfx_filter_horiz_zoom_mult ? (1) : 0;
                c |= gf->gfx_filter_vert_zoom_mult != gfc->gfx_filter_vert_zoom_mult ? (1) : 0;
 
-               c |= gf->gfx_filter_filtermode != gfc->gfx_filter_filtermode ? (2|8) : 0;
+               c |= gf->gfx_filter_filtermodeh != gfc->gfx_filter_filtermodeh ? (2 | 8) : 0;
+               c |= gf->gfx_filter_filtermodev != gfc->gfx_filter_filtermodev ? (2 | 8) : 0;
                c |= gf->gfx_filter_bilinear != gfc->gfx_filter_bilinear ? (2|8|16) : 0;
                c |= gf->gfx_filter_noise != gfc->gfx_filter_noise ? (1) : 0;
                c |= gf->gfx_filter_blur != gfc->gfx_filter_blur ? (1) : 0;
@@ -4107,8 +4108,14 @@ retry:
        S2X_free(mon->monitor_id);
        oldtex_w = oldtex_h = -1;
        if (mon->currentmode.flags & DM_D3D) {
-               const TCHAR *err = D3D_init (mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, mon->currentmode.current_depth, &mon->currentmode.freq, mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermode + 1);
-               if (err) {
+               int fmh = mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermodeh + 1;
+               int fmv = mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermodev + 1 - 1;
+               if (currprefs.gf[ad->picasso_on].gfx_filter_filtermodev == 0) {
+                       fmv = fmh;
+               }
+               const TCHAR *err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height,
+                       mon->currentmode.current_depth, &mon->currentmode.freq, fmh, fmv);
+                       if (err) {
                        if (currprefs.gfx_api == 2) {
                                D3D_free(0, true);
                                if (err[0] == 0 && currprefs.color_mode != 5) {
@@ -4119,7 +4126,8 @@ retry:
                                changed_prefs.gfx_api = currprefs.gfx_api = 1;
                                d3d_select(&currprefs);
                                error_log(_T("Direct3D11 failed to initialize ('%s'), falling back to Direct3D9."), err);
-                               err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, mon->currentmode.current_depth, &mon->currentmode.freq, mon->screen_is_picasso ? 1 : currprefs.gf[ad->picasso_on].gfx_filter_filtermode + 1);
+                               err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height,
+                                       mon->currentmode.current_depth, &mon->currentmode.freq, fmh, fmv);
                        }
                        if (err) {
                                D3D_free(0, true);
index be8e6fd892a54436971caddb0c166c7040e2cacd..00d6e4b4a7d58c941fef0eb629f81d85534b278e 100644 (file)
@@ -18830,31 +18830,32 @@ static void enable_for_hw3ddlg (HWND hDlg)
        if (filter_nativertg)
                v = FALSE;
 
-       ew (hDlg, IDC_FILTERHZ, v);
-       ew (hDlg, IDC_FILTERVZ, v);
-       ew (hDlg, IDC_FILTERHZMULT, v && !as);
-       ew (hDlg, IDC_FILTERVZMULT, v && !as);
-       ew (hDlg, IDC_FILTERHO, v && !as);
-       ew (hDlg, IDC_FILTERVO, v && !as);
-       ew (hDlg, IDC_FILTERSLR, vv3);
-       ew (hDlg, IDC_FILTERXL, vv2);
-       ew (hDlg, IDC_FILTERXLV, vv2);
-       ew (hDlg, IDC_FILTERXTRA, vv2);
-       ew (hDlg, IDC_FILTERFILTER, workprefs.gfx_api);
-       ew (hDlg, IDC_FILTERSTACK, workprefs.gfx_api);
-       ew (hDlg, IDC_FILTERKEEPASPECT, v);
-       ew (hDlg, IDC_FILTERASPECT, v);
-       ew (hDlg, IDC_FILTERASPECT2, v && workprefs.gf[filter_nativertg].gfx_filter_keep_aspect);
-       ew (hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_NORMAL ||
+       ew(hDlg, IDC_FILTERHZ, v);
+       ew(hDlg, IDC_FILTERVZ, v);
+       ew(hDlg, IDC_FILTERHZMULT, v && !as);
+       ew(hDlg, IDC_FILTERVZMULT, v && !as);
+       ew(hDlg, IDC_FILTERHO, v && !as);
+       ew(hDlg, IDC_FILTERVO, v && !as);
+       ew(hDlg, IDC_FILTERSLR, vv3);
+       ew(hDlg, IDC_FILTERXL, vv2);
+       ew(hDlg, IDC_FILTERXLV, vv2);
+       ew(hDlg, IDC_FILTERXTRA, vv2);
+       ew(hDlg, IDC_FILTERFILTERH, workprefs.gfx_api);
+       ew(hDlg, IDC_FILTERFILTERV, workprefs.gfx_api);
+       ew(hDlg, IDC_FILTERSTACK, workprefs.gfx_api);
+       ew(hDlg, IDC_FILTERKEEPASPECT, v);
+       ew(hDlg, IDC_FILTERASPECT, v);
+       ew(hDlg, IDC_FILTERASPECT2, v && workprefs.gf[filter_nativertg].gfx_filter_keep_aspect);
+       ew(hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_NORMAL ||
                workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_INTEGER_AUTOSCALE));
-       ew (hDlg, IDC_FILTEROVERLAY, workprefs.gfx_api);
-       ew (hDlg, IDC_FILTEROVERLAYTYPE, workprefs.gfx_api);
+       ew(hDlg, IDC_FILTEROVERLAY, workprefs.gfx_api);
+       ew(hDlg, IDC_FILTEROVERLAYTYPE, workprefs.gfx_api);
 
-       ew (hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0);
-       ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0);
-       ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
+       ew(hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0);
+       ew(hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0);
+       ew(hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
 
-       ew (hDlg, IDC_FILTERINTEGER, workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_INTEGER ||
+       ew(hDlg, IDC_FILTERINTEGER, workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_INTEGER ||
                workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_INTEGER_AUTOSCALE);
 }
 
@@ -18906,7 +18907,7 @@ static const int filtertypes[] = {
        -1
 };     
 static void *filtervars[] = {
-       &workprefs.gf[0].gfx_filter, &workprefs.gf[0].gfx_filter_filtermode,
+       &workprefs.gf[0].gfx_filter, &workprefs.gf[0].gfx_filter_filtermodeh,
        &workprefs.gf[0].gfx_filter_vert_zoom, &workprefs.gf[0].gfx_filter_horiz_zoom,
        &workprefs.gf[0].gfx_filter_vert_zoom_mult, &workprefs.gf[0].gfx_filter_horiz_zoom_mult,
        &workprefs.gf[0].gfx_filter_vert_offset, &workprefs.gf[0].gfx_filter_horiz_offset,
@@ -18921,7 +18922,7 @@ static void *filtervars[] = {
        NULL
 };
 static void *filtervars2[] = {
-       NULL, &currprefs.gf[0].gfx_filter_filtermode,
+       NULL, &currprefs.gf[0].gfx_filter_filtermodeh,
        &currprefs.gf[0].gfx_filter_vert_zoom, &currprefs.gf[0].gfx_filter_horiz_zoom,
        &currprefs.gf[0].gfx_filter_vert_zoom_mult, &currprefs.gf[0].gfx_filter_horiz_zoom_mult,
        &currprefs.gf[0].gfx_filter_vert_offset, &currprefs.gf[0].gfx_filter_horiz_offset,
@@ -19225,12 +19226,15 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
                filter_extra[fxidx] = NULL;
        }
        int filtermodenum = 0;
-       SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L);
+       SendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_RESETCONTENT, 0, 0L);
+       SendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_RESETCONTENT, 0, 0L);
+       SendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_ADDSTRING, 0, (LPARAM)_T("-"));
        if (workprefs.gfx_api) {
                for (i = 0; i < 4; i++) {
                        TCHAR tmp[100];
                        _stprintf (tmp, _T("%dx"), i + 1);
-                       SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_ADDSTRING, 0, (LPARAM)tmp);
+                       SendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_ADDSTRING, 0, (LPARAM)tmp);
+                       SendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_ADDSTRING, 0, (LPARAM)tmp);
                        filtermodenum++;
                }
        }
@@ -19275,9 +19279,12 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
                        SetDlgItemInt (hDlg, IDC_FILTERXLV, *(filter_selected->varw[filter_nativertg]), TRUE);
                }
        }
-       if (workprefs.gf[filter_nativertg].gfx_filter_filtermode >= filtermodenum)
-               workprefs.gf[filter_nativertg].gfx_filter_filtermode = 0;
-       SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_SETCURSEL, workprefs.gf[filter_nativertg].gfx_filter_filtermode, 0);
+       if (workprefs.gf[filter_nativertg].gfx_filter_filtermodeh >= filtermodenum)
+               workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = 0;
+       if (workprefs.gf[filter_nativertg].gfx_filter_filtermodev >= filtermodenum + 1)
+               workprefs.gf[filter_nativertg].gfx_filter_filtermodev = 0;
+       SendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_SETCURSEL, workprefs.gf[filter_nativertg].gfx_filter_filtermodeh, 0);
+       SendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_SETCURSEL, workprefs.gf[filter_nativertg].gfx_filter_filtermodev, 0);
        setfiltermult (hDlg);
 
        SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_RESETCONTENT, 0, 0L);
@@ -19467,17 +19474,22 @@ static void filter_handle (HWND hDlg)
        if (item != CB_ERR) {
                TCHAR tmp[MAX_DPATH], oldsh[MAX_DPATH];
                int of = workprefs.gf[filter_nativertg].gfx_filter;
-               int off = workprefs.gf[filter_nativertg].gfx_filter_filtermode;
+               int offh = workprefs.gf[filter_nativertg].gfx_filter_filtermodeh;
+               int offv = workprefs.gf[filter_nativertg].gfx_filter_filtermodev;
                tmp[0] = 0;
                _tcscpy (oldsh, workprefs.gf[filter_nativertg].gfx_filtershader[filterstackpos]);
                SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp);
                workprefs.gf[filter_nativertg].gfx_filtershader[filterstackpos][0] = 0;
                workprefs.gf[filter_nativertg].gfx_filter = 0;
-               workprefs.gf[filter_nativertg].gfx_filter_filtermode = 0;
+               workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = 0;
+               workprefs.gf[filter_nativertg].gfx_filter_filtermodev = 0;
                if (workprefs.gfx_api) {
-                       LRESULT item2 = SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_GETCURSEL, 0, 0L);
+                       LRESULT item2 = SendDlgItemMessage(hDlg, IDC_FILTERFILTERH, CB_GETCURSEL, 0, 0L);
                        if (item2 != CB_ERR)
-                               workprefs.gf[filter_nativertg].gfx_filter_filtermode = (int)item2;
+                               workprefs.gf[filter_nativertg].gfx_filter_filtermodeh = (int)item2;
+                       item2 = SendDlgItemMessage(hDlg, IDC_FILTERFILTERV, CB_GETCURSEL, 0, 0L);
+                       if (item2 != CB_ERR)
+                               workprefs.gf[filter_nativertg].gfx_filter_filtermodev = (int)item2;
                }
                if (item > 0) {
                        if (item > UAE_FILTER_LAST) {
@@ -19486,7 +19498,9 @@ static void filter_handle (HWND hDlg)
                                item--;
                                workprefs.gf[filter_nativertg].gfx_filter = uaefilters[item].type;
                        }
-                       if (of != workprefs.gf[filter_nativertg].gfx_filter || off != workprefs.gf[filter_nativertg].gfx_filter_filtermode) {
+                       if (of != workprefs.gf[filter_nativertg].gfx_filter ||
+                               offh != workprefs.gf[filter_nativertg].gfx_filter_filtermodeh ||
+                               offv != workprefs.gf[filter_nativertg].gfx_filter_filtermodev) {
                                values_to_hw3ddlg (hDlg, false);
                                hw3d_changed = 1;
                        }
@@ -19716,7 +19730,8 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                        }
                                        break;
                                case IDC_FILTERMODE:
-                               case IDC_FILTERFILTER:
+                               case IDC_FILTERFILTERH:
+                               case IDC_FILTERFILTERV:
                                case IDC_FILTEROVERLAY:
                                        filter_handle (hDlg);
                                        values_to_hw3ddlg (hDlg, false);