From: Toni Wilen Date: Sat, 6 Nov 2021 17:51:07 +0000 (+0200) Subject: D3D11 HDR X-Git-Tag: 4900~26 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c54df5e2fa183fc07e9b62e9b698d4811bb24ba8;p=francis%2Fwinuae.git D3D11 HDR --- diff --git a/cfgfile.cpp b/cfgfile.cpp index e2be72c5..82313301 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -203,7 +203,7 @@ static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), 0 }; static const TCHAR *vsyncmodes[] = { _T("false"), _T("true"), _T("autoswitch"), 0 }; static const TCHAR *vsyncmodes2[] = { _T("normal"), _T("busywait"), 0 }; -static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), _T("direct3d11"), 0 }; +static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), _T("direct3d11"), _T("direct3d11"), 0}; static const TCHAR *filterapiopts[] = { _T("hardware"), _T("software"), 0 }; static const TCHAR *overscanmodes[] = { _T("tv_narrow"), _T("tv_standard"), _T("tv_wide"), _T("overscan"), _T("broadcast"), _T("extreme"), NULL }; static const TCHAR *dongles[] = @@ -356,6 +356,8 @@ static const TCHAR *obsolete[] = { _T("hblank_glitch"), + _T("gfx_hdr"), + NULL }; @@ -2279,8 +2281,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool(f, _T("gfx_black_frame_insertion"), p->lightboost_strobo); cfgfile_dwrite(f, _T("gfx_black_frame_insertion_ratio"), _T("%d"), p->lightboost_strobo_ratio); cfgfile_write_str(f, _T("gfx_api"), filterapi[p->gfx_api]); + cfgfile_dwrite_bool(f, _T("gfx_api_hdr"), p->gfx_api == 3); cfgfile_write_str(f, _T("gfx_api_options"), filterapiopts[p->gfx_api_options]); - cfgfile_dwrite_bool(f, _T("gfx_hdr"), p->gfx_hdr); cfgfile_dwrite(f, _T("gfx_horizontal_extra"), _T("%d"), p->gfx_extrawidth); cfgfile_dwrite(f, _T("gfx_vertical_extra"), _T("%d"), p->gfx_extraheight); cfgfile_dwrite(f, _T("gfx_frame_slices"), _T("%d"), p->gfx_display_sections); @@ -3484,7 +3486,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_yesno(option, value, _T("gfx_black_frame_insertion"), &p->lightboost_strobo) || cfgfile_yesno(option, value, _T("gfx_flickerfixer"), &p->gfx_scandoubler) || cfgfile_yesno(option, value, _T("gfx_autoresolution_vga"), &p->gfx_autoresolution_vga) - || cfgfile_yesno(option, value, _T("gfx_hdr"), &p->gfx_hdr) || cfgfile_yesno(option, value, _T("show_refresh_indicator"), &p->refresh_indicator) || cfgfile_yesno(option, value, _T("warp"), &p->turbo_emulation) || cfgfile_yesno(option, value, _T("headless"), &p->headless) @@ -3528,6 +3529,13 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) if (cfgfile_multichoice(option, value, _T("debugging_features"), &p->debugging_features, debugfeatures)) return 1; + if (cfgfile_yesno(option, value, _T("gfx_api_hdr"), &vb)) { + if (vb && p->gfx_api == 2) { + p->gfx_api = 3; + } + return 1; + } + if (cfgfile_yesno(option, value, _T("magic_mouse"), &vb)) { if (vb) p->input_mouse_untrap |= MOUSEUNTRAP_MAGIC; diff --git a/drawing.cpp b/drawing.cpp index 2bb46c08..f943bed8 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -180,6 +180,7 @@ int xgreencolor_s, xgreencolor_b, xgreencolor_m; int xbluecolor_s, xbluecolor_b, xbluecolor_m; struct color_entry colors_for_drawing; +xcolnr fullblack; static struct color_entry direct_colors_for_drawing; static xcolnr *p_acolors; @@ -1041,12 +1042,12 @@ static xcolnr getbgc(int blank) return xcolors[0xf0f]; #endif if (exthblank) { - return 0; + return fullblack; } bool extblken = ce_is_extblankset(colors_for_drawing.extra); // extblken=1: hblank and vblank = black if (!(vb_state & 1) && extblken && aga_mode) { - return 0; + return fullblack; } bool brdblank = ce_is_borderblank(colors_for_drawing.extra); #if 0 @@ -1057,10 +1058,10 @@ static xcolnr getbgc(int blank) #endif // borderblank = black (overrides extblken) if (brdblank && blank >= 0) { - return 0; + return fullblack; } if (hposblank || blank > 0) { - return 0; + return fullblack; } return colors_for_drawing.acolors[0]; } diff --git a/gfxutil.cpp b/gfxutil.cpp index 1161c5d2..172f5f09 100644 --- a/gfxutil.cpp +++ b/gfxutil.cpp @@ -42,7 +42,7 @@ float getvsyncrate(int monid, float hz, int *mult) #define GRN 1 #define BLU 2 -unsigned int doMask (int p, int bits, int shift) +uae_u32 doMask(uae_u32 p, int bits, int shift) { /* scale to 0..255, shift to align msb with mask, and apply mask */ uae_u32 val; @@ -80,34 +80,35 @@ int mask_shift (unsigned long mask) return n; } -unsigned int doMask256 (int p, int bits, int shift) +uae_u32 doMask256 (int p, int bits, int shift) { /* p is a value from 0 to 255 (Amiga color value) * shift to align msb with mask, and apply mask */ - unsigned long val = p * 0x01010101UL; + uae_u32 val = p; if (bits == 0) return 0; + val <<= 24; val >>= (32 - bits); val <<= shift; return val; } -static unsigned int doColor (int i, int bits, int shift) +static uae_u32 doColor (int i, int bits, int shift) { int shift2; if (flashscreen) i ^= 0xffffffff; - if(bits >= 8) + if (bits >= 8) shift2 = 0; else shift2 = 8 - bits; return (i >> shift2) << shift; } -static unsigned int doAlpha (int alpha, int bits, int shift) +static uae_u32 doAlpha (int alpha, int bits, int shift) { return (alpha & ((1 << bits) - 1)) << shift; } @@ -139,10 +140,18 @@ static void video_calc_gammatable(int monid) { struct amigadisplay *ad = &adisplays[monid]; float bri, con, gam, gams[3]; + float max = 255; + + if (gfx_hdr) { + bri = 0.0; + con = 1.0; + gam = 0.0; + } else { + bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f); + con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f; + gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0; + } - bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f); - con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f; - gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0; gams[0] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[0])) / 1000.0f; gams[1] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[1])) / 1000.0f; gams[2] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[2])) / 1000.0f; @@ -163,8 +172,8 @@ static void video_calc_gammatable(int monid) val = (val * 252.0) / 238.0; } - if (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 && - currprefs.gfx_gamma_ch[0] == 0 && currprefs.gfx_gamma_ch[1] == 0 && currprefs.gfx_gamma_ch[2] == 0) { + if (gfx_hdr || (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 && + currprefs.gfx_gamma_ch[0] == 0 && currprefs.gfx_gamma_ch[1] == 0 && currprefs.gfx_gamma_ch[2] == 0)) { v = val; } else { v = video_gamma(val, gams[j], bri, con); @@ -172,8 +181,8 @@ static void video_calc_gammatable(int monid) if (v < 0.0) v = 0.0; - if (v > 255.0) - v = 255.0; + if (v > max) + v = max; gamma[i][j] = (uae_u32)(v + 0.5); } @@ -183,7 +192,9 @@ static void video_calc_gammatable(int monid) static uae_u32 limit256(int monid, double v) { struct amigadisplay *ad = &adisplays[monid]; - v = v * (double)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0; + if (!gfx_hdr) { + v = v * (double)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0; + } if (v < 0) v = 0; if (v > 255) @@ -193,7 +204,9 @@ static uae_u32 limit256(int monid, double v) static uae_u32 limit256rb(int monid, double v) { struct amigadisplay *ad = &adisplays[monid]; - v *= (double)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0; + if (!gfx_hdr) { + v *= (double)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0; + } if (v < -128) v = -128; if (v > 127) @@ -337,16 +350,17 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i for(i = 0; i < 256; i++) { int j; - if (currprefs.gfx_blackerthanblack) { + if (!gfx_hdr && currprefs.gfx_blackerthanblack) { j = i * 15 / 16 + 15; - } else { + } else { j = i; } j += 256; - rc[i] = doColor (gamma[j][0], rw, rs) | doAlpha (alpha, aw, as); - gc[i] = doColor (gamma[j][1], gw, gs) | doAlpha (alpha, aw, as); - bc[i] = doColor (gamma[j][2], bw, bs) | doAlpha (alpha, aw, as); + rc[i] = doColor(gamma[j][0], rw, rs) | doAlpha(alpha, aw, as); + gc[i] = doColor(gamma[j][1], gw, gs) | doAlpha(alpha, aw, as); + bc[i] = doColor(gamma[j][2], bw, bs) | doAlpha(alpha, aw, as); + if (byte_swap) { if (bpp <= 16) { rc[i] = bswap_16 (rc[i]); @@ -380,12 +394,11 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs, int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f); int b = ((i & 0xf) << 4) | (i & 0x0f); - if (currprefs.gfx_blackerthanblack) { + if (!gfx_hdr && currprefs.gfx_blackerthanblack) { r = (r * (255 - 8) / 255) + 8; g = (g * (255 - 8) / 255) + 8; b = (b * (255 - 8) / 255) + 8; } - r = gamma[r + j][0]; g = gamma[g + j][1]; b = gamma[b + j][2]; @@ -403,6 +416,11 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs, xcolors[i] |= xcolors[i] * 0x00010001; } } + fullblack = xcolors[0]; + if (gfx_hdr) { + fullblack = doAlpha(1, aw, as); + } + #if defined(AGA) || defined(GFXFILTER) alloc_colors_rgb (rw, gw, bw, rs, gs, bs, aw, as, alpha, byte_swap, xredcolors, xgreencolors, xbluecolors); /* copy original color table */ diff --git a/include/options.h b/include/options.h index 48b53304..63b1a2a0 100644 --- a/include/options.h +++ b/include/options.h @@ -567,7 +567,6 @@ struct uae_prefs { bool gfx_blackerthanblack; int gfx_threebitcolors; int gfx_api; - bool gfx_hdr; int gfx_api_options; int color_mode; int gfx_extrawidth; diff --git a/include/xwin.h b/include/xwin.h index 70f88c00..add1b131 100644 --- a/include/xwin.h +++ b/include/xwin.h @@ -18,6 +18,7 @@ typedef int (*allocfunc_type)(int, int, int, xcolnr *); extern xcolnr xcolors[4096]; extern uae_u32 p96_rgbx16[65536]; +extern xcolnr fullblack; extern int graphics_setup (void); extern int graphics_init (bool); @@ -69,14 +70,15 @@ void refreshtitle (void); extern int bits_in_mask (unsigned long mask); extern int mask_shift (unsigned long mask); -extern unsigned int doMask (int p, int bits, int shift); -extern unsigned int doMask256 (int p, int bits, int shift); +extern uae_u32 doMask (uae_u32 p, int bits, int shift); +extern uae_u32 doMask256 (int p, int bits, int shift); extern void alloc_colors64k (int monid, int, int, int, int, int, int, int, int, int, int, bool); extern void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc); extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt, uae_u32 *rgbx16); extern float getvsyncrate(int monid, float hz, int *mult); + /* The graphics code has a choice whether it wants to use a large buffer * for the whole display, or only a small buffer for a single line. * If you use a large buffer: @@ -140,6 +142,7 @@ struct vidbuffer extern bool isnativevidbuf(int monid); extern int max_uae_width, max_uae_height; +extern bool gfx_hdr; struct vidbuf_description { diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 342200b3..c1a21cd6 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -31,8 +31,11 @@ using Microsoft::WRL::ComPtr; #include "d3dx.h" #include "shaders/PixelShaderPlain.h" +#include "shaders/PixelShaderPlain_HDR.h" #include "shaders/PixelShaderAlpha.h" +#include "shaders/PixelShaderAlpha_HDR.h" #include "shaders/PixelShaderMask.h" +#include "shaders/PixelShaderMask_HDR.h" #include "shaders/VertexShader.h" #include "FX11/d3dx11effect.h" @@ -231,6 +234,7 @@ struct d3d11struct D3D11_VIEWPORT viewport; ID3D11Buffer *m_vertexBuffer, *m_indexBuffer; ID3D11Buffer *m_matrixBuffer; + ID3D11Buffer *m_psBuffer; int m_screenWidth, m_screenHeight; int m_bitmapWidth, m_bitmapHeight; int m_bitmapWidth2, m_bitmapHeight2; @@ -344,6 +348,14 @@ struct MatrixBufferType D3DXMATRIX projection; }; +struct PSBufferType +{ + float brightness; + float contrast; + float d2; + float d3; +}; + static struct d3d11struct d3d11data[MAX_AMIGAMONITORS]; typedef HRESULT (WINAPI* CREATEDXGIFACTORY1)(REFIID riid, void **ppFactory); @@ -1871,7 +1883,11 @@ static bool allocsprite(struct d3d11struct *d3d, struct d3d11sprite *s, int widt if (!InitializeBuffers(d3d, &s->vertexbuffer, &s->indexbuffer)) goto err; - hr = d3d->m_device->CreatePixelShader(PS_PostPlain, sizeof(PS_PostPlain), NULL, &s->pixelshader); + if (gfx_hdr) { + hr = d3d->m_device->CreatePixelShader(PS_PostPlain_HDR, sizeof(PS_PostPlain_HDR), NULL, &s->pixelshader); + } else { + hr = d3d->m_device->CreatePixelShader(PS_PostPlain, sizeof(PS_PostPlain), NULL, &s->pixelshader); + } if (FAILED(hr)) goto err; @@ -1999,7 +2015,7 @@ static bool CreateTexture(struct d3d11struct *d3d) } ID3D11Texture2D *pSurface; - hr = d3d->m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast< void** >(&pSurface)); + hr = d3d->m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast(&pSurface)); if (SUCCEEDED(hr)) { memset(&desc, 0, sizeof desc); pSurface->GetDesc(&desc); @@ -2570,7 +2586,13 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename) if (FAILED(hr)) goto end; for (int i = 0; i < img.height; i++) { - memcpy((uae_u8*)map.pData + i * map.RowPitch, img.data + i * img.pitch, img.width * 4); + for (int j = 0; j < img.width; j++) { + uae_u32 v; + uae_u32 *sptr = (uae_u32*)((uae_u8*)img.data + i * img.pitch + j * 4); + uae_u32 *ptr = (uae_u32*)((uae_u8*)map.pData + i * map.RowPitch + j * 4); + v = *sptr; + *ptr = v; + } } d3d->m_deviceContext->Unmap(d3d->mask2texture.texture, 0); @@ -2800,7 +2822,7 @@ static int createmasktexture(struct d3d11struct *d3d, const TCHAR *filename, str srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.Texture2D.MostDetailedMip = 0; srvDesc.Texture2D.MipLevels = desc.MipLevels; - srvDesc.Format = d3d->scrformat; + srvDesc.Format = d3d->texformat; hr = d3d->m_device->CreateShaderResourceView(sd->masktexture, &srvDesc, &sd->masktexturerv); if (FAILED(hr)) { @@ -2861,26 +2883,50 @@ static bool TextureShaderClass_InitializeShader(struct d3d11struct *d3d) int BufferSize = 0; char *name; - switch (i) - { - case 0: - name = "PS_PostPlain"; - ps = &d3d->m_pixelShader; - Buffer = PS_PostPlain; - BufferSize = sizeof(PS_PostPlain); - break; - case 1: - name = "PS_PostMask"; - ps = &d3d->m_pixelShaderMask; - Buffer = PS_PostMask; - BufferSize = sizeof(PS_PostMask); - break; - case 2: - name = "PS_PostAlpha"; - ps = &d3d->m_pixelShaderSL; - Buffer = PS_PostAlpha; - BufferSize = sizeof(PS_PostAlpha); - break; + if (gfx_hdr) { + switch (i) + { + case 0: + name = "PS_PostPlain_HDR"; + ps = &d3d->m_pixelShader; + Buffer = PS_PostPlain_HDR; + BufferSize = sizeof(PS_PostPlain_HDR); + break; + case 1: + name = "PS_PostMask_HDR"; + ps = &d3d->m_pixelShaderMask; + Buffer = PS_PostMask_HDR; + BufferSize = sizeof(PS_PostMask_HDR); + break; + case 2: + name = "PS_PostAlpha_HDR"; + ps = &d3d->m_pixelShaderSL; + Buffer = PS_PostAlpha_HDR; + BufferSize = sizeof(PS_PostAlpha_HDR); + break; + } + } else { + switch (i) + { + case 0: + name = "PS_PostPlain"; + ps = &d3d->m_pixelShader; + Buffer = PS_PostPlain; + BufferSize = sizeof(PS_PostPlain); + break; + case 1: + name = "PS_PostMask"; + ps = &d3d->m_pixelShaderMask; + Buffer = PS_PostMask; + BufferSize = sizeof(PS_PostMask); + break; + case 2: + name = "PS_PostAlpha"; + ps = &d3d->m_pixelShaderSL; + Buffer = PS_PostAlpha; + BufferSize = sizeof(PS_PostAlpha); + break; + } } // Create the pixel shader from the buffer. result = d3d->m_device->CreatePixelShader(Buffer, BufferSize, NULL, ps); @@ -2898,6 +2944,21 @@ static bool TextureShaderClass_InitializeShader(struct d3d11struct *d3d) pixelShaderBuffer->Release(); pixelShaderBuffer = 0; } + + D3D11_BUFFER_DESC psBufferDesc; + psBufferDesc.Usage = D3D11_USAGE_DYNAMIC; + psBufferDesc.ByteWidth = sizeof(PSBufferType); + psBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + psBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + psBufferDesc.MiscFlags = 0; + psBufferDesc.StructureByteStride = 0; + result = d3d->m_device->CreateBuffer(&psBufferDesc, NULL, &d3d->m_psBuffer); + if (FAILED(result)) + { + write_log(_T("ID3D11Device CreateBuffer(ps) %08x\n"), result); + return false; + } + } if (!createvertexshader(d3d, &d3d->m_vertexShader, &d3d->m_matrixBuffer, &d3d->m_layout)) @@ -3466,13 +3527,18 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t desc1.WhitePoint[0], desc1.WhitePoint[1]); write_log(_T("MinL=%f MaxL=%f MaxFFL=%f\n"), desc1.MinLuminance, desc1.MaxLuminance, desc1.MaxFullFrameLuminance); - d3d->hdr = desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 && currprefs.gfx_hdr; + d3d->hdr = desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; + if (currprefs.gfx_api < 3) { + d3d->hdr = false; + } } adapterOutputx = adapterOutput6; } if (d3d->hdr) { + //d3d->scrformat = DXGI_FORMAT_R10G10B10A2_UNORM; d3d->scrformat = DXGI_FORMAT_R16G16B16A16_FLOAT; + gfx_hdr = true; } // Get the number of modes that fit the display format for the adapter output (monitor). @@ -3748,17 +3814,34 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t CComPtr m_swapChain3; if (SUCCEEDED(d3d->m_swapChain->QueryInterface(&m_swapChain3))) { if (d3d->hdr) { - UINT cps; - result = m_swapChain3->CheckColorSpaceSupport(DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709, &cps); - if (SUCCEEDED(result)) { - if (!(cps & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) - write_log(_T("CheckColorSpaceSupport(DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709) not supported!?\n")); - result = m_swapChain3->SetColorSpace1(DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709); - if (FAILED(result)) { - write_log(_T("SetColorSpace1 failed %08x\n"), result); + if (d3d->scrformat == DXGI_FORMAT_R10G10B10A2_UNORM) { + DXGI_COLOR_SPACE_TYPE type = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; + UINT cps; + result = m_swapChain3->CheckColorSpaceSupport(type, &cps); + if (SUCCEEDED(result)) { + if (!(cps & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) + write_log(_T("CheckColorSpaceSupport(DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) not supported!?\n")); + result = m_swapChain3->SetColorSpace1(type); + if (FAILED(result)) { + write_log(_T("SetColorSpace1 failed %08x\n"), result); + } + } else { + write_log(_T("CheckColorSpaceSupport failed %08x\n"), result); } } else { - write_log(_T("CheckColorSpaceSupport failed %08x\n"), result); + DXGI_COLOR_SPACE_TYPE type = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;; + UINT cps; + result = m_swapChain3->CheckColorSpaceSupport(type, &cps); + if (SUCCEEDED(result)) { + if (!(cps & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) + write_log(_T("CheckColorSpaceSupport(DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709) not supported!?\n")); + result = m_swapChain3->SetColorSpace1(type); + if (FAILED(result)) { + write_log(_T("SetColorSpace1 failed %08x\n"), result); + } + } else { + write_log(_T("CheckColorSpaceSupport failed %08x\n"), result); + } } } IDXGIOutput* dxgiOutput = NULL; @@ -3901,6 +3984,10 @@ static void freed3d(struct d3d11struct *d3d) d3d->m_matrixBuffer->Release(); d3d->m_matrixBuffer = 0; } + if (d3d->m_psBuffer) { + d3d->m_psBuffer->Release(); + d3d->m_psBuffer = 0; + } FreeTextures(d3d); FreeTexture2D(&d3d->sltexture, &d3d->sltexturerv); @@ -3995,6 +4082,32 @@ static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int dep return _T("D3D11 INITIALIZATION ERROR"); } +static void setpsbuffer(struct d3d11struct *d3d, ID3D11Buffer *psbuffer) +{ + HRESULT result; + PSBufferType *dataPtr; + D3D11_MAPPED_SUBRESOURCE mappedResource; + + // Lock the constant buffer so it can be written to. + result = d3d->m_deviceContext->Map(psbuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); + if (FAILED(result)) + { + write_log(_T("ID3D11DeviceContext map(ps) %08x\n"), result); + return; + } + + float bri = ((float)(currprefs.gfx_luminance)) * (1.0f / 2000.0f) + 1.0; + float con = ((float)(currprefs.gfx_contrast + 2000)) / 2000.0f; + + // Get a pointer to the data in the constant buffer. + dataPtr = (PSBufferType *)mappedResource.pData; + dataPtr->brightness = bri; + dataPtr->contrast = con; + + // Unlock the constant buffer. + d3d->m_deviceContext->Unmap(psbuffer, 0); +} + static bool setmatrix(struct d3d11struct *d3d, ID3D11Buffer *matrixbuffer, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix) { HRESULT result; @@ -4310,6 +4423,10 @@ static bool renderframe(struct d3d11struct *d3d) // Now set the constant buffer in the vertex shader with the updated values. d3d->m_deviceContext->VSSetConstantBuffers(0, 1, &d3d->m_matrixBuffer); + setpsbuffer(d3d, d3d->m_psBuffer); + + d3d->m_deviceContext->PSSetConstantBuffers(0, 1, &d3d->m_psBuffer); + ID3D11RenderTargetView *lpRenderTarget = NULL; // Bind the render target view and depth stencil buffer to the output render pipeline. @@ -4516,7 +4633,7 @@ static bool restore(struct d3d11struct *d3d) desc.Height = 16; desc.Depth = 256; desc.MipLevels = 1; - desc.Format = d3d->scrformat; + desc.Format = d3d->texformat; desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -4539,7 +4656,7 @@ static bool restore(struct d3d11struct *d3d) srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; srvDesc.Texture2D.MostDetailedMip = 0; srvDesc.Texture2D.MipLevels = 1; - srvDesc.Format = d3d->scrformat; + srvDesc.Format = d3d->texformat; hr = d3d->m_device->CreateShaderResourceView(d3d->shaders[i].lpHq2xLookupTexture, &srvDesc, &d3d->shaders[i].lpHq2xLookupTexturerv); if (FAILED(hr)) { write_log(_T("D3D11 Failed to create volume texture resource view: %08x:%d\n"), hr, i); @@ -5260,7 +5377,7 @@ void d3d11_select(void) void d3d_select(struct uae_prefs *p) { - if (p->gfx_api == 2) + if (p->gfx_api >= 2) d3d11_select(); else d3d9_select(); diff --git a/od-win32/shaders/PixelShaderAlpha_HDR.h b/od-win32/shaders/PixelShaderAlpha_HDR.h new file mode 100644 index 00000000..0623edc6 --- /dev/null +++ b/od-win32/shaders/PixelShaderAlpha_HDR.h @@ -0,0 +1,711 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Buffer Definitions: +// +// cbuffer PS_CONSTANT_BUFFER +// { +// +// float brightness; // Offset: 0 Size: 4 +// float contrast; // Offset: 4 Size: 4 +// float d2; // Offset: 8 Size: 4 [unused] +// float d3; // Offset: 12 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// SampleTypeClamp sampler NA NA s0 1 +// SampleTypeWrap sampler NA NA s1 1 +// shaderTexture texture float4 2d t0 1 +// maskTexture texture float4 2d t1 1 +// PS_CONSTANT_BUFFER cbuffer NA NA cb0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +// +// Constant buffer to DX9 shader constant mappings: +// +// Target Reg Buffer Start Reg # of Regs Data Conversion +// ---------- ------- --------- --------- ---------------------- +// c0 cb0 0 1 ( FLT, FLT, FLT, FLT) +// +// +// Sampler/Resource to DX9 shader sampler mappings: +// +// Target Sampler Source Sampler Source Resource +// -------------- --------------- ---------------- +// s0 s0 t0 +// s1 s1 t1 +// +// +// Level9 shader bytecode: +// + ps_2_x + def c1, -0.0078125, -0.5, -0, -1 + def c2, -0.0404499993, 0.0773993805, 0.0549999997, 0.947867334 + def c3, 2.4000001, 3.75, 9.99999975e-005, 0 + dcl t0 + dcl_2d s0 + dcl_2d s1 + mov r0.xy, t0.wzzw + texld r1, t0, s0 + texld r0, r0, s1 + add r2, r0.wxyz, c1.xyyy + mov r3.w, c1.y + mad r2.yzw, r2, c0.y, -r3.w + cmp r2.x, r2.x, c1.z, c1.w + cmp r2.x, -r0.w, -c1.z, r2.x + mov r3.x, c0.x + mad r4.xyz, r2.yzww, r3.x, c2.z + mul r4.xyz, r4, c2.w + log r5.x, r4.x + log r5.y, r4.y + log r5.z, r4.z + mul r4.xyz, r5, c3.x + exp r5.x, r4.x + exp r5.y, r4.y + exp r5.z, r4.z + mul r4.xyz, r2.yzww, c0.x + mad r2.yzw, r2, r3.x, c2.x + mul r4.xyz, r4, c2.y + cmp r2.yzw, r2, r5.xxyz, r4.xxyz + mad r0.xyz, r2.yzww, c3.y, c3.z + cmp r0, r2.x, r0, -c1.z + add r2, r1.wxyz, c1.xyyy + mad r2.yzw, r2, c0.y, -r3.w + cmp r2.x, r2.x, c1.z, c1.w + cmp r2.x, -r1.w, -c1.z, r2.x + mad r3.yzw, r2, r3.x, c2.z + mul r3.yzw, r3, c2.w + log r4.x, r3.y + log r4.y, r3.z + log r4.z, r3.w + mul r3.yzw, r4.xxyz, c3.x + exp r4.x, r3.y + exp r4.y, r3.z + exp r4.z, r3.w + mul r3.yzw, r2, c0.x + mad r2.yzw, r2, r3.x, c2.x + mul r3.xyz, r3.yzww, c2.y + cmp r2.yzw, r2, r4.xxyz, r3.xxyz + mad r1.xyz, r2.yzww, c3.y, c3.z + cmp r1, r2.x, r1, -c1.z + lrp r2, r0.w, r0, r1 + mov oC0, r2 + +// approximately 45 instruction slots used (2 texture, 43 arithmetic) +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_input_ps linear v1.zw +dcl_output o0.xyzw +dcl_temps 5 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +add r1.xyz, r0.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000) +mad r1.xyz, r1.xyzx, cb0[0].yyyy, l(0.500000, 0.500000, 0.500000, 0.000000) +mad r2.xyz, r1.xyzx, cb0[0].xxxx, l(0.055000, 0.055000, 0.055000, 0.000000) +mul r1.xyz, r1.xyzx, cb0[0].xxxx +mul r2.xyz, r2.xyzx, l(0.947867, 0.947867, 0.947867, 0.000000) +log r2.xyz, r2.xyzx +mul r2.xyz, r2.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000) +exp r2.xyz, r2.xyzx +lt r3.xyz, r1.xyzx, l(0.040450, 0.040450, 0.040450, 0.000000) +mul r1.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000) +movc r1.xyz, r3.xyzx, r1.xyzx, r2.xyzx +mad r0.xyz, r1.xyzx, l(3.750000, 3.750000, 3.750000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000) +lt r1.x, l(0.000000), r0.w +lt r1.y, r0.w, l(0.007812) +and r1.x, r1.y, r1.x +movc r0.xyzw, r1.xxxx, l(0,0,0,0), r0.xyzw +sample r1.xyzw, v1.zwzz, t1.xyzw, s1 +add r2.xyz, r1.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000) +mad r2.xyz, r2.xyzx, cb0[0].yyyy, l(0.500000, 0.500000, 0.500000, 0.000000) +mad r3.xyz, r2.xyzx, cb0[0].xxxx, l(0.055000, 0.055000, 0.055000, 0.000000) +mul r2.xyz, r2.xyzx, cb0[0].xxxx +mul r3.xyz, r3.xyzx, l(0.947867, 0.947867, 0.947867, 0.000000) +log r3.xyz, r3.xyzx +mul r3.xyz, r3.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000) +exp r3.xyz, r3.xyzx +lt r4.xyz, r2.xyzx, l(0.040450, 0.040450, 0.040450, 0.000000) +mul r2.xyz, r2.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000) +movc r2.xyz, r4.xyzx, r2.xyzx, r3.xyzx +mad r1.xyz, r2.xyzx, l(3.750000, 3.750000, 3.750000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000) +lt r2.x, l(0.000000), r1.w +lt r2.y, r1.w, l(0.007812) +and r2.x, r2.y, r2.x +movc r1.xyzw, r2.xxxx, l(0,0,0,0), r1.xyzw +add r2.x, -r1.w, l(1.000000) +mul r1.xyzw, r1.wwww, r1.xyzw +mad o0.xyzw, r0.xyzw, r2.xxxx, r1.xyzw +ret +// Approximately 38 instruction slots used +#endif + +const BYTE PS_PostAlpha_HDR[] = +{ + 68, 88, 66, 67, 244, 115, + 68, 17, 218, 169, 14, 106, + 223, 46, 141, 196, 155, 126, + 101, 15, 1, 0, 0, 0, + 164, 12, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 192, 3, 0, 0, 168, 9, + 0, 0, 36, 10, 0, 0, + 0, 12, 0, 0, 112, 12, + 0, 0, 65, 111, 110, 57, + 128, 3, 0, 0, 128, 3, + 0, 0, 0, 2, 255, 255, + 72, 3, 0, 0, 56, 0, + 0, 0, 1, 0, 44, 0, + 0, 0, 56, 0, 0, 0, + 56, 0, 2, 0, 36, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 1, 2, 255, 255, 81, 0, + 0, 5, 1, 0, 15, 160, + 0, 0, 0, 188, 0, 0, + 0, 191, 0, 0, 0, 128, + 0, 0, 128, 191, 81, 0, + 0, 5, 2, 0, 15, 160, + 230, 174, 37, 189, 145, 131, + 158, 61, 174, 71, 97, 61, + 111, 167, 114, 63, 81, 0, + 0, 5, 3, 0, 15, 160, + 154, 153, 25, 64, 0, 0, + 112, 64, 23, 183, 209, 56, + 0, 0, 0, 0, 31, 0, + 0, 2, 0, 0, 0, 128, + 0, 0, 15, 176, 31, 0, + 0, 2, 0, 0, 0, 144, + 0, 8, 15, 160, 31, 0, + 0, 2, 0, 0, 0, 144, + 1, 8, 15, 160, 1, 0, + 0, 2, 0, 0, 3, 128, + 0, 0, 235, 176, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 0, 8, + 228, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 128, 1, 8, 228, 160, + 2, 0, 0, 3, 2, 0, + 15, 128, 0, 0, 147, 128, + 1, 0, 84, 160, 1, 0, + 0, 2, 3, 0, 8, 128, + 1, 0, 85, 160, 4, 0, + 0, 4, 2, 0, 14, 128, + 2, 0, 228, 128, 0, 0, + 85, 160, 3, 0, 255, 129, + 88, 0, 0, 4, 2, 0, + 1, 128, 2, 0, 0, 128, + 1, 0, 170, 160, 1, 0, + 255, 160, 88, 0, 0, 4, + 2, 0, 1, 128, 0, 0, + 255, 129, 1, 0, 170, 161, + 2, 0, 0, 128, 1, 0, + 0, 2, 3, 0, 1, 128, + 0, 0, 0, 160, 4, 0, + 0, 4, 4, 0, 7, 128, + 2, 0, 249, 128, 3, 0, + 0, 128, 2, 0, 170, 160, + 5, 0, 0, 3, 4, 0, + 7, 128, 4, 0, 228, 128, + 2, 0, 255, 160, 15, 0, + 0, 2, 5, 0, 1, 128, + 4, 0, 0, 128, 15, 0, + 0, 2, 5, 0, 2, 128, + 4, 0, 85, 128, 15, 0, + 0, 2, 5, 0, 4, 128, + 4, 0, 170, 128, 5, 0, + 0, 3, 4, 0, 7, 128, + 5, 0, 228, 128, 3, 0, + 0, 160, 14, 0, 0, 2, + 5, 0, 1, 128, 4, 0, + 0, 128, 14, 0, 0, 2, + 5, 0, 2, 128, 4, 0, + 85, 128, 14, 0, 0, 2, + 5, 0, 4, 128, 4, 0, + 170, 128, 5, 0, 0, 3, + 4, 0, 7, 128, 2, 0, + 249, 128, 0, 0, 0, 160, + 4, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 3, 0, 0, 128, 2, 0, + 0, 160, 5, 0, 0, 3, + 4, 0, 7, 128, 4, 0, + 228, 128, 2, 0, 85, 160, + 88, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 5, 0, 144, 128, 4, 0, + 144, 128, 4, 0, 0, 4, + 0, 0, 7, 128, 2, 0, + 249, 128, 3, 0, 85, 160, + 3, 0, 170, 160, 88, 0, + 0, 4, 0, 0, 15, 128, + 2, 0, 0, 128, 0, 0, + 228, 128, 1, 0, 170, 161, + 2, 0, 0, 3, 2, 0, + 15, 128, 1, 0, 147, 128, + 1, 0, 84, 160, 4, 0, + 0, 4, 2, 0, 14, 128, + 2, 0, 228, 128, 0, 0, + 85, 160, 3, 0, 255, 129, + 88, 0, 0, 4, 2, 0, + 1, 128, 2, 0, 0, 128, + 1, 0, 170, 160, 1, 0, + 255, 160, 88, 0, 0, 4, + 2, 0, 1, 128, 1, 0, + 255, 129, 1, 0, 170, 161, + 2, 0, 0, 128, 4, 0, + 0, 4, 3, 0, 14, 128, + 2, 0, 228, 128, 3, 0, + 0, 128, 2, 0, 170, 160, + 5, 0, 0, 3, 3, 0, + 14, 128, 3, 0, 228, 128, + 2, 0, 255, 160, 15, 0, + 0, 2, 4, 0, 1, 128, + 3, 0, 85, 128, 15, 0, + 0, 2, 4, 0, 2, 128, + 3, 0, 170, 128, 15, 0, + 0, 2, 4, 0, 4, 128, + 3, 0, 255, 128, 5, 0, + 0, 3, 3, 0, 14, 128, + 4, 0, 144, 128, 3, 0, + 0, 160, 14, 0, 0, 2, + 4, 0, 1, 128, 3, 0, + 85, 128, 14, 0, 0, 2, + 4, 0, 2, 128, 3, 0, + 170, 128, 14, 0, 0, 2, + 4, 0, 4, 128, 3, 0, + 255, 128, 5, 0, 0, 3, + 3, 0, 14, 128, 2, 0, + 228, 128, 0, 0, 0, 160, + 4, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 3, 0, 0, 128, 2, 0, + 0, 160, 5, 0, 0, 3, + 3, 0, 7, 128, 3, 0, + 249, 128, 2, 0, 85, 160, + 88, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 4, 0, 144, 128, 3, 0, + 144, 128, 4, 0, 0, 4, + 1, 0, 7, 128, 2, 0, + 249, 128, 3, 0, 85, 160, + 3, 0, 170, 160, 88, 0, + 0, 4, 1, 0, 15, 128, + 2, 0, 0, 128, 1, 0, + 228, 128, 1, 0, 170, 161, + 18, 0, 0, 4, 2, 0, + 15, 128, 0, 0, 255, 128, + 0, 0, 228, 128, 1, 0, + 228, 128, 1, 0, 0, 2, + 0, 8, 15, 128, 2, 0, + 228, 128, 255, 255, 0, 0, + 83, 72, 68, 82, 224, 5, + 0, 0, 64, 0, 0, 0, + 120, 1, 0, 0, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 1, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 1, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 194, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 5, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 191, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 0, 50, 0, + 0, 13, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 86, 133, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 174, 71, 97, 61, + 174, 71, 97, 61, 174, 71, + 97, 61, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 111, 167, 114, 63, + 111, 167, 114, 63, 111, 167, + 114, 63, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 154, 153, 25, 64, + 154, 153, 25, 64, 154, 153, + 25, 64, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 49, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 230, 174, 37, 61, + 230, 174, 37, 61, 230, 174, + 37, 61, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 145, 131, 158, 61, 145, 131, + 158, 61, 145, 131, 158, 61, + 0, 0, 0, 0, 55, 0, + 0, 9, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 15, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 112, 64, 0, 0, 112, 64, + 0, 0, 112, 64, 0, 0, + 0, 0, 2, 64, 0, 0, + 23, 183, 209, 56, 23, 183, + 209, 56, 23, 183, 209, 56, + 0, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 49, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 60, + 1, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 26, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 55, 0, + 0, 12, 242, 0, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 230, 26, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 86, 133, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 0, 0, + 50, 0, 0, 13, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 174, 71, 97, 61, 174, 71, + 97, 61, 174, 71, 97, 61, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 111, 167, 114, 63, 111, 167, + 114, 63, 111, 167, 114, 63, + 0, 0, 0, 0, 47, 0, + 0, 5, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 154, 153, 25, 64, 154, 153, + 25, 64, 154, 153, 25, 64, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 3, 0, 0, 0, + 49, 0, 0, 10, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 230, 174, 37, 61, 230, 174, + 37, 61, 230, 174, 37, 61, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 145, 131, + 158, 61, 145, 131, 158, 61, + 145, 131, 158, 61, 0, 0, + 0, 0, 55, 0, 0, 9, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 112, 64, + 0, 0, 112, 64, 0, 0, + 112, 64, 0, 0, 0, 0, + 2, 64, 0, 0, 23, 183, + 209, 56, 23, 183, 209, 56, + 23, 183, 209, 56, 0, 0, + 0, 0, 49, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 1, 0, 0, 0, + 49, 0, 0, 7, 34, 0, + 16, 0, 2, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 60, 1, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 26, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 2, 0, + 0, 0, 55, 0, 0, 12, + 242, 0, 16, 0, 1, 0, + 0, 0, 6, 0, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 8, + 18, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 128, + 65, 0, 0, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 56, 0, + 0, 7, 242, 0, 16, 0, + 1, 0, 0, 0, 246, 15, + 16, 0, 1, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 9, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 38, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 29, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 82, 68, + 69, 70, 212, 1, 0, 0, + 1, 0, 0, 0, 8, 1, + 0, 0, 5, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 171, 1, 0, 0, 188, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 204, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 219, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 12, 0, 0, 0, 233, 0, + 0, 0, 2, 0, 0, 0, + 5, 0, 0, 0, 4, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 1, 0, + 0, 0, 12, 0, 0, 0, + 245, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 83, 97, 109, 112, + 108, 101, 84, 121, 112, 101, + 67, 108, 97, 109, 112, 0, + 83, 97, 109, 112, 108, 101, + 84, 121, 112, 101, 87, 114, + 97, 112, 0, 115, 104, 97, + 100, 101, 114, 84, 101, 120, + 116, 117, 114, 101, 0, 109, + 97, 115, 107, 84, 101, 120, + 116, 117, 114, 101, 0, 80, + 83, 95, 67, 79, 78, 83, + 84, 65, 78, 84, 95, 66, + 85, 70, 70, 69, 82, 0, + 245, 0, 0, 0, 4, 0, + 0, 0, 32, 1, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 1, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 156, 1, 0, 0, 4, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 165, 1, 0, 0, 8, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 168, 1, 0, 0, 12, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 98, 114, 105, 103, 104, 116, + 110, 101, 115, 115, 0, 171, + 0, 0, 3, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 99, 111, + 110, 116, 114, 97, 115, 116, + 0, 100, 50, 0, 100, 51, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 49, 48, 46, 49, 0, 171, + 73, 83, 71, 78, 104, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 92, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 12, 12, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 84, + 65, 82, 71, 69, 84, 0, + 171, 171 +}; diff --git a/od-win32/shaders/PixelShaderAlpha_HDR.hlsl b/od-win32/shaders/PixelShaderAlpha_HDR.hlsl new file mode 100644 index 00000000..2fd7a928 --- /dev/null +++ b/od-win32/shaders/PixelShaderAlpha_HDR.hlsl @@ -0,0 +1,11 @@ + +#include "PixelShader_HDR.hlsl" + +float4 PS_PostAlpha_HDR(PixelInputType input) : SV_TARGET +{ + float4 textureColor = shaderTexture.Sample(SampleTypeClamp, input.tex); + textureColor = ConvertToHDR(textureColor); + float4 maskColor = maskTexture.Sample(SampleTypeWrap, input.sl); + maskColor = ConvertToHDR(maskColor); + return textureColor * (1 - maskColor.a) + (maskColor * maskColor.a); +} diff --git a/od-win32/shaders/PixelShaderMask_HDR.h b/od-win32/shaders/PixelShaderMask_HDR.h new file mode 100644 index 00000000..6b5668e6 --- /dev/null +++ b/od-win32/shaders/PixelShaderMask_HDR.h @@ -0,0 +1,697 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Buffer Definitions: +// +// cbuffer PS_CONSTANT_BUFFER +// { +// +// float brightness; // Offset: 0 Size: 4 +// float contrast; // Offset: 4 Size: 4 +// float d2; // Offset: 8 Size: 4 [unused] +// float d3; // Offset: 12 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// SampleTypeClamp sampler NA NA s0 1 +// SampleTypeWrap sampler NA NA s1 1 +// shaderTexture texture float4 2d t0 1 +// maskTexture texture float4 2d t1 1 +// PS_CONSTANT_BUFFER cbuffer NA NA cb0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +// +// Constant buffer to DX9 shader constant mappings: +// +// Target Reg Buffer Start Reg # of Regs Data Conversion +// ---------- ------- --------- --------- ---------------------- +// c0 cb0 0 1 ( FLT, FLT, FLT, FLT) +// +// +// Sampler/Resource to DX9 shader sampler mappings: +// +// Target Sampler Source Sampler Source Resource +// -------------- --------------- ---------------- +// s0 s0 t0 +// s1 s1 t1 +// +// +// Level9 shader bytecode: +// + ps_2_x + def c1, -0.0078125, -0.5, -0, -1 + def c2, -0.0404499993, 0.0773993805, 0.0549999997, 0.947867334 + def c3, 2.4000001, 3.75, 9.99999975e-005, 0 + dcl t0 + dcl_2d s0 + dcl_2d s1 + mov r0.xy, t0.wzzw + texld r1, t0, s0 + texld r0, r0, s1 + add r2, r0.wxyz, c1.xyyy + mov r3.w, c1.y + mad r2.yzw, r2, c0.y, -r3.w + cmp r2.x, r2.x, c1.z, c1.w + cmp r2.x, -r0.w, -c1.z, r2.x + mov r3.x, c0.x + mad r4.xyz, r2.yzww, r3.x, c2.z + mul r4.xyz, r4, c2.w + log r5.x, r4.x + log r5.y, r4.y + log r5.z, r4.z + mul r4.xyz, r5, c3.x + exp r5.x, r4.x + exp r5.y, r4.y + exp r5.z, r4.z + mul r4.xyz, r2.yzww, c0.x + mad r2.yzw, r2, r3.x, c2.x + mul r4.xyz, r4, c2.y + cmp r2.yzw, r2, r5.xxyz, r4.xxyz + mad r0.xyz, r2.yzww, c3.y, c3.z + cmp r0, r2.x, r0, -c1.z + add r2, r1.wxyz, c1.xyyy + mad r2.yzw, r2, c0.y, -r3.w + cmp r2.x, r2.x, c1.z, c1.w + cmp r2.x, -r1.w, -c1.z, r2.x + mad r3.yzw, r2, r3.x, c2.z + mul r3.yzw, r3, c2.w + log r4.x, r3.y + log r4.y, r3.z + log r4.z, r3.w + mul r3.yzw, r4.xxyz, c3.x + exp r4.x, r3.y + exp r4.y, r3.z + exp r4.z, r3.w + mul r3.yzw, r2, c0.x + mad r2.yzw, r2, r3.x, c2.x + mul r3.xyz, r3.yzww, c2.y + cmp r2.yzw, r2, r4.xxyz, r3.xxyz + mad r1.xyz, r2.yzww, c3.y, c3.z + cmp r1, r2.x, r1, -c1.z + mul r0, r0, r1 + mov oC0, r0 + +// approximately 45 instruction slots used (2 texture, 43 arithmetic) +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_sampler s1, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_input_ps linear v1.zw +dcl_output o0.xyzw +dcl_temps 5 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +add r1.xyz, r0.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000) +mad r1.xyz, r1.xyzx, cb0[0].yyyy, l(0.500000, 0.500000, 0.500000, 0.000000) +mad r2.xyz, r1.xyzx, cb0[0].xxxx, l(0.055000, 0.055000, 0.055000, 0.000000) +mul r1.xyz, r1.xyzx, cb0[0].xxxx +mul r2.xyz, r2.xyzx, l(0.947867, 0.947867, 0.947867, 0.000000) +log r2.xyz, r2.xyzx +mul r2.xyz, r2.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000) +exp r2.xyz, r2.xyzx +lt r3.xyz, r1.xyzx, l(0.040450, 0.040450, 0.040450, 0.000000) +mul r1.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000) +movc r1.xyz, r3.xyzx, r1.xyzx, r2.xyzx +mad r0.xyz, r1.xyzx, l(3.750000, 3.750000, 3.750000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000) +lt r1.x, l(0.000000), r0.w +lt r1.y, r0.w, l(0.007812) +and r1.x, r1.y, r1.x +movc r0.xyzw, r1.xxxx, l(0,0,0,0), r0.xyzw +sample r1.xyzw, v1.zwzz, t1.xyzw, s1 +add r2.xyz, r1.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000) +mad r2.xyz, r2.xyzx, cb0[0].yyyy, l(0.500000, 0.500000, 0.500000, 0.000000) +mad r3.xyz, r2.xyzx, cb0[0].xxxx, l(0.055000, 0.055000, 0.055000, 0.000000) +mul r2.xyz, r2.xyzx, cb0[0].xxxx +mul r3.xyz, r3.xyzx, l(0.947867, 0.947867, 0.947867, 0.000000) +log r3.xyz, r3.xyzx +mul r3.xyz, r3.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000) +exp r3.xyz, r3.xyzx +lt r4.xyz, r2.xyzx, l(0.040450, 0.040450, 0.040450, 0.000000) +mul r2.xyz, r2.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000) +movc r2.xyz, r4.xyzx, r2.xyzx, r3.xyzx +mad r1.xyz, r2.xyzx, l(3.750000, 3.750000, 3.750000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000) +lt r2.x, l(0.000000), r1.w +lt r2.y, r1.w, l(0.007812) +and r2.x, r2.y, r2.x +movc r1.xyzw, r2.xxxx, l(0,0,0,0), r1.xyzw +mul o0.xyzw, r0.xyzw, r1.xyzw +ret +// Approximately 36 instruction slots used +#endif + +const BYTE PS_PostMask_HDR[] = +{ + 68, 88, 66, 67, 135, 212, + 86, 2, 45, 7, 250, 124, + 106, 8, 49, 161, 30, 247, + 114, 4, 1, 0, 0, 0, + 92, 12, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 188, 3, 0, 0, 96, 9, + 0, 0, 220, 9, 0, 0, + 184, 11, 0, 0, 40, 12, + 0, 0, 65, 111, 110, 57, + 124, 3, 0, 0, 124, 3, + 0, 0, 0, 2, 255, 255, + 68, 3, 0, 0, 56, 0, + 0, 0, 1, 0, 44, 0, + 0, 0, 56, 0, 0, 0, + 56, 0, 2, 0, 36, 0, + 0, 0, 56, 0, 0, 0, + 0, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 1, 2, 255, 255, 81, 0, + 0, 5, 1, 0, 15, 160, + 0, 0, 0, 188, 0, 0, + 0, 191, 0, 0, 0, 128, + 0, 0, 128, 191, 81, 0, + 0, 5, 2, 0, 15, 160, + 230, 174, 37, 189, 145, 131, + 158, 61, 174, 71, 97, 61, + 111, 167, 114, 63, 81, 0, + 0, 5, 3, 0, 15, 160, + 154, 153, 25, 64, 0, 0, + 112, 64, 23, 183, 209, 56, + 0, 0, 0, 0, 31, 0, + 0, 2, 0, 0, 0, 128, + 0, 0, 15, 176, 31, 0, + 0, 2, 0, 0, 0, 144, + 0, 8, 15, 160, 31, 0, + 0, 2, 0, 0, 0, 144, + 1, 8, 15, 160, 1, 0, + 0, 2, 0, 0, 3, 128, + 0, 0, 235, 176, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 0, 8, + 228, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 128, 1, 8, 228, 160, + 2, 0, 0, 3, 2, 0, + 15, 128, 0, 0, 147, 128, + 1, 0, 84, 160, 1, 0, + 0, 2, 3, 0, 8, 128, + 1, 0, 85, 160, 4, 0, + 0, 4, 2, 0, 14, 128, + 2, 0, 228, 128, 0, 0, + 85, 160, 3, 0, 255, 129, + 88, 0, 0, 4, 2, 0, + 1, 128, 2, 0, 0, 128, + 1, 0, 170, 160, 1, 0, + 255, 160, 88, 0, 0, 4, + 2, 0, 1, 128, 0, 0, + 255, 129, 1, 0, 170, 161, + 2, 0, 0, 128, 1, 0, + 0, 2, 3, 0, 1, 128, + 0, 0, 0, 160, 4, 0, + 0, 4, 4, 0, 7, 128, + 2, 0, 249, 128, 3, 0, + 0, 128, 2, 0, 170, 160, + 5, 0, 0, 3, 4, 0, + 7, 128, 4, 0, 228, 128, + 2, 0, 255, 160, 15, 0, + 0, 2, 5, 0, 1, 128, + 4, 0, 0, 128, 15, 0, + 0, 2, 5, 0, 2, 128, + 4, 0, 85, 128, 15, 0, + 0, 2, 5, 0, 4, 128, + 4, 0, 170, 128, 5, 0, + 0, 3, 4, 0, 7, 128, + 5, 0, 228, 128, 3, 0, + 0, 160, 14, 0, 0, 2, + 5, 0, 1, 128, 4, 0, + 0, 128, 14, 0, 0, 2, + 5, 0, 2, 128, 4, 0, + 85, 128, 14, 0, 0, 2, + 5, 0, 4, 128, 4, 0, + 170, 128, 5, 0, 0, 3, + 4, 0, 7, 128, 2, 0, + 249, 128, 0, 0, 0, 160, + 4, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 3, 0, 0, 128, 2, 0, + 0, 160, 5, 0, 0, 3, + 4, 0, 7, 128, 4, 0, + 228, 128, 2, 0, 85, 160, + 88, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 5, 0, 144, 128, 4, 0, + 144, 128, 4, 0, 0, 4, + 0, 0, 7, 128, 2, 0, + 249, 128, 3, 0, 85, 160, + 3, 0, 170, 160, 88, 0, + 0, 4, 0, 0, 15, 128, + 2, 0, 0, 128, 0, 0, + 228, 128, 1, 0, 170, 161, + 2, 0, 0, 3, 2, 0, + 15, 128, 1, 0, 147, 128, + 1, 0, 84, 160, 4, 0, + 0, 4, 2, 0, 14, 128, + 2, 0, 228, 128, 0, 0, + 85, 160, 3, 0, 255, 129, + 88, 0, 0, 4, 2, 0, + 1, 128, 2, 0, 0, 128, + 1, 0, 170, 160, 1, 0, + 255, 160, 88, 0, 0, 4, + 2, 0, 1, 128, 1, 0, + 255, 129, 1, 0, 170, 161, + 2, 0, 0, 128, 4, 0, + 0, 4, 3, 0, 14, 128, + 2, 0, 228, 128, 3, 0, + 0, 128, 2, 0, 170, 160, + 5, 0, 0, 3, 3, 0, + 14, 128, 3, 0, 228, 128, + 2, 0, 255, 160, 15, 0, + 0, 2, 4, 0, 1, 128, + 3, 0, 85, 128, 15, 0, + 0, 2, 4, 0, 2, 128, + 3, 0, 170, 128, 15, 0, + 0, 2, 4, 0, 4, 128, + 3, 0, 255, 128, 5, 0, + 0, 3, 3, 0, 14, 128, + 4, 0, 144, 128, 3, 0, + 0, 160, 14, 0, 0, 2, + 4, 0, 1, 128, 3, 0, + 85, 128, 14, 0, 0, 2, + 4, 0, 2, 128, 3, 0, + 170, 128, 14, 0, 0, 2, + 4, 0, 4, 128, 3, 0, + 255, 128, 5, 0, 0, 3, + 3, 0, 14, 128, 2, 0, + 228, 128, 0, 0, 0, 160, + 4, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 3, 0, 0, 128, 2, 0, + 0, 160, 5, 0, 0, 3, + 3, 0, 7, 128, 3, 0, + 249, 128, 2, 0, 85, 160, + 88, 0, 0, 4, 2, 0, + 14, 128, 2, 0, 228, 128, + 4, 0, 144, 128, 3, 0, + 144, 128, 4, 0, 0, 4, + 1, 0, 7, 128, 2, 0, + 249, 128, 3, 0, 85, 160, + 3, 0, 170, 160, 88, 0, + 0, 4, 1, 0, 15, 128, + 2, 0, 0, 128, 1, 0, + 228, 128, 1, 0, 170, 161, + 5, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 1, 0, 228, 128, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0, 83, 72, 68, 82, + 156, 5, 0, 0, 64, 0, + 0, 0, 103, 1, 0, 0, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 1, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 1, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 98, 16, 0, 3, 194, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 5, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, + 0, 191, 0, 0, 0, 0, + 50, 0, 0, 13, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 86, 133, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 50, 0, + 0, 13, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 174, 71, + 97, 61, 174, 71, 97, 61, + 174, 71, 97, 61, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 111, 167, + 114, 63, 111, 167, 114, 63, + 111, 167, 114, 63, 0, 0, + 0, 0, 47, 0, 0, 5, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 154, 153, + 25, 64, 154, 153, 25, 64, + 154, 153, 25, 64, 0, 0, + 0, 0, 25, 0, 0, 5, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 49, 0, + 0, 10, 114, 0, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 230, 174, + 37, 61, 230, 174, 37, 61, + 230, 174, 37, 61, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 145, 131, 158, 61, + 145, 131, 158, 61, 145, 131, + 158, 61, 0, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 15, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 112, 64, 0, 0, + 112, 64, 0, 0, 112, 64, + 0, 0, 0, 0, 2, 64, + 0, 0, 23, 183, 209, 56, + 23, 183, 209, 56, 23, 183, + 209, 56, 0, 0, 0, 0, + 49, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 49, 0, + 0, 7, 34, 0, 16, 0, + 1, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 60, 1, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 26, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 55, 0, 0, 12, 242, 0, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 230, 26, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 1, 0, 0, 0, 0, 96, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 191, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 0, 50, 0, + 0, 13, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 86, 133, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 174, 71, 97, 61, + 174, 71, 97, 61, 174, 71, + 97, 61, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 111, 167, 114, 63, + 111, 167, 114, 63, 111, 167, + 114, 63, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 154, 153, 25, 64, + 154, 153, 25, 64, 154, 153, + 25, 64, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 49, 0, 0, 10, + 114, 0, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 230, 174, 37, 61, + 230, 174, 37, 61, 230, 174, + 37, 61, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 145, 131, 158, 61, 145, 131, + 158, 61, 145, 131, 158, 61, + 0, 0, 0, 0, 55, 0, + 0, 9, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 15, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 112, 64, 0, 0, 112, 64, + 0, 0, 112, 64, 0, 0, + 0, 0, 2, 64, 0, 0, + 23, 183, 209, 56, 23, 183, + 209, 56, 23, 183, 209, 56, + 0, 0, 0, 0, 49, 0, + 0, 7, 18, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 1, 0, + 0, 0, 49, 0, 0, 7, + 34, 0, 16, 0, 2, 0, + 0, 0, 58, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 60, + 1, 0, 0, 7, 18, 0, + 16, 0, 2, 0, 0, 0, + 26, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 2, 0, 0, 0, 55, 0, + 0, 12, 242, 0, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 56, 0, + 0, 7, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 36, 0, 0, 0, + 5, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 27, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 82, 68, + 69, 70, 212, 1, 0, 0, + 1, 0, 0, 0, 8, 1, + 0, 0, 5, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 171, 1, 0, 0, 188, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 204, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 219, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 12, 0, 0, 0, 233, 0, + 0, 0, 2, 0, 0, 0, + 5, 0, 0, 0, 4, 0, + 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 1, 0, + 0, 0, 12, 0, 0, 0, + 245, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 83, 97, 109, 112, + 108, 101, 84, 121, 112, 101, + 67, 108, 97, 109, 112, 0, + 83, 97, 109, 112, 108, 101, + 84, 121, 112, 101, 87, 114, + 97, 112, 0, 115, 104, 97, + 100, 101, 114, 84, 101, 120, + 116, 117, 114, 101, 0, 109, + 97, 115, 107, 84, 101, 120, + 116, 117, 114, 101, 0, 80, + 83, 95, 67, 79, 78, 83, + 84, 65, 78, 84, 95, 66, + 85, 70, 70, 69, 82, 0, + 245, 0, 0, 0, 4, 0, + 0, 0, 32, 1, 0, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 1, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 156, 1, 0, 0, 4, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 165, 1, 0, 0, 8, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 168, 1, 0, 0, 12, 0, + 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 140, 1, + 0, 0, 0, 0, 0, 0, + 98, 114, 105, 103, 104, 116, + 110, 101, 115, 115, 0, 171, + 0, 0, 3, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 99, 111, + 110, 116, 114, 97, 115, 116, + 0, 100, 50, 0, 100, 51, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 49, 48, 46, 49, 0, 171, + 73, 83, 71, 78, 104, 0, + 0, 0, 3, 0, 0, 0, + 8, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 92, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 3, 0, 0, 92, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 12, 12, 0, 0, 83, 86, + 95, 80, 79, 83, 73, 84, + 73, 79, 78, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 84, + 65, 82, 71, 69, 84, 0, + 171, 171 +}; diff --git a/od-win32/shaders/PixelShaderMask_HDR.hlsl b/od-win32/shaders/PixelShaderMask_HDR.hlsl new file mode 100644 index 00000000..db3a3097 --- /dev/null +++ b/od-win32/shaders/PixelShaderMask_HDR.hlsl @@ -0,0 +1,11 @@ + +#include "PixelShader_HDR.hlsl" + +float4 PS_PostMask_HDR(PixelInputType input) : SV_TARGET +{ + float4 textureColor = shaderTexture.Sample(SampleTypeClamp, input.tex); + textureColor = ConvertToHDR(textureColor); + float4 maskColor = maskTexture.Sample(SampleTypeWrap, input.sl); + maskColor = ConvertToHDR(maskColor); + return textureColor * maskColor; +} diff --git a/od-win32/shaders/PixelShaderPlain_HDR.h b/od-win32/shaders/PixelShaderPlain_HDR.h new file mode 100644 index 00000000..a32c209e --- /dev/null +++ b/od-win32/shaders/PixelShaderPlain_HDR.h @@ -0,0 +1,455 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Buffer Definitions: +// +// cbuffer PS_CONSTANT_BUFFER +// { +// +// float brightness; // Offset: 0 Size: 4 +// float contrast; // Offset: 4 Size: 4 +// float d2; // Offset: 8 Size: 4 [unused] +// float d3; // Offset: 12 Size: 4 [unused] +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// SampleTypeClamp sampler NA NA s0 1 +// shaderTexture texture float4 2d t0 1 +// PS_CONSTANT_BUFFER cbuffer NA NA cb0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_POSITION 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_TARGET 0 xyzw 0 TARGET float xyzw +// +// +// Constant buffer to DX9 shader constant mappings: +// +// Target Reg Buffer Start Reg # of Regs Data Conversion +// ---------- ------- --------- --------- ---------------------- +// c0 cb0 0 1 ( FLT, FLT, FLT, FLT) +// +// +// Sampler/Resource to DX9 shader sampler mappings: +// +// Target Sampler Source Sampler Source Resource +// -------------- --------------- ---------------- +// s0 s0 t0 +// +// +// Level9 shader bytecode: +// + ps_2_x + def c1, -0.0078125, -0.5, -0, -1 + def c2, -0.0404499993, 0.0773993805, 0.0549999997, 0.947867334 + def c3, 2.4000001, 3.75, 9.99999975e-005, 0 + dcl t0 + dcl_2d s0 + texld r0, t0, s0 + add r1, r0.wxyz, c1.xyyy + mov r2.w, c1.y + mad r1.yzw, r1, c0.y, -r2.w + cmp r1.x, r1.x, c1.z, c1.w + cmp r1.x, -r0.w, -c1.z, r1.x + mov r2.x, c0.x + mad r2.yzw, r1, r2.x, c2.z + mul r2.yzw, r2, c2.w + log r3.x, r2.y + log r3.y, r2.z + log r3.z, r2.w + mul r2.yzw, r3.xxyz, c3.x + exp r3.x, r2.y + exp r3.y, r2.z + exp r3.z, r2.w + mul r2.yzw, r1, c0.x + mad r1.yzw, r1, r2.x, c2.x + mul r2.xyz, r2.yzww, c2.y + cmp r1.yzw, r1, r3.xxyz, r2.xxyz + mad r0.xyz, r1.yzww, c3.y, c3.z + cmp r0, r1.x, r0, -c1.z + mov oC0, r0 + +// approximately 23 instruction slots used (1 texture, 22 arithmetic) +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 4 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +add r1.xyz, r0.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000) +mad r1.xyz, r1.xyzx, cb0[0].yyyy, l(0.500000, 0.500000, 0.500000, 0.000000) +mad r2.xyz, r1.xyzx, cb0[0].xxxx, l(0.055000, 0.055000, 0.055000, 0.000000) +mul r1.xyz, r1.xyzx, cb0[0].xxxx +mul r2.xyz, r2.xyzx, l(0.947867, 0.947867, 0.947867, 0.000000) +log r2.xyz, r2.xyzx +mul r2.xyz, r2.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000) +exp r2.xyz, r2.xyzx +lt r3.xyz, r1.xyzx, l(0.040450, 0.040450, 0.040450, 0.000000) +mul r1.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000) +movc r1.xyz, r3.xyzx, r1.xyzx, r2.xyzx +mad r0.xyz, r1.xyzx, l(3.750000, 3.750000, 3.750000, 0.000000), l(0.000100, 0.000100, 0.000100, 0.000000) +lt r1.x, l(0.000000), r0.w +lt r1.y, r0.w, l(0.007812) +and r1.x, r1.y, r1.x +movc o0.xyzw, r1.xxxx, l(0,0,0,0), r0.xyzw +ret +// Approximately 18 instruction slots used +#endif + +const BYTE PS_PostPlain_HDR[] = +{ + 68, 88, 66, 67, 59, 80, + 226, 16, 227, 85, 47, 0, + 150, 127, 87, 29, 253, 41, + 211, 89, 1, 0, 0, 0, + 204, 7, 0, 0, 6, 0, + 0, 0, 56, 0, 0, 0, + 72, 2, 0, 0, 40, 5, + 0, 0, 164, 5, 0, 0, + 40, 7, 0, 0, 152, 7, + 0, 0, 65, 111, 110, 57, + 8, 2, 0, 0, 8, 2, + 0, 0, 0, 2, 255, 255, + 212, 1, 0, 0, 52, 0, + 0, 0, 1, 0, 40, 0, + 0, 0, 52, 0, 0, 0, + 52, 0, 1, 0, 36, 0, + 0, 0, 52, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 255, 255, + 81, 0, 0, 5, 1, 0, + 15, 160, 0, 0, 0, 188, + 0, 0, 0, 191, 0, 0, + 0, 128, 0, 0, 128, 191, + 81, 0, 0, 5, 2, 0, + 15, 160, 230, 174, 37, 189, + 145, 131, 158, 61, 174, 71, + 97, 61, 111, 167, 114, 63, + 81, 0, 0, 5, 3, 0, + 15, 160, 154, 153, 25, 64, + 0, 0, 112, 64, 23, 183, + 209, 56, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 15, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 66, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 176, + 0, 8, 228, 160, 2, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 147, 128, 1, 0, + 84, 160, 1, 0, 0, 2, + 2, 0, 8, 128, 1, 0, + 85, 160, 4, 0, 0, 4, + 1, 0, 14, 128, 1, 0, + 228, 128, 0, 0, 85, 160, + 2, 0, 255, 129, 88, 0, + 0, 4, 1, 0, 1, 128, + 1, 0, 0, 128, 1, 0, + 170, 160, 1, 0, 255, 160, + 88, 0, 0, 4, 1, 0, + 1, 128, 0, 0, 255, 129, + 1, 0, 170, 161, 1, 0, + 0, 128, 1, 0, 0, 2, + 2, 0, 1, 128, 0, 0, + 0, 160, 4, 0, 0, 4, + 2, 0, 14, 128, 1, 0, + 228, 128, 2, 0, 0, 128, + 2, 0, 170, 160, 5, 0, + 0, 3, 2, 0, 14, 128, + 2, 0, 228, 128, 2, 0, + 255, 160, 15, 0, 0, 2, + 3, 0, 1, 128, 2, 0, + 85, 128, 15, 0, 0, 2, + 3, 0, 2, 128, 2, 0, + 170, 128, 15, 0, 0, 2, + 3, 0, 4, 128, 2, 0, + 255, 128, 5, 0, 0, 3, + 2, 0, 14, 128, 3, 0, + 144, 128, 3, 0, 0, 160, + 14, 0, 0, 2, 3, 0, + 1, 128, 2, 0, 85, 128, + 14, 0, 0, 2, 3, 0, + 2, 128, 2, 0, 170, 128, + 14, 0, 0, 2, 3, 0, + 4, 128, 2, 0, 255, 128, + 5, 0, 0, 3, 2, 0, + 14, 128, 1, 0, 228, 128, + 0, 0, 0, 160, 4, 0, + 0, 4, 1, 0, 14, 128, + 1, 0, 228, 128, 2, 0, + 0, 128, 2, 0, 0, 160, + 5, 0, 0, 3, 2, 0, + 7, 128, 2, 0, 249, 128, + 2, 0, 85, 160, 88, 0, + 0, 4, 1, 0, 14, 128, + 1, 0, 228, 128, 3, 0, + 144, 128, 2, 0, 144, 128, + 4, 0, 0, 4, 0, 0, + 7, 128, 1, 0, 249, 128, + 3, 0, 85, 160, 3, 0, + 170, 160, 88, 0, 0, 4, + 0, 0, 15, 128, 1, 0, + 0, 128, 0, 0, 228, 128, + 1, 0, 170, 161, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0, 83, 72, 68, 82, + 216, 2, 0, 0, 64, 0, + 0, 0, 182, 0, 0, 0, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 0, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 4, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 0, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 191, 0, 0, 0, 191, + 0, 0, 0, 191, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 86, 133, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 0, 0, + 50, 0, 0, 13, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 174, 71, 97, 61, 174, 71, + 97, 61, 174, 71, 97, 61, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 6, 128, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 111, 167, 114, 63, 111, 167, + 114, 63, 111, 167, 114, 63, + 0, 0, 0, 0, 47, 0, + 0, 5, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 154, 153, 25, 64, 154, 153, + 25, 64, 154, 153, 25, 64, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 49, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 230, 174, 37, 61, 230, 174, + 37, 61, 230, 174, 37, 61, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 145, 131, + 158, 61, 145, 131, 158, 61, + 145, 131, 158, 61, 0, 0, + 0, 0, 55, 0, 0, 9, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 112, 64, + 0, 0, 112, 64, 0, 0, + 112, 64, 0, 0, 0, 0, + 2, 64, 0, 0, 23, 183, + 209, 56, 23, 183, 209, 56, + 23, 183, 209, 56, 0, 0, + 0, 0, 49, 0, 0, 7, + 18, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 49, 0, 0, 7, 34, 0, + 16, 0, 1, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 60, 1, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 26, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 55, 0, 0, 12, + 242, 32, 16, 0, 0, 0, + 0, 0, 6, 0, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 116, 0, + 0, 0, 18, 0, 0, 0, + 4, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 13, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 82, 68, + 69, 70, 124, 1, 0, 0, + 1, 0, 0, 0, 176, 0, + 0, 0, 3, 0, 0, 0, + 28, 0, 0, 0, 0, 4, + 255, 255, 0, 1, 0, 0, + 83, 1, 0, 0, 124, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 140, 0, 0, 0, 2, 0, + 0, 0, 5, 0, 0, 0, + 4, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 1, 0, 0, 0, 12, 0, + 0, 0, 154, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 83, 97, + 109, 112, 108, 101, 84, 121, + 112, 101, 67, 108, 97, 109, + 112, 0, 115, 104, 97, 100, + 101, 114, 84, 101, 120, 116, + 117, 114, 101, 0, 80, 83, + 95, 67, 79, 78, 83, 84, + 65, 78, 84, 95, 66, 85, + 70, 70, 69, 82, 0, 171, + 171, 171, 154, 0, 0, 0, + 4, 0, 0, 0, 200, 0, + 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 40, 1, 0, 0, + 0, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 52, 1, 0, 0, 0, 0, + 0, 0, 68, 1, 0, 0, + 4, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 52, 1, 0, 0, 0, 0, + 0, 0, 77, 1, 0, 0, + 8, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 52, 1, 0, 0, 0, 0, + 0, 0, 80, 1, 0, 0, + 12, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 52, 1, 0, 0, 0, 0, + 0, 0, 98, 114, 105, 103, + 104, 116, 110, 101, 115, 115, + 0, 171, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 99, 111, 110, 116, 114, 97, + 115, 116, 0, 100, 50, 0, + 100, 51, 0, 77, 105, 99, + 114, 111, 115, 111, 102, 116, + 32, 40, 82, 41, 32, 72, + 76, 83, 76, 32, 83, 104, + 97, 100, 101, 114, 32, 67, + 111, 109, 112, 105, 108, 101, + 114, 32, 49, 48, 46, 49, + 0, 171, 73, 83, 71, 78, + 104, 0, 0, 0, 3, 0, + 0, 0, 8, 0, 0, 0, + 80, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 92, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 92, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 12, 0, 0, 0, + 83, 86, 95, 80, 79, 83, + 73, 84, 73, 79, 78, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171 +}; diff --git a/od-win32/shaders/PixelShaderPlain_HDR.hlsl b/od-win32/shaders/PixelShaderPlain_HDR.hlsl new file mode 100644 index 00000000..2a1c2410 --- /dev/null +++ b/od-win32/shaders/PixelShaderPlain_HDR.hlsl @@ -0,0 +1,9 @@ + +#include "PixelShader_HDR.hlsl" + +float4 PS_PostPlain_HDR(PixelInputType input) : SV_TARGET +{ + float4 textureColor = shaderTexture.Sample(SampleTypeClamp, input.tex); + + return ConvertToHDR(textureColor); +} diff --git a/od-win32/shaders/PixelShader_HDR.hlsl b/od-win32/shaders/PixelShader_HDR.hlsl new file mode 100644 index 00000000..d906d2d5 --- /dev/null +++ b/od-win32/shaders/PixelShader_HDR.hlsl @@ -0,0 +1,68 @@ + +Texture2D shaderTexture; +Texture2D maskTexture; +SamplerState SampleTypeClamp; +SamplerState SampleTypeWrap; + +cbuffer PS_CONSTANT_BUFFER +{ + float brightness; + float contrast; + float d2; + float d3; +}; + + +struct PixelInputType +{ + float4 position : SV_POSITION; + float2 tex : TEXCOORD0; + float2 sl : TEXCOORD1; +}; + +float4x4 brightnessMatrix() +{ + return float4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + brightness, brightness, brightness, 1); +} + +float4x4 contrastMatrix() +{ + float t = (1.0 - contrast) / 2.0; + + return float4x4(contrast, 0, 0, 0, + 0, contrast, 0, 0, + 0, 0, contrast, 0, + t, t, t, 1); + +} + +float3 RemoveSRGBCurve(float3 x) +{ + // Approximately pow(x, 2.2) + return x < 0.04045 ? x / 12.92 : pow((x + 0.055) / 1.055, 2.4); +} + +float4 ConvertToHDR(float4 color) +{ + float4 c; + + c = color; + if (c.a > 0 && c.a < 2.0/256.0) + return float4(0, 0, 0, 0); + + c.rgb = (c.rgb - 0.5f) * contrast + 0.5f; + c.rgb *= brightness; + + c.rgb = RemoveSRGBCurve(c.rgb); + + c.rgb *= 300.0f / 80.0f; + c.rgb += 0.0001; + + c.a = color.a; + + return c; +} + diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 95a6315e..2b30ee1e 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -104,6 +104,7 @@ int vsync_modechangetimeout = 10; int vsync_activeheight, vsync_totalheight; float vsync_vblank, vsync_hblank; bool beamracer_debug; +bool gfx_hdr; int reopen(struct AmigaMonitor *, int, bool); @@ -1955,6 +1956,7 @@ static void close_hwnds(struct AmigaMonitor *mon) DestroyWindow(mon->hMainWnd); mon->hMainWnd = 0; } + gfx_hdr = false; } static bool canmatchdepth(void) @@ -2813,7 +2815,7 @@ int picasso_palette(struct MyCLUTEntry *CLUT, uae_u32 *clut) uae_u32 v = (doMask256 (r, red_bits, red_shift) | doMask256 (g, green_bits, green_shift) | doMask256 (b, blue_bits, blue_shift)) - | doMask256 (0xff, alpha_bits, alpha_shift); + | doMask256 ((1 << alpha_bits) - 1, alpha_bits, alpha_shift); if (v != clut[i]) { //write_log (_T("%d:%08x\n"), i, v); clut[i] = v; @@ -4200,7 +4202,6 @@ retry: init_row_map (); } - init_colors(mon->monitor_id); S2X_free(mon->monitor_id); for (int i = 0; i < MAX_AMIGAMONITORS; i++) { @@ -4215,7 +4216,8 @@ retry: 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) { + gfx_hdr = false; + if (currprefs.gfx_api >= 2) { D3D_free(0, true); if (err[0] == 0 && currprefs.color_mode != 5) { changed_prefs.color_mode = currprefs.color_mode = 5; @@ -4243,6 +4245,7 @@ retry: target_graphics_buffer_update(mon->monitor_id); updatewinrect(mon, true); } + init_colors(mon->monitor_id); mon->screen_is_initialized = 1; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 680003ec..c84177a5 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -12444,7 +12444,7 @@ static void values_to_miscdlg_dx(HWND hDlg) SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_ADDSTRING, 0, (LPARAM)_T("LocalVRAM")); SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_ADDSTRING, 0, (LPARAM)_T("SystemRAM")); SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_SETCURSEL, ddforceram, 0); - } else if (workprefs.gfx_api == 2) { + } else if (workprefs.gfx_api >= 2) { SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_ADDSTRING, 0, (LPARAM)_T("Hardware D3D11")); SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_ADDSTRING, 0, (LPARAM)_T("Software D3D11")); SendDlgItemMessage(hDlg, IDC_DXMODE_OPTIONS, CB_SETCURSEL, workprefs.gfx_api_options, 0); @@ -12472,6 +12472,7 @@ static void values_to_miscdlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)_T("DirectDraw")); SendDlgItemMessage(hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)_T("Direct3D 9")); SendDlgItemMessage(hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)_T("Direct3D 11")); + SendDlgItemMessage(hDlg, IDC_DXMODE, CB_ADDSTRING, 0, (LPARAM)_T("Direct3D 11 HDR (experimental)")); SendDlgItemMessage(hDlg, IDC_DXMODE, CB_SETCURSEL, workprefs.gfx_api, 0); values_to_miscdlg_dx(hDlg); @@ -12729,7 +12730,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_DXMODE_OPTIONS: v = SendDlgItemMessage (hDlg, IDC_DXMODE_OPTIONS, CB_GETCURSEL, 0, 0L); if (v != CB_ERR) { - if (workprefs.gfx_api == 2) { + if (workprefs.gfx_api >= 2) { workprefs.gfx_api_options = v; } else if (!workprefs.gfx_api) { ddforceram = v; @@ -19894,7 +19895,7 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog) TCHAR *ext = _tcsrchr(fname, '.'); if (ext && ( !_tcsicmp(ext, _T(".png")) || - (!_tcsicmp(ext, _T(".bmp")) && workprefs.gfx_api != 2))) + (!_tcsicmp(ext, _T(".bmp")) && workprefs.gfx_api < 2))) { for (;;) { if (!overlaytype && _tcslen(fname) > 4 + 1 + 3 && !_tcsnicmp(fname + _tcslen(fname) - (4 + 1 + 3), _T("_led"), 4)) @@ -21392,7 +21393,7 @@ static bool dodialogmousemove(void) return false; if (isfullscreen () > 0 && currprefs.gfx_monitor[monid].gfx_size_fs.width > gui_width && currprefs.gfx_monitor[monid].gfx_size.height > gui_height) return false; - if (currprefs.gfx_api == 2) + if (currprefs.gfx_api >= 2) return false; struct MultiDisplay *mdc = getdisplay(&currprefs, monid); for (int i = 0; Displays[i].monitorid; i++) { diff --git a/od-win32/winuae_msvc15/winuae_msvc.vcxproj b/od-win32/winuae_msvc15/winuae_msvc.vcxproj index 95f0e2da..58b132b3 100644 --- a/od-win32/winuae_msvc15/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc15/winuae_msvc.vcxproj @@ -1481,6 +1481,64 @@ + + 4.0_level_9_3 + PS_PostAlpha_HDR + Pixel + PS_PostAlpha_HDR + ../Shaders/PixelShaderAlpha_HDR.h + + + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + ../Shaders/PixelShaderAlpha_HDR.h + + + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostAlpha_HDR + PS_PostMask Pixel @@ -1553,6 +1611,64 @@ Pixel 4.0_level_9_1 + + PS_PostMask_HDR + 4.0_level_9_3 + ../Shaders/PixelShaderMask_HDR.h + + + PS_PostMask_HDR + Pixel + PS_PostMask_HDR + Pixel + PS_PostMask_HDR + Pixel + PS_PostMask_HDR + Pixel + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + PS_PostMask_HDR + Pixel + 4.0_level_9_3 + PS_PostMask_HDR + Pixel + 4.0_level_9_3 + PS_PostMask_HDR + Pixel + 4.0_level_9_3 + PS_PostMask_HDR + Pixel + 4.0_level_9_3 + PS_PostMask_HDR + + + PS_PostMask_HDR + + + PS_PostMask_HDR + + + PS_PostMask_HDR + + + PS_PostMask_HDR + + + PS_PostMask_HDR + + + PS_PostMask_HDR + + + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + ../Shaders/PixelShaderMask_HDR.h + Pixel PS_PostPlain @@ -1625,6 +1741,82 @@ + + PS_PostPlain_HDR + Pixel + PS_PostPlain_HDR + ../Shaders/PixelShaderPlain_HDR.h + + + 4.0_level_9_3 + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + PS_PostPlain_HDR + + + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + Pixel + 4.0_level_9_3 + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + ../Shaders/PixelShaderPlain_HDR.h + PS_PostPlain_HDR + PS_PostPlain_HDR + PS_PostPlain_HDR + PS_PostPlain_HDR + PS_PostPlain_HDR + PS_PostPlain_HDR + PS_PostPlain_HDR + + + 4.0_level_9_3 + true + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + 4.0_level_9_3 + true + true + true + true + true + true + true + Vertex TextureVertexShader diff --git a/od-win32/winuae_msvc15/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc15/winuae_msvc.vcxproj.filters index 7eb12d70..f4fa914c 100644 --- a/od-win32/winuae_msvc15/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc15/winuae_msvc.vcxproj.filters @@ -67,13 +67,13 @@ {9d6d0e7b-76b0-4b28-a9ef-0b69a02528c7} - - {5c4c971a-37b6-4c1e-82f1-d225ebb12808} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - {c9a4aeea-c63c-40e4-9da2-371acd5ea8fe} + + {5c4c971a-37b6-4c1e-82f1-d225ebb12808} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + @@ -988,82 +988,82 @@ - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files - win32\Shaders\Resource Files + win32\Resource Files @@ -1073,7 +1073,7 @@ - win32\Shaders\Resource Files + win32\Resource Files @@ -1095,6 +1095,18 @@ win32\Shaders + + win32\Shaders + + + win32\Shaders + + + win32\Shaders + + + win32\Shaders +