diff --git a/patches/gdi32-Path_Metafile/0001-gdi32-tests-Add-some-additional-tests-for-ExtExtOut-.patch b/patches/gdi32-Path_Metafile/0001-gdi32-tests-Add-some-additional-tests-for-ExtExtOut-.patch index 04f4c0aa..41f776bf 100644 --- a/patches/gdi32-Path_Metafile/0001-gdi32-tests-Add-some-additional-tests-for-ExtExtOut-.patch +++ b/patches/gdi32-Path_Metafile/0001-gdi32-tests-Add-some-additional-tests-for-ExtExtOut-.patch @@ -1,18 +1,18 @@ -From e9e959a5ad7964f0f7546d0306b46342f46be4bd Mon Sep 17 00:00:00 2001 +From 49a870429b6f911dccca036e9622497074c6b6bb Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sat, 20 Feb 2016 15:21:00 +0800 Subject: gdi32/tests: Add some additional tests for ExtExtOut on a path for an - EMF DC. + EMF DC. (v2) --- - dlls/gdi32/tests/metafile.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 119 insertions(+) + dlls/gdi32/tests/metafile.c | 118 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 118 insertions(+) diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c -index f464720..9247ac7 100644 +index bcd085c..baeaa63 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c -@@ -1101,6 +1101,44 @@ static const unsigned char EMF_TEXTOUT_ON_PATH_BITS[] = +@@ -1122,6 +1122,44 @@ static const unsigned char EMF_TEXTOUT_ON_PATH_BITS[] = 0x14, 0x00, 0x00, 0x00 }; @@ -57,7 +57,7 @@ index f464720..9247ac7 100644 static const unsigned char MF_LINETO_BITS[] = { 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, -@@ -2224,6 +2262,8 @@ static void test_emf_ExtTextOut_on_path(void) +@@ -2384,6 +2422,8 @@ static void test_emf_ExtTextOut_on_path(void) HDC hdcDisplay, hdcMetafile; HENHMETAFILE hMetafile; BOOL ret; @@ -66,7 +66,7 @@ index f464720..9247ac7 100644 static const INT dx[4] = { 3, 5, 8, 12 }; /* Win9x doesn't play EMFs on invisible windows */ -@@ -2234,6 +2274,20 @@ static void test_emf_ExtTextOut_on_path(void) +@@ -2394,6 +2434,20 @@ static void test_emf_ExtTextOut_on_path(void) hdcDisplay = GetDC(hwnd); ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError()); @@ -87,18 +87,17 @@ index f464720..9247ac7 100644 hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL); ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError()); -@@ -2246,6 +2300,10 @@ static void test_emf_ExtTextOut_on_path(void) +@@ -2406,6 +2460,9 @@ static void test_emf_ExtTextOut_on_path(void) ret = EndPath(hdcMetafile); ok(ret, "EndPath error %d\n", GetLastError()); + ret = GetPath(hdcMetafile, NULL, NULL, 0); -+todo_wine + ok(!ret, "expected 0, got %d\n", ret); + hMetafile = CloseEnhMetaFile(hdcMetafile); ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError()); -@@ -2261,6 +2319,67 @@ static void test_emf_ExtTextOut_on_path(void) +@@ -2421,6 +2478,67 @@ static void test_emf_ExtTextOut_on_path(void) ret = DeleteEnhMetaFile(hMetafile); ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError()); @@ -138,13 +137,13 @@ index f464720..9247ac7 100644 + ok(ret, "BeginPath error %d\n", GetLastError()); + + ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx); ++todo_wine + ok(ret, "ExtTextOut error %d\n", GetLastError()); + + ret = EndPath(hdcMetafile); + ok(ret, "EndPath error %d\n", GetLastError()); + + ret = GetPath(hdcMetafile, NULL, NULL, 0); -+todo_wine + ok(!ret, "expected 0, got %d\n", ret); + + hFont = SelectObject(hdcMetafile, hFont); @@ -167,5 +166,5 @@ index f464720..9247ac7 100644 ok(ret, "ReleaseDC error %d\n", GetLastError()); DestroyWindow(hwnd); -- -2.7.0 +2.8.0 diff --git a/patches/gdi32-Path_Metafile/0002-gdi32-ExtTextOut-on-a-path-with-bitmap-font-selected.patch b/patches/gdi32-Path_Metafile/0002-gdi32-ExtTextOut-on-a-path-with-bitmap-font-selected.patch index 990bea8e..cb619dc1 100644 --- a/patches/gdi32-Path_Metafile/0002-gdi32-ExtTextOut-on-a-path-with-bitmap-font-selected.patch +++ b/patches/gdi32-Path_Metafile/0002-gdi32-ExtTextOut-on-a-path-with-bitmap-font-selected.patch @@ -1,4 +1,4 @@ -From 69c95a9f1db5c3e9d6958c0a994897bc5a51105d Mon Sep 17 00:00:00 2001 +From 9d6023646b9d6ee4958d2de3a35d300f2f349ea2 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sat, 20 Feb 2016 15:28:36 +0800 Subject: gdi32: ExtTextOut on a path with bitmap font selected shouldn't fail. @@ -6,14 +6,14 @@ Subject: gdi32: ExtTextOut on a path with bitmap font selected shouldn't fail. This just leads to empty path generated. --- dlls/gdi32/path.c | 2 +- - dlls/gdi32/tests/metafile.c | 1 - - 2 files changed, 1 insertion(+), 2 deletions(-) + dlls/gdi32/tests/metafile.c | 4 +--- + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c -index e09cd0b..8856d49 100644 +index c6b87d4..9b8c9db 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c -@@ -1525,7 +1525,7 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC +@@ -1481,7 +1481,7 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC void *outline; dwSize = GetGlyphOutlineW(dev->hdc, str[idx], ggo_flags, &gm, 0, NULL, &identity); @@ -23,10 +23,10 @@ index e09cd0b..8856d49 100644 /* add outline only if char is printable */ if(dwSize) diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c -index 9247ac7..e247db9 100644 +index baeaa63..9d01ba8 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c -@@ -2279,7 +2279,6 @@ static void test_emf_ExtTextOut_on_path(void) +@@ -2439,7 +2439,6 @@ static void test_emf_ExtTextOut_on_path(void) ok(ret, "BeginPath error %d\n", GetLastError()); ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx); @@ -34,6 +34,23 @@ index 9247ac7..e247db9 100644 ok(ret, "ExtTextOut error %d\n", GetLastError()); ret = EndPath(hdcDisplay); +@@ -2455,7 +2454,7 @@ todo_wine + ok(ret, "BeginPath error %d\n", GetLastError()); + + ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx); +- todo_wine ok(ret, "ExtTextOut error %d\n", GetLastError()); ++ ok(ret, "ExtTextOut error %d\n", GetLastError()); + + ret = EndPath(hdcMetafile); + ok(ret, "EndPath error %d\n", GetLastError()); +@@ -2514,7 +2513,6 @@ todo_wine + ok(ret, "BeginPath error %d\n", GetLastError()); + + ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx); +-todo_wine + ok(ret, "ExtTextOut error %d\n", GetLastError()); + + ret = EndPath(hdcMetafile); -- -2.7.0 +2.8.0 diff --git a/patches/gdi32-Path_Metafile/0003-gdi32-tests-Explicitly-test-BeginPath-return-value-i.patch b/patches/gdi32-Path_Metafile/0003-gdi32-tests-Explicitly-test-BeginPath-return-value-i.patch index b2006dfe..09cd602d 100644 --- a/patches/gdi32-Path_Metafile/0003-gdi32-tests-Explicitly-test-BeginPath-return-value-i.patch +++ b/patches/gdi32-Path_Metafile/0003-gdi32-tests-Explicitly-test-BeginPath-return-value-i.patch @@ -1,4 +1,4 @@ -From a141c787d896d28487556ef6808e7124c0c1e618 Mon Sep 17 00:00:00 2001 +From 74903a2f465f98862457553f9d921db857a824ae Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 24 Feb 2016 11:58:41 +0800 Subject: gdi32/tests: Explicitly test BeginPath() return value in the metafile @@ -9,10 +9,10 @@ Subject: gdi32/tests: Explicitly test BeginPath() return value in the metafile 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c -index ce524f7..fd9893a 100644 +index 9d01ba8..7781013 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c -@@ -2805,7 +2805,8 @@ static void test_mf_GetPath(void) +@@ -2950,7 +2950,8 @@ static void test_mf_GetPath(void) hdc = CreateMetaFileA(NULL); ok(hdc != 0, "CreateMetaFileA error %d\n", GetLastError()); @@ -22,7 +22,7 @@ index ce524f7..fd9893a 100644 ret = MoveToEx(hdc, 50, 50, NULL); ok( ret, "MoveToEx error %d.\n", GetLastError()); ret = LineTo(hdc, 50, 150); -@@ -3581,7 +3582,8 @@ static void test_emf_GetPath(void) +@@ -3839,7 +3840,8 @@ static void test_emf_paths(void) hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL); ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError()); @@ -33,5 +33,5 @@ index ce524f7..fd9893a 100644 ok( ret, "MoveToEx error %d.\n", GetLastError()); ret = LineTo(hdcMetafile, 50, 150); -- -2.7.1 +2.8.0 diff --git a/patches/gdi32-Path_Metafile/0004-gdi32-Add-support-for-paths-on-a-metafile-HDC.-v2.patch b/patches/gdi32-Path_Metafile/0004-gdi32-Add-support-for-paths-on-a-metafile-HDC.-v2.patch deleted file mode 100644 index d25b0cd6..00000000 --- a/patches/gdi32-Path_Metafile/0004-gdi32-Add-support-for-paths-on-a-metafile-HDC.-v2.patch +++ /dev/null @@ -1,392 +0,0 @@ -From aad8c5691d2fd196c3f6f7f84d56e002f1a6ce0e Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 21 Jun 2016 11:39:41 +0800 -Subject: gdi32: Add support for paths on a metafile HDC. (v5) - ---- - dlls/gdi32/enhmfdrv/dc.c | 4 +- - dlls/gdi32/path.c | 170 +++++++++++++++++++++++++++++++++++++++++--- - dlls/gdi32/tests/metafile.c | 2 - - 3 files changed, 164 insertions(+), 12 deletions(-) - -diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c -index 8525067..7a31224 100644 ---- a/dlls/gdi32/enhmfdrv/dc.c -+++ b/dlls/gdi32/enhmfdrv/dc.c -@@ -420,6 +420,7 @@ BOOL EMFDRV_AbortPath( PHYSDEV dev ) - - BOOL EMFDRV_BeginPath( PHYSDEV dev ) - { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pBeginPath ); - EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev; - EMRBEGINPATH emr; - -@@ -428,7 +429,8 @@ BOOL EMFDRV_BeginPath( PHYSDEV dev ) - emr.emr.iType = EMR_BEGINPATH; - emr.emr.nSize = sizeof(emr); - -- return EMFDRV_WriteRecord( dev, &emr.emr ); -+ if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE; -+ return next->funcs->pBeginPath( next ); - } - - BOOL EMFDRV_CloseFigure( PHYSDEV dev ) -diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c -index f3dc79b..65d79db 100644 ---- a/dlls/gdi32/path.c -+++ b/dlls/gdi32/path.c -@@ -752,13 +752,21 @@ static BOOL pathdrv_AbortPath( PHYSDEV dev ) - { - struct path_physdev *physdev = get_path_physdev( dev ); - DC *dc = get_dc_ptr( dev->hdc ); -+ BOOL ret = TRUE; - - if (!dc) return FALSE; -+ -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pAbortPath ); -+ ret = next->funcs->pAbortPath( next ); -+ } -+ - free_gdi_path( physdev->path ); - pop_dc_driver( dc, &path_driver ); - HeapFree( GetProcessHeap(), 0, physdev ); - release_dc_ptr( dc ); -- return TRUE; -+ return ret; - } - - -@@ -769,13 +777,21 @@ static BOOL pathdrv_EndPath( PHYSDEV dev ) - { - struct path_physdev *physdev = get_path_physdev( dev ); - DC *dc = get_dc_ptr( dev->hdc ); -+ BOOL ret = TRUE; - - if (!dc) return FALSE; -+ -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEndPath ); -+ ret = next->funcs->pEndPath( next ); -+ } -+ - dc->path = physdev->path; - pop_dc_driver( dc, &path_driver ); - HeapFree( GetProcessHeap(), 0, physdev ); - release_dc_ptr( dc ); -- return TRUE; -+ return ret; - } - - -@@ -858,6 +874,13 @@ BOOL PATH_RestorePath( DC *dst, DC *src ) - static BOOL pathdrv_MoveTo( PHYSDEV dev, INT x, INT y ) - { - struct path_physdev *physdev = get_path_physdev( dev ); -+ -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pMoveTo ); -+ if (!next->funcs->pMoveTo( next, x, y )) return FALSE; -+ } -+ - physdev->path->newStroke = TRUE; - physdev->path->pos.x = x; - physdev->path->pos.y = y; -@@ -874,6 +897,12 @@ static BOOL pathdrv_LineTo( PHYSDEV dev, INT x, INT y ) - struct path_physdev *physdev = get_path_physdev( dev ); - POINT point; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pLineTo ); -+ if (!next->funcs->pLineTo( next, x, y )) return FALSE; -+ } -+ - point.x = x; - point.y = y; - return add_log_points_new_stroke( physdev, &point, 1, PT_LINETO ); -@@ -893,6 +922,13 @@ static BOOL pathdrv_RoundRect( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, INT - POINT corners[2], pointTemp; - FLOAT_POINT ellCorners[2]; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRoundRect ); -+ if (!next->funcs->pRoundRect( next, x1, y1, x2, y2, ell_width, ell_height )) -+ return FALSE; -+ } -+ - PATH_CheckCorners(dev->hdc,corners,x1,y1,x2,y2); - - /* Add points to the roundrect path */ -@@ -942,6 +978,12 @@ static BOOL pathdrv_Rectangle( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) - POINT corners[2], points[4]; - BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle ); -+ if (!next->funcs->pRectangle( next, x1, y1, x2, y2 )) return FALSE; -+ } -+ - PATH_CheckCorners(dev->hdc,corners,x1,y1,x2,y2); - - points[0].x = corners[1].x; -@@ -1111,10 +1153,19 @@ static BOOL PATH_Arc( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2, - */ - static BOOL pathdrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT eStartAngle, FLOAT eSweepAngle) - { -- int x1 = GDI_ROUND( x + cos(eStartAngle*M_PI/180) * radius ); -- int y1 = GDI_ROUND( y - sin(eStartAngle*M_PI/180) * radius ); -- int x2 = GDI_ROUND( x + cos((eStartAngle+eSweepAngle)*M_PI/180) * radius ); -- int y2 = GDI_ROUND( y - sin((eStartAngle+eSweepAngle)*M_PI/180) * radius ); -+ int x1, x2, y1, y2; -+ -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pAngleArc ); -+ if (!next->funcs->pAngleArc( next, x, y, radius, eStartAngle, eSweepAngle )) -+ return FALSE; -+ } -+ -+ x1 = GDI_ROUND( x + cos(eStartAngle*M_PI/180) * radius ); -+ y1 = GDI_ROUND( y - sin(eStartAngle*M_PI/180) * radius ); -+ x2 = GDI_ROUND( x + cos((eStartAngle+eSweepAngle)*M_PI/180) * radius ); -+ y2 = GDI_ROUND( y - sin((eStartAngle+eSweepAngle)*M_PI/180) * radius ); - return PATH_Arc( dev, x-radius, y-radius, x+radius, y+radius, x1, y1, x2, y2, - eSweepAngle >= 0 ? AD_COUNTERCLOCKWISE : AD_CLOCKWISE, -1 ); - } -@@ -1126,6 +1177,13 @@ static BOOL pathdrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT eSt - static BOOL pathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) - { -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArc ); -+ if (!next->funcs->pArc( next, left, top, right, bottom, xstart, ystart, xend, yend )) -+ return FALSE; -+ } -+ - return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 0 ); - } -@@ -1137,6 +1195,13 @@ static BOOL pathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - static BOOL pathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) - { -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArcTo ); -+ if (!next->funcs->pArcTo( next, left, top, right, bottom, xstart, ystart, xend, yend )) -+ return FALSE; -+ } -+ - return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), -1 ); - } -@@ -1148,6 +1213,13 @@ static BOOL pathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom - static BOOL pathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) - { -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pChord ); -+ if (!next->funcs->pChord( next, left, top, right, bottom, xstart, ystart, xend, yend )) -+ return FALSE; -+ } -+ - return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 1 ); - } -@@ -1159,6 +1231,13 @@ static BOOL pathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom - static BOOL pathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) - { -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPie ); -+ if (!next->funcs->pPie( next, left, top, right, bottom, xstart, ystart, xend, yend )) -+ return FALSE; -+ } -+ - return PATH_Arc( dev, left, top, right, bottom, xstart, ystart, xend, yend, - GetArcDirection( dev->hdc ), 2 ); - } -@@ -1169,6 +1248,13 @@ static BOOL pathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - */ - static BOOL pathdrv_Ellipse( PHYSDEV dev, INT x1, INT y1, INT x2, INT y2 ) - { -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEllipse ); -+ if (!next->funcs->pEllipse( next, x1, y1, x2, y2 )) -+ return FALSE; -+ } -+ - return PATH_Arc( dev, x1, y1, x2, y2, x1, (y1+y2)/2, x1, (y1+y2)/2, GetArcDirection( dev->hdc ), 1 ); - } - -@@ -1180,6 +1266,13 @@ static BOOL pathdrv_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD cbPoints - { - struct path_physdev *physdev = get_path_physdev( dev ); - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyBezierTo ); -+ if (!next->funcs->pPolyBezierTo( next, pts, cbPoints )) -+ return FALSE; -+ } -+ - return add_log_points_new_stroke( physdev, pts, cbPoints, PT_BEZIERTO ); - } - -@@ -1190,8 +1283,16 @@ static BOOL pathdrv_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD cbPoints - static BOOL pathdrv_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD cbPoints ) - { - struct path_physdev *physdev = get_path_physdev( dev ); -- BYTE *type = add_log_points( physdev, pts, cbPoints, PT_BEZIERTO ); -+ BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyBezier ); -+ if (!next->funcs->pPolyBezier( next, pts, cbPoints )) -+ return FALSE; -+ } -+ -+ type = add_log_points( physdev, pts, cbPoints, PT_BEZIERTO ); - if (!type) return FALSE; - type[0] = PT_MOVETO; - return TRUE; -@@ -1208,6 +1309,13 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, - POINT orig_pos; - INT i, lastmove = 0; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyDraw ); -+ if (!next->funcs->pPolyDraw( next, pts, types, cbPoints )) -+ return FALSE; -+ } -+ - for (i = 0; i < path->count; i++) if (path->flags[i] == PT_MOVETO) lastmove = i; - orig_pos = path->pos; - -@@ -1260,8 +1368,16 @@ static BOOL pathdrv_PolyDraw( PHYSDEV dev, const POINT *pts, const BYTE *types, - static BOOL pathdrv_Polyline( PHYSDEV dev, const POINT *pts, INT cbPoints ) - { - struct path_physdev *physdev = get_path_physdev( dev ); -- BYTE *type = add_log_points( physdev, pts, cbPoints, PT_LINETO ); -+ BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyline ); -+ if (!next->funcs->pPolyline( next, pts, cbPoints )) -+ return FALSE; -+ } -+ -+ type = add_log_points( physdev, pts, cbPoints, PT_LINETO ); - if (!type) return FALSE; - if (cbPoints) type[0] = PT_MOVETO; - return TRUE; -@@ -1275,6 +1391,13 @@ static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT cbPoints ) - { - struct path_physdev *physdev = get_path_physdev( dev ); - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolylineTo ); -+ if (!next->funcs->pPolylineTo( next, pts, cbPoints )) -+ return FALSE; -+ } -+ - return add_log_points_new_stroke( physdev, pts, cbPoints, PT_LINETO ); - } - -@@ -1285,8 +1408,16 @@ static BOOL pathdrv_PolylineTo( PHYSDEV dev, const POINT *pts, INT cbPoints ) - static BOOL pathdrv_Polygon( PHYSDEV dev, const POINT *pts, INT cbPoints ) - { - struct path_physdev *physdev = get_path_physdev( dev ); -- BYTE *type = add_log_points( physdev, pts, cbPoints, PT_LINETO ); -+ BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolygon ); -+ if (!next->funcs->pPolygon( next, pts, cbPoints )) -+ return FALSE; -+ } -+ -+ type = add_log_points( physdev, pts, cbPoints, PT_LINETO ); - if (!type) return FALSE; - if (cbPoints) type[0] = PT_MOVETO; - if (cbPoints > 1) type[cbPoints - 1] = PT_LINETO | PT_CLOSEFIGURE; -@@ -1303,6 +1434,13 @@ static BOOL pathdrv_PolyPolygon( PHYSDEV dev, const POINT* pts, const INT* count - UINT poly; - BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolygon ); -+ if (!next->funcs->pPolyPolygon( next, pts, counts, polygons )) -+ return FALSE; -+ } -+ - for(poly = 0; poly < polygons; poly++) { - type = add_log_points( physdev, pts, counts[poly], PT_LINETO ); - if (!type) return FALSE; -@@ -1324,6 +1462,13 @@ static BOOL pathdrv_PolyPolyline( PHYSDEV dev, const POINT* pts, const DWORD* co - UINT poly, count; - BYTE *type; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPolyPolyline ); -+ if (!next->funcs->pPolyPolyline( next, pts, counts, polylines )) -+ return FALSE; -+ } -+ - for (poly = count = 0; poly < polylines; poly++) count += counts[poly]; - - type = add_log_points( physdev, pts, count, PT_LINETO ); -@@ -1472,6 +1617,13 @@ static BOOL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const REC - unsigned int idx, ggo_flags = GGO_NATIVE; - POINT offset = {0, 0}; - -+ if (GdiIsMetaFileDC(dev->hdc)) -+ { -+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pExtTextOut ); -+ if (!next->funcs->pExtTextOut( next, x, y, flags, lprc, str, count, dx )) -+ return FALSE; -+ } -+ - if (!count) return TRUE; - if (flags & ETO_GLYPH_INDEX) ggo_flags |= GGO_GLYPH_INDEX; - -diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c -index 4bd4778..d3848b0 100644 ---- a/dlls/gdi32/tests/metafile.c -+++ b/dlls/gdi32/tests/metafile.c -@@ -2460,7 +2460,6 @@ static void test_emf_ExtTextOut_on_path(void) - ok(ret, "EndPath error %d\n", GetLastError()); - - ret = GetPath(hdcMetafile, NULL, NULL, 0); --todo_wine - ok(!ret, "expected 0, got %d\n", ret); - - hMetafile = CloseEnhMetaFile(hdcMetafile); -@@ -2520,7 +2519,6 @@ todo_wine - ok(ret, "EndPath error %d\n", GetLastError()); - - ret = GetPath(hdcMetafile, NULL, NULL, 0); --todo_wine - ok(!ret, "expected 0, got %d\n", ret); - - hFont = SelectObject(hdcMetafile, hFont); --- -2.8.0 - diff --git a/patches/gdi32-Path_Metafile/definition b/patches/gdi32-Path_Metafile/definition deleted file mode 100644 index 38f94153..00000000 --- a/patches/gdi32-Path_Metafile/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [39185] Add support for paths on a metafile HDC diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 46ff9baa..17cff615 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "025c54344230ca8b32e80f08b9af13a16dfd2445" + echo "9c1fbe509576d7cbaada3af9736888cfa1d02847" } # Show version information @@ -3720,22 +3720,17 @@ fi # Patchset gdi32-Path_Metafile # | -# | This patchset fixes the following Wine bugs: -# | * [#39185] Add support for paths on a metafile HDC -# | # | Modified files: -# | * dlls/gdi32/enhmfdrv/dc.c, dlls/gdi32/path.c, dlls/gdi32/tests/metafile.c +# | * dlls/gdi32/path.c, dlls/gdi32/tests/metafile.c # | if test "$enable_gdi32_Path_Metafile" -eq 1; then patch_apply gdi32-Path_Metafile/0001-gdi32-tests-Add-some-additional-tests-for-ExtExtOut-.patch patch_apply gdi32-Path_Metafile/0002-gdi32-ExtTextOut-on-a-path-with-bitmap-font-selected.patch patch_apply gdi32-Path_Metafile/0003-gdi32-tests-Explicitly-test-BeginPath-return-value-i.patch - patch_apply gdi32-Path_Metafile/0004-gdi32-Add-support-for-paths-on-a-metafile-HDC.-v2.patch ( - echo '+ { "Dmitry Timoshkov", "gdi32/tests: Add some additional tests for ExtExtOut on a path for an EMF DC.", 1 },'; + echo '+ { "Dmitry Timoshkov", "gdi32/tests: Add some additional tests for ExtExtOut on a path for an EMF DC.", 2 },'; echo '+ { "Dmitry Timoshkov", "gdi32: ExtTextOut on a path with bitmap font selected shouldn'\''t fail.", 1 },'; echo '+ { "Dmitry Timoshkov", "gdi32/tests: Explicitly test BeginPath() return value in the metafile path tests.", 1 },'; - echo '+ { "Dmitry Timoshkov", "gdi32: Add support for paths on a metafile HDC.", 5 },'; ) >> "$patchlist" fi diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch index b0ed23b4..1792f5a6 100644 --- a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -1,4 +1,4 @@ -From a0ee8c9dc2a5cde4458088ec20f6abe1c497ea24 Mon Sep 17 00:00:00 2001 +From fadbf97ae4a90df1342e5bc07707a8e8ee5bbd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 20 Dec 2012 13:09:17 +0100 Subject: wined3d: Move the framebuffer into wined3d_state @@ -20,7 +20,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state 13 files changed, 178 insertions(+), 120 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 11dac92..01367b8 100644 +index 6a1c9d6..ef9e462 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -704,7 +704,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, @@ -42,10 +42,10 @@ index 11dac92..01367b8 100644 } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 65e6bcc..c6b776a 100644 +index d49e2d0..f2425df 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1680,6 +1680,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, +@@ -1699,6 +1699,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } @@ -57,7 +57,7 @@ index 65e6bcc..c6b776a 100644 /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1984,6 +1989,7 @@ out: +@@ -2003,6 +2008,7 @@ out: if (hdc) wined3d_release_dc(swapchain->win_handle, hdc); device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -65,7 +65,7 @@ index 65e6bcc..c6b776a 100644 HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2020,6 +2026,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont +@@ -2039,6 +2045,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -73,7 +73,7 @@ index 65e6bcc..c6b776a 100644 HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2556,7 +2563,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2575,7 +2582,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win DWORD rt_mask = 0, *cur_mask; UINT i; @@ -82,7 +82,7 @@ index 65e6bcc..c6b776a 100644 || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2601,6 +2608,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2620,6 +2627,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -91,7 +91,7 @@ index 65e6bcc..c6b776a 100644 } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2658,7 +2667,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win +@@ -2677,7 +2686,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -100,7 +100,7 @@ index 65e6bcc..c6b776a 100644 struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2688,7 +2697,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const +@@ -2707,7 +2716,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD rt_mask = find_draw_buffers_mask(context, state); @@ -109,7 +109,7 @@ index 65e6bcc..c6b776a 100644 DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2719,6 +2728,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat +@@ -2738,6 +2747,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -118,7 +118,7 @@ index 65e6bcc..c6b776a 100644 } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3366,7 +3377,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, +@@ -3369,7 +3380,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -128,10 +128,10 @@ index 65e6bcc..c6b776a 100644 WORD map; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index a5d0269..14dfefb 100644 +index d74b312..433145e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -286,7 +286,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -288,7 +288,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) device = cs->device; wined3d_get_draw_rect(&device->state, &draw_rect); device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, @@ -140,7 +140,7 @@ index a5d0269..14dfefb 100644 &op->color, op->depth, op->stencil); } -@@ -393,7 +393,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v +@@ -396,7 +396,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v { const struct wined3d_cs_set_rendertarget_view *op = data; @@ -149,7 +149,7 @@ index a5d0269..14dfefb 100644 device_invalidate_state(cs->device, STATE_FRAMEBUFFER); } -@@ -416,7 +416,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -419,7 +419,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const struct wined3d_device *device = cs->device; struct wined3d_rendertarget_view *prev; @@ -158,7 +158,7 @@ index a5d0269..14dfefb 100644 { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -432,7 +432,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -435,7 +435,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } } @@ -167,7 +167,7 @@ index a5d0269..14dfefb 100644 if (!prev != !op->view) { -@@ -999,11 +999,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1004,11 +1004,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) { struct wined3d_adapter *adapter = cs->device->adapter; @@ -183,7 +183,7 @@ index a5d0269..14dfefb 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1084,15 +1086,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1089,15 +1091,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; @@ -201,7 +201,7 @@ index a5d0269..14dfefb 100644 cs->ops = &wined3d_cs_st_ops; cs->device = device; -@@ -1100,7 +1100,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1105,7 +1105,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size))) { state_cleanup(&cs->state); @@ -209,7 +209,7 @@ index a5d0269..14dfefb 100644 HeapFree(GetProcessHeap(), 0, cs); return NULL; } -@@ -1111,7 +1110,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1116,7 +1115,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) void wined3d_cs_destroy(struct wined3d_cs *cs) { state_cleanup(&cs->state); @@ -218,10 +218,10 @@ index a5d0269..14dfefb 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 040f5ea..2d11549 100644 +index 7bec75a..c72c8b2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -978,7 +978,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi +@@ -987,7 +987,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil; unsigned int i; @@ -230,7 +230,7 @@ index 040f5ea..2d11549 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -996,7 +996,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1005,7 +1005,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc) { static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -238,7 +238,7 @@ index 040f5ea..2d11549 100644 struct wined3d_swapchain *swapchain = NULL; struct wined3d_context *context; DWORD clear_flags = 0; -@@ -1009,9 +1008,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1018,9 +1017,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; @@ -248,7 +248,7 @@ index 040f5ea..2d11549 100644 if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -1085,7 +1081,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, +@@ -1095,7 +1091,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, return WINED3D_OK; err_out: @@ -256,7 +256,7 @@ index 040f5ea..2d11549 100644 HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1163,8 +1158,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1173,8 +1168,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (device->cursor_texture) wined3d_texture_decref(device->cursor_texture); @@ -282,7 +282,7 @@ index 040f5ea..2d11549 100644 /* Unload resources */ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { -@@ -1195,37 +1207,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1205,37 +1217,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) * destroy the context. */ context_release(context); @@ -320,7 +320,7 @@ index 040f5ea..2d11549 100644 if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1243,9 +1224,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) +@@ -1253,9 +1234,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) device->swapchains = NULL; device->swapchain_count = 0; @@ -330,7 +330,7 @@ index 040f5ea..2d11549 100644 device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -2057,7 +2035,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) +@@ -2072,7 +2050,7 @@ static void resolve_depth_buffer(struct wined3d_state *state) || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; @@ -339,7 +339,7 @@ index 040f5ea..2d11549 100644 return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -3426,6 +3404,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3441,6 +3419,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { @@ -348,7 +348,7 @@ index 040f5ea..2d11549 100644 TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, debug_color(color), depth, stencil); -@@ -3437,7 +3417,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3452,7 +3432,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -357,7 +357,7 @@ index 040f5ea..2d11549 100644 if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3446,8 +3426,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou +@@ -3461,8 +3441,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou } else if (flags & WINED3DCLEAR_TARGET) { @@ -368,7 +368,7 @@ index 040f5ea..2d11549 100644 { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3777,8 +3757,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device +@@ -3793,8 +3773,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -379,7 +379,7 @@ index 040f5ea..2d11549 100644 if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -4236,20 +4216,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co +@@ -4252,20 +4232,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co return NULL; } @@ -403,7 +403,7 @@ index 040f5ea..2d11549 100644 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4289,13 +4270,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4305,13 +4286,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device } @@ -419,7 +419,7 @@ index 040f5ea..2d11549 100644 wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4307,18 +4288,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device +@@ -4323,18 +4304,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -441,7 +441,7 @@ index 040f5ea..2d11549 100644 wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4681,10 +4663,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4697,10 +4679,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -453,7 +453,7 @@ index 040f5ea..2d11549 100644 { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4693,6 +4674,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4709,6 +4690,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_device_set_depth_stencil_view(device, NULL); @@ -465,7 +465,7 @@ index 040f5ea..2d11549 100644 if (device->onscreen_depth_stencil) { wined3d_texture_decref(device->onscreen_depth_stencil->container); -@@ -4916,30 +4902,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4934,30 +4920,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -504,7 +504,7 @@ index 040f5ea..2d11549 100644 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -5031,11 +5017,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -5049,11 +5035,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { @@ -518,7 +518,7 @@ index 040f5ea..2d11549 100644 ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5171,8 +5157,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, +@@ -5189,8 +5175,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; @@ -534,12 +534,12 @@ index 040f5ea..2d11549 100644 if (!(device->cs = wined3d_cs_create(device))) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c -index 9103d42..0b67c48 100644 +index dd82654..dd0f1d9 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -411,7 +411,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s - unsigned int start_idx, unsigned int index_count, unsigned int start_instance, - unsigned int instance_count, BOOL indexed) +@@ -412,7 +412,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s + int base_vertex_idx, unsigned int start_idx, unsigned int index_count, + unsigned int start_instance, unsigned int instance_count, BOOL indexed) { - const struct wined3d_fb_state *fb = state->fb; + const struct wined3d_fb_state *fb = &state->fb; @@ -547,10 +547,10 @@ index 9103d42..0b67c48 100644 struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c -index 0d9c044..0216baf 100644 +index 889342d..5cfc3c9 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -1448,7 +1448,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context +@@ -1470,7 +1470,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context const struct wined3d_vec4 correction_params = { /* Position is relative to the framebuffer, not the viewport. */ @@ -560,10 +560,10 @@ index 0d9c044..0216baf 100644 0.0f, 0.0f, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index ef2f70b..51c0b5c 100644 +index 33c6280..9b0c811 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2923,7 +2923,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 +@@ -2943,7 +2943,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -573,7 +573,7 @@ index ef2f70b..51c0b5c 100644 static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c -index e4a089c..799d736 100644 +index bd0eba2..ed578b8 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -105,7 +105,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ @@ -639,7 +639,7 @@ index e4a089c..799d736 100644 float scale; union -@@ -4572,8 +4572,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine +@@ -4580,8 +4580,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -650,7 +650,7 @@ index e4a089c..799d736 100644 const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; unsigned int width, height; -@@ -4759,7 +4759,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st +@@ -4767,7 +4767,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st } else { @@ -659,7 +659,7 @@ index e4a089c..799d736 100644 UINT height; UINT width; -@@ -4827,7 +4827,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state +@@ -4835,7 +4835,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); @@ -669,7 +669,7 @@ index e4a089c..799d736 100644 else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c -index cb5a141..1a65698 100644 +index bb15995..08f5ed5 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -430,6 +430,7 @@ void state_unbind_resources(struct wined3d_state *state) @@ -721,7 +721,7 @@ index cb5a141..1a65698 100644 } ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) -@@ -1241,32 +1269,41 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d +@@ -1244,32 +1272,41 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d } } @@ -795,10 +795,10 @@ index aba7ac0..92abd3b 100644 struct wined3d_texture *logo_texture; struct wined3d_context *context; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c -index f85fcc9..92e0b7b 100644 +index 878de10..2da8399 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4320,7 +4320,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w +@@ -4465,7 +4465,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -807,7 +807,7 @@ index f85fcc9..92e0b7b 100644 state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; float z_scale = zenable ? 2.0f : 0.0f; float z_offset = zenable ? -1.0f : 0.0f; -@@ -5117,7 +5117,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d +@@ -5262,7 +5262,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d break; } } @@ -817,10 +817,10 @@ index f85fcc9..92e0b7b 100644 || !state->render_states[WINED3D_RS_CLIPPLANEENABLE]) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 7d202b6..ad7e89c 100644 +index 45e4714..e804970 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1341,6 +1341,36 @@ struct wined3d_timestamp_query +@@ -1354,6 +1354,36 @@ struct wined3d_timestamp_query void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; @@ -857,7 +857,7 @@ index 7d202b6..ad7e89c 100644 struct wined3d_context { const struct wined3d_gl_info *gl_info; -@@ -1355,6 +1385,7 @@ struct wined3d_context +@@ -1368,6 +1398,7 @@ struct wined3d_context DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -865,7 +865,7 @@ index 7d202b6..ad7e89c 100644 struct wined3d_swapchain *swapchain; struct -@@ -1462,12 +1493,6 @@ struct wined3d_context +@@ -1475,12 +1506,6 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; @@ -878,7 +878,7 @@ index 7d202b6..ad7e89c 100644 typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -2218,7 +2243,7 @@ struct wined3d_stream_state +@@ -2239,7 +2264,7 @@ struct wined3d_stream_state struct wined3d_state { DWORD flags; @@ -887,7 +887,7 @@ index 7d202b6..ad7e89c 100644 struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2321,7 +2346,6 @@ struct wined3d_device +@@ -2343,7 +2368,6 @@ struct wined3d_device struct wine_rb_tree samplers; /* Render Target Support */ @@ -895,7 +895,7 @@ index 7d202b6..ad7e89c 100644 struct wined3d_surface *onscreen_depth_stencil; struct wined3d_rendertarget_view *auto_depth_stencil_view; -@@ -2856,9 +2880,8 @@ struct wined3d_stateblock +@@ -2879,9 +2903,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -907,7 +907,7 @@ index 7d202b6..ad7e89c 100644 void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; struct wined3d_cs_ops -@@ -2871,7 +2894,6 @@ struct wined3d_cs +@@ -2894,7 +2917,6 @@ struct wined3d_cs { const struct wined3d_cs_ops *ops; struct wined3d_device *device; diff --git a/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch index 48d38c4a..ea513d0a 100644 --- a/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch +++ b/patches/wined3d-CSMT_Main/0010-wined3d-Hackily-introduce-a-multithreaded-command-st.patch @@ -1,4 +1,4 @@ -From 34fd405a87bdc2ac8b528488c5738ff57c644190 Mon Sep 17 00:00:00 2001 +From 56cb75721dc3a1a1e4f9866ec2cc24ab627e84da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 14:31:56 +0200 Subject: wined3d: Hackily introduce a multithreaded command stream @@ -10,7 +10,7 @@ Subject: wined3d: Hackily introduce a multithreaded command stream 3 files changed, 357 insertions(+), 27 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 3150f25..d92ce21 100644 +index 433145e..cd59c60 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -52,7 +52,7 @@ index 3150f25..d92ce21 100644 }; struct wined3d_cs_present -@@ -250,7 +273,134 @@ struct wined3d_cs_reset_state +@@ -252,7 +275,134 @@ struct wined3d_cs_reset_state enum wined3d_cs_op opcode; }; @@ -188,7 +188,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -259,6 +409,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -261,6 +411,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) wined3d_swapchain_set_window(swapchain, op->dst_window_override); swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); @@ -197,7 +197,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -277,17 +429,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -279,17 +431,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw cs->ops->submit(cs); } @@ -219,7 +219,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -307,12 +462,14 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -309,12 +464,14 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * cs->ops->submit(cs); } @@ -228,14 +228,14 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_draw *op = data; - draw_primitive(cs->device, &cs->device->state, op->start_idx, op->index_count, - op->start_instance, op->instance_count, op->indexed); + draw_primitive(cs->device, &cs->device->state, op->base_vertex_idx, op->start_idx, + op->index_count, op->start_instance, op->instance_count, op->indexed); + + return sizeof(*op); } - void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_count, -@@ -331,12 +488,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun + void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, +@@ -334,12 +491,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i cs->ops->submit(cs); } @@ -251,7 +251,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -351,12 +510,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -354,12 +513,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query cs->ops->submit(cs); } @@ -267,7 +267,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -370,12 +531,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -373,12 +534,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi cs->ops->submit(cs); } @@ -283,7 +283,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -389,12 +552,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -392,12 +555,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) cs->ops->submit(cs); } @@ -299,7 +299,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -410,7 +575,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -413,7 +578,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v cs->ops->submit(cs); } @@ -308,7 +308,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -449,6 +614,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -452,6 +617,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -317,7 +317,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -462,12 +629,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -465,12 +632,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -333,7 +333,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -481,7 +650,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -484,7 +653,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -342,7 +342,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -499,6 +668,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -502,6 +671,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -351,7 +351,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -516,7 +687,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -519,7 +690,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -360,7 +360,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -526,6 +697,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -529,6 +700,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -369,7 +369,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -541,7 +714,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -544,7 +717,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i cs->ops->submit(cs); } @@ -378,7 +378,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -556,6 +729,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -559,6 +732,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -387,7 +387,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -572,7 +747,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -575,7 +750,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -396,7 +396,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -587,6 +762,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -591,6 +766,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -405,7 +405,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -602,7 +779,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -607,7 +784,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs); } @@ -414,7 +414,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -616,6 +793,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -621,6 +798,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -422,7 +422,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -632,7 +810,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -637,7 +815,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha cs->ops->submit(cs); } @@ -431,7 +431,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -709,6 +887,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -714,6 +892,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -440,7 +440,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -723,12 +903,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -728,12 +908,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -456,7 +456,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -745,12 +927,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -750,12 +932,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 cs->ops->submit(cs); } @@ -472,7 +472,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -767,13 +951,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -772,13 +956,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -489,7 +489,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -788,12 +974,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -793,12 +979,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -505,7 +505,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -808,12 +996,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -813,12 +1001,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } @@ -521,7 +521,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -830,12 +1020,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -835,12 +1025,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, cs->ops->submit(cs); } @@ -537,7 +537,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -852,13 +1044,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -857,13 +1049,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, cs->ops->submit(cs); } @@ -554,7 +554,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -874,12 +1068,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -879,12 +1073,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform cs->ops->submit(cs); } @@ -570,7 +570,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -894,7 +1090,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -899,7 +1095,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const cs->ops->submit(cs); } @@ -579,7 +579,7 @@ index 3150f25..d92ce21 100644 { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -955,6 +1151,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -960,6 +1156,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -588,7 +588,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -977,12 +1175,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -982,12 +1180,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs); } @@ -604,7 +604,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -996,7 +1196,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1001,7 +1201,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma cs->ops->submit(cs); } @@ -613,7 +613,7 @@ index 3150f25..d92ce21 100644 { struct wined3d_adapter *adapter = cs->device->adapter; HRESULT hr; -@@ -1006,6 +1206,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1011,6 +1211,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize CS state, hr %#x.\n", hr); @@ -622,7 +622,7 @@ index 3150f25..d92ce21 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1018,8 +1220,9 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1023,8 +1225,9 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) cs->ops->submit(cs); } @@ -633,7 +633,7 @@ index 3150f25..d92ce21 100644 /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, -@@ -1078,6 +1281,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -1083,6 +1286,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -692,7 +692,7 @@ index 3150f25..d92ce21 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -1103,12 +1358,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1109,12 +1364,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -754,7 +754,7 @@ index 3150f25..d92ce21 100644 HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c -index 9d1c11d..2415aed 100644 +index 434d32e..beeb9fa 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -90,6 +90,7 @@ struct wined3d_settings wined3d_settings = @@ -781,10 +781,10 @@ index 9d1c11d..2415aed 100644 if (appkey) RegCloseKey( appkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 2fffc07..4e3a326 100644 +index 427a119..84405f2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -302,6 +302,7 @@ struct wined3d_settings +@@ -309,6 +309,7 @@ struct wined3d_settings unsigned int max_sm_gs; unsigned int max_sm_ps; BOOL no_3d; @@ -792,7 +792,7 @@ index 2fffc07..4e3a326 100644 }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -2862,6 +2863,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl +@@ -2907,6 +2908,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -811,7 +811,7 @@ index 2fffc07..4e3a326 100644 struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -2873,9 +2886,14 @@ struct wined3d_cs +@@ -2918,9 +2931,14 @@ struct wined3d_cs const struct wined3d_cs_ops *ops; struct wined3d_device *device; struct wined3d_state state; diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch index 3a1893b6..31543324 100644 --- a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch +++ b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch @@ -1,4 +1,4 @@ -From c7b4f23f1e496b7cf3ee419e9f33fa308b297113 Mon Sep 17 00:00:00 2001 +From cdd637351cebe6fec79d281710138246e7367c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 15:30:26 +0200 Subject: wined3d: Give the cs its own state @@ -10,7 +10,7 @@ Subject: wined3d: Give the cs its own state 3 files changed, 83 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ebb078a..55cd5d6 100644 +index 006cb96..4dcc7f5 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -63,6 +63,7 @@ enum wined3d_cs_op @@ -21,7 +21,7 @@ index ebb078a..55cd5d6 100644 WINED3D_CS_OP_STOP, }; -@@ -273,6 +274,12 @@ struct wined3d_cs_reset_state +@@ -275,6 +276,12 @@ struct wined3d_cs_reset_state enum wined3d_cs_op opcode; }; @@ -34,7 +34,7 @@ index ebb078a..55cd5d6 100644 /* FIXME: The list synchronization probably isn't particularly fast. */ static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) { -@@ -437,7 +444,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -439,7 +446,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]); device = cs->device; @@ -43,16 +43,16 @@ index ebb078a..55cd5d6 100644 device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags, &op->color, op->depth, op->stencil); -@@ -466,7 +473,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -468,7 +475,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_draw *op = data; -- draw_primitive(cs->device, &cs->device->state, op->start_idx, op->index_count, -+ draw_primitive(cs->device, &cs->state, op->start_idx, op->index_count, - op->start_instance, op->instance_count, op->indexed); +- draw_primitive(cs->device, &cs->device->state, op->base_vertex_idx, op->start_idx, ++ draw_primitive(cs->device, &cs->state, op->base_vertex_idx, op->start_idx, + op->index_count, op->start_instance, op->instance_count, op->indexed); return sizeof(*op); -@@ -899,6 +906,57 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -904,6 +911,57 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -110,7 +110,7 @@ index ebb078a..55cd5d6 100644 cs->ops->submit(cs); } -@@ -1249,6 +1307,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1254,6 +1312,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, @@ -118,7 +118,7 @@ index ebb078a..55cd5d6 100644 }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1338,7 +1397,7 @@ done: +@@ -1343,7 +1402,7 @@ done: struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -127,7 +127,7 @@ index ebb078a..55cd5d6 100644 if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs)))) return NULL; -@@ -1346,8 +1405,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1351,8 +1410,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT))) { @@ -137,7 +137,7 @@ index ebb078a..55cd5d6 100644 } cs->ops = &wined3d_cs_st_ops; -@@ -1356,17 +1414,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1361,17 +1419,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) cs->data_size = WINED3D_INITIAL_CS_SIZE; if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size))) { @@ -157,7 +157,7 @@ index ebb078a..55cd5d6 100644 } if (wined3d_settings.cs_multithreaded) -@@ -1379,15 +1433,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1384,15 +1438,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL))) { ERR("Failed to create wined3d command stream thread.\n"); @@ -186,38 +186,38 @@ index ebb078a..55cd5d6 100644 void wined3d_cs_destroy(struct wined3d_cs *cs) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 4dddef1..7ca03fd 100644 +index d10ac7a..eee99b7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3510,6 +3510,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT +@@ -3525,6 +3525,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT device_invalidate_state(device, STATE_BASEVERTEXINDEX); } + wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); + wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3547,6 +3548,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic +@@ -3562,6 +3563,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic device_invalidate_state(device, STATE_BASEVERTEXINDEX); } + wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3558,6 +3560,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3573,6 +3575,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n", device, start_idx, index_count, start_instance, instance_count); + wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, + start_idx, index_count, start_instance, instance_count, TRUE); } - diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 05bf6da..046c9d9 100644 +index b6bbb9f..662f326 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2888,7 +2888,7 @@ struct wined3d_cs_block +@@ -2917,7 +2917,7 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -226,7 +226,7 @@ index 05bf6da..046c9d9 100644 }; struct wined3d_cs_ops -@@ -2929,6 +2929,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -2958,6 +2958,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch b/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch index 295363d7..4161a9f9 100644 --- a/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch +++ b/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch @@ -1,4 +1,4 @@ -From 88fabe417bf9eacefc5b563c01320535365a6247 Mon Sep 17 00:00:00 2001 +From f6f55889f720713874299fe21ad82438339a11dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 7 Apr 2013 17:33:20 +0200 Subject: wined3d: Send base vertex index updates through the cs @@ -10,7 +10,7 @@ Subject: wined3d: Send base vertex index updates through the cs 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 12bbcff..bbe0d4f 100644 +index 1e05fa0..81c4bff 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -67,6 +67,7 @@ enum wined3d_cs_op @@ -21,7 +21,7 @@ index 12bbcff..bbe0d4f 100644 WINED3D_CS_OP_STOP, }; -@@ -296,6 +297,12 @@ struct wined3d_cs_finish +@@ -298,6 +299,12 @@ struct wined3d_cs_finish enum wined3d_cs_op opcode; }; @@ -34,7 +34,7 @@ index 12bbcff..bbe0d4f 100644 /* FIXME: The list synchronization probably isn't particularly fast. */ static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) { -@@ -489,6 +496,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -491,6 +498,21 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_draw *op = data; @@ -54,9 +54,9 @@ index 12bbcff..bbe0d4f 100644 + device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX); + } - draw_primitive(cs->device, &cs->state, op->start_idx, op->index_count, - op->start_instance, op->instance_count, op->indexed); -@@ -933,8 +955,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi + draw_primitive(cs->device, &cs->state, op->base_vertex_idx, op->start_idx, + op->index_count, op->start_instance, op->instance_count, op->indexed); +@@ -938,8 +960,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -65,7 +65,7 @@ index 12bbcff..bbe0d4f 100644 cs->state.gl_primitive_type = op->state.gl_primitive_type; memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b)); -@@ -957,8 +977,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win +@@ -962,8 +982,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win /* Don't memcpy the entire struct, we'll remove single items as we add dedicated * ops for setting states */ @@ -74,7 +74,7 @@ index 12bbcff..bbe0d4f 100644 op->state.gl_primitive_type = state->gl_primitive_type; memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b)); -@@ -1372,6 +1390,28 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -1377,6 +1395,28 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) cs->ops->submit(cs); } @@ -103,7 +103,7 @@ index 12bbcff..bbe0d4f 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1405,6 +1445,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1410,6 +1450,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, @@ -112,10 +112,10 @@ index 12bbcff..bbe0d4f 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 72dc4e2..7319a83 100644 +index 2998de7..9b4cb86 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -1972,6 +1972,9 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I +@@ -1987,6 +1987,9 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -125,7 +125,7 @@ index 72dc4e2..7319a83 100644 } INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device) -@@ -3493,12 +3496,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT +@@ -3508,12 +3511,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT { TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count); @@ -136,9 +136,9 @@ index 72dc4e2..7319a83 100644 - } - wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); + wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE); -@@ -3516,8 +3513,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device +@@ -3531,8 +3528,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -147,7 +147,7 @@ index 72dc4e2..7319a83 100644 TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); if (!device->state.index_buffer) -@@ -3530,12 +3525,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic +@@ -3545,12 +3540,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic return WINED3DERR_INVALIDCALL; } @@ -159,12 +159,12 @@ index 72dc4e2..7319a83 100644 - } wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 222a76a..a5f99ed 100644 +index b5f7937..6fe7b09 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2966,6 +2966,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -2995,6 +2995,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch index 99eb50d7..2c4b034d 100644 --- a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch +++ b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch @@ -1,4 +1,4 @@ -From 5efe6c30c29fba801d533fa5071aaae3d5652c47 Mon Sep 17 00:00:00 2001 +From 62f39fc5f53ad7f90b8aea7fd6905c2f51ab3abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 10 Apr 2013 17:16:02 +0200 Subject: wined3d: Send light updates through the command stream @@ -10,7 +10,7 @@ Subject: wined3d: Send light updates through the command stream 3 files changed, 174 insertions(+), 65 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 03bed96..220f05f 100644 +index b82a153..1f5e739 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -63,7 +63,6 @@ enum wined3d_cs_op @@ -30,7 +30,7 @@ index 03bed96..220f05f 100644 WINED3D_CS_OP_STOP, }; -@@ -283,12 +284,6 @@ struct wined3d_cs_reset_state +@@ -285,12 +286,6 @@ struct wined3d_cs_reset_state enum wined3d_cs_op opcode; }; @@ -43,7 +43,7 @@ index 03bed96..220f05f 100644 struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -330,6 +325,19 @@ struct wined3d_cs_set_primitive_type +@@ -332,6 +327,19 @@ struct wined3d_cs_set_primitive_type GLenum gl_primitive_type; }; @@ -63,7 +63,7 @@ index 03bed96..220f05f 100644 /* FIXME: The list synchronization probably isn't particularly fast. */ static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block) { -@@ -975,35 +983,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -980,35 +988,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -99,7 +99,7 @@ index 03bed96..220f05f 100644 static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_shader_resource_view *op = data; -@@ -1562,6 +1541,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ +@@ -1567,6 +1546,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_ cs->ops->submit(cs); } @@ -252,7 +252,7 @@ index 03bed96..220f05f 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -@@ -1591,7 +1716,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1596,7 +1721,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, @@ -260,7 +260,7 @@ index 03bed96..220f05f 100644 /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -@@ -1601,6 +1725,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1606,6 +1730,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, /* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index, /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, @@ -270,10 +270,10 @@ index 03bed96..220f05f 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 6560687..b713dfc 100644 +index 408eb40..cb6f2ee 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -1591,14 +1591,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +@@ -1601,14 +1601,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, light->direction.x, light->direction.y, light->direction.z, light->range, light->falloff, light->theta, light->phi); @@ -288,7 +288,7 @@ index 6560687..b713dfc 100644 /* Save away the information. */ object->OriginalParms = *light; -@@ -1678,6 +1670,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, +@@ -1688,6 +1680,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, FIXME("Unrecognized light type %#x.\n", light->type); } @@ -298,7 +298,7 @@ index 6560687..b713dfc 100644 return WINED3D_OK; } -@@ -1750,12 +1745,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN +@@ -1760,12 +1755,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN { if (light_info->glIndex != -1) { @@ -311,7 +311,7 @@ index 6560687..b713dfc 100644 device->update_state->lights[light_info->glIndex] = NULL; light_info->glIndex = -1; } -@@ -1797,16 +1786,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN +@@ -1807,16 +1796,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -331,36 +331,36 @@ index 6560687..b713dfc 100644 return WINED3D_OK; } -@@ -3499,7 +3484,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT +@@ -3514,7 +3499,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT { TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count); - wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); + wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3528,8 +3512,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic +@@ -3543,8 +3527,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic return WINED3DERR_INVALIDCALL; } - - wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3541,7 +3523,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3556,7 +3538,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n", device, start_idx, index_count, start_instance, instance_count); - wined3d_cs_emit_transfer_stateblock(device->cs, &device->state); - wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, + start_idx, index_count, start_instance, instance_count, TRUE); } - diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c39fd9c..4a78bfa 100644 +index 7c7009b..cd42a74 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2884,7 +2884,9 @@ struct wined3d_cs_block +@@ -2913,7 +2913,9 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -371,7 +371,7 @@ index c39fd9c..4a78bfa 100644 }; struct wined3d_cs_ops -@@ -2928,8 +2930,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -2957,8 +2959,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; @@ -380,7 +380,7 @@ index c39fd9c..4a78bfa 100644 void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -2975,6 +2975,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, +@@ -3004,6 +3004,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs, UINT base_vertex_index) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_type) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch index a820d306..29abaaca 100644 --- a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -1,4 +1,4 @@ -From cf1752b14719e02a4fac71ba32c6986d67cd8e71 Mon Sep 17 00:00:00 2001 +From d4219aaabd252d45506c391898326af17c1d1417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:33:48 +0200 Subject: wined3d: Send update_texture calls through the CS @@ -11,7 +11,7 @@ FIXME: This logic duplication is ugly. 3 files changed, 137 insertions(+), 82 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index f0d9834..0ef6d4b 100644 +index d65f27a..9a4aec1 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -71,6 +71,7 @@ enum wined3d_cs_op @@ -22,7 +22,7 @@ index f0d9834..0ef6d4b 100644 WINED3D_CS_OP_STOP, }; -@@ -397,6 +398,12 @@ struct wined3d_cs_texture_preload +@@ -402,6 +403,12 @@ struct wined3d_cs_texture_preload struct wined3d_texture *texture; }; @@ -35,7 +35,7 @@ index f0d9834..0ef6d4b 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1920,6 +1927,31 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -1919,6 +1926,31 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu cs->ops->submit(cs, sizeof(*op)); } @@ -67,7 +67,7 @@ index f0d9834..0ef6d4b 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -1969,6 +2001,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1968,6 +2000,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, @@ -76,11 +76,11 @@ index f0d9834..0ef6d4b 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 76a2f88..955f061 100644 +index 903b091..6dc0a25 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -3491,34 +3491,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device - wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); +@@ -3532,34 +3532,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device + start_idx, index_count, start_instance, instance_count, TRUE); } -static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, @@ -118,7 +118,7 @@ index 76a2f88..955f061 100644 /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3526,32 +3509,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3567,32 +3550,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -218,7 +218,7 @@ index 76a2f88..955f061 100644 TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3588,70 +3628,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3629,70 +3669,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -319,10 +319,10 @@ index 76a2f88..955f061 100644 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c3df935..a6ff922 100644 +index 4eb0689..9519e5d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2371,6 +2371,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource +@@ -2421,6 +2421,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; @@ -331,7 +331,7 @@ index c3df935..a6ff922 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2989,6 +2991,8 @@ void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query +@@ -3034,6 +3036,8 @@ void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query UINT data_size, DWORD flags, HRESULT *ret) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query *query) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch b/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch index f783dff6..59b91d6b 100644 --- a/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch +++ b/patches/wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch @@ -1,4 +1,4 @@ -From 58c0fcb83ed6aa1070dee8f451bf9b7c06728d5b Mon Sep 17 00:00:00 2001 +From 1fcb7da2ca24d554dee67856a20c4fcef4728f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 20 Aug 2014 18:01:36 +0200 Subject: wined3d: Introduce resource fencing. @@ -10,10 +10,10 @@ FIXME: The buffer part doesn't really make sense without dynamic buffer maps. 2 files changed, 35 insertions(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index e036b3e..3991111 100644 +index 48a5112..df78a87 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -547,6 +547,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -552,6 +552,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_draw *op = data; const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; @@ -21,9 +21,9 @@ index e036b3e..3991111 100644 if (op->indexed && !gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) { -@@ -565,6 +566,14 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) - draw_primitive(cs->device, &cs->state, op->start_idx, op->index_count, - op->start_instance, op->instance_count, op->indexed); +@@ -570,6 +571,14 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) + draw_primitive(cs->device, &cs->state, op->base_vertex_idx, op->start_idx, + op->index_count, op->start_instance, op->instance_count, op->indexed); + if (op->indexed) + wined3d_resource_dec_fence(&cs->state.index_buffer->resource); @@ -36,8 +36,8 @@ index e036b3e..3991111 100644 return sizeof(*op); } -@@ -572,6 +581,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun - UINT start_instance, UINT instance_count, BOOL indexed) +@@ -577,6 +586,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i + unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) { struct wined3d_cs_draw *op; + unsigned int i; @@ -45,7 +45,7 @@ index e036b3e..3991111 100644 op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_DRAW; -@@ -581,6 +592,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_coun +@@ -587,6 +598,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i op->instance_count = instance_count; op->indexed = indexed; @@ -61,10 +61,10 @@ index e036b3e..3991111 100644 } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 38a72de..19ec752 100644 +index c9e467b..a70d88f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2418,6 +2418,7 @@ struct wined3d_resource +@@ -2468,6 +2468,7 @@ struct wined3d_resource DWORD priority; void *heap_memory; struct list resource_list_entry; @@ -72,7 +72,7 @@ index 38a72de..19ec752 100644 void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2450,6 +2451,21 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_H +@@ -2500,6 +2501,21 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_H DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 3fd5af68..522ae2c0 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -532,7 +532,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1680,11 +1680,13 @@ +@@ -1699,11 +1699,13 @@ goto out; } @@ -546,7 +546,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1989,7 +1991,9 @@ +@@ -2008,7 +2010,9 @@ if (hdc) wined3d_release_dc(swapchain->win_handle, hdc); device->shader_backend->shader_free_context_data(ret); device->adapter->fragment_pipe->free_context_data(ret); @@ -556,7 +556,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2026,7 +2030,9 @@ +@@ -2045,7 +2049,9 @@ device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -566,7 +566,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2442,6 +2448,9 @@ +@@ -2461,6 +2467,9 @@ { /* Onscreen surfaces are always in a swapchain */ struct wined3d_swapchain *swapchain = context->current_rt.texture->swapchain; @@ -576,7 +576,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c if (context->render_offscreen || !depth_stencil) return; if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->format)) return; -@@ -2452,8 +2461,13 @@ +@@ -2471,8 +2480,13 @@ WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n"); /* The currently active context is the necessary context to access the swapchain's onscreen buffers */ @@ -590,7 +590,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); context_set_render_offscreen(context, TRUE); -@@ -2554,7 +2568,11 @@ +@@ -2573,7 +2587,11 @@ } /* Context activation is done by the caller. */ @@ -602,7 +602,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c UINT rt_count, const struct wined3d_fb_state *fb) { struct wined3d_rendertarget_view **rts = fb->render_targets; -@@ -2563,7 +2581,11 @@ +@@ -2582,7 +2600,11 @@ DWORD rt_mask = 0, *cur_mask; UINT i; @@ -614,7 +614,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2608,8 +2630,10 @@ +@@ -2627,8 +2649,10 @@ rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -625,7 +625,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2650,8 +2674,12 @@ +@@ -2669,8 +2693,12 @@ gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB]) { @@ -638,7 +638,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); -@@ -2668,7 +2696,11 @@ +@@ -2687,7 +2715,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -650,7 +650,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2698,7 +2730,11 @@ +@@ -2717,7 +2749,11 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD rt_mask = find_draw_buffers_mask(context, state); @@ -662,7 +662,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2729,8 +2765,10 @@ +@@ -2748,8 +2784,10 @@ context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -673,7 +673,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3362,7 +3400,11 @@ +@@ -3381,7 +3419,11 @@ const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -685,7 +685,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3395,12 +3437,17 @@ +@@ -3414,12 +3456,17 @@ for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) { if (map & 1) @@ -703,7 +703,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3519,9 +3566,11 @@ +@@ -3538,9 +3585,11 @@ TRACE("device %p, target %p.\n", device, target); @@ -753,7 +753,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -305,6 +314,7 @@ +@@ -306,6 +315,7 @@ enum wined3d_cs_op opcode; }; @@ -761,122 +761,27 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -2800,224 +2810,997 @@ - /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, - /* WINED3D_CS_OP_SKIP */ wined3d_cs_exec_skip, - /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence, -- /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, -- /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, -- /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, -- /* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication, -- /* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport, -- /* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect, -- /* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view, -- /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view, -- /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration, -- /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source, -- /* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq, -- /* WINED3D_CS_OP_SET_STREAM_OUTPUT */ wined3d_cs_exec_set_stream_output, -- /* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer, -- /* WINED3D_CS_OP_SET_CONSTANT_BUFFER */ wined3d_cs_exec_set_constant_buffer, -- /* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture, -- /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW */ wined3d_cs_exec_set_shader_resource_view, -- /* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler, -- /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader, -- /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, -- /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, -- /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state, -- /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, -- /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane, -- /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, -- /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, -- /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, -- /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, -- /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, -- /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -- /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, -- /* WINED3D_CS_OP_SET_PS_CONSTS_B */ wined3d_cs_exec_set_ps_consts_b, -- /* WINED3D_CS_OP_SET_PS_CONSTS_I */ wined3d_cs_exec_set_ps_consts_i, -- /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, -- /* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index, -- /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, -- /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, -- /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, -- /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, -- /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, -- /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, -- /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, -- /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, -- /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, -- /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -- /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, -- /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, -- /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, -- /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, -- /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -- /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, -- /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, -- /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, -- /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, -- /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, -- /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, -- /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, -- /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, -- /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, -- /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, -- /* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init, -- /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, -- /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, -- /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, -- /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures, -- /* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context, -- /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts, -- /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval, --}; -- --static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) +@@ -967,6 +977,192 @@ + } + + cs->state.fb.depth_stencil = op->view; +#else /* STAGING_CSMT */ +static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) - { -- struct wined3d_cs_queue *queue = prio ? &cs->prio_queue : &cs->queue; -- size_t queue_size = sizeof(queue->data) / sizeof(*queue->data); -- -- if (cs->thread_id == GetCurrentThreadId()) -- ERR("Attempting to queue a command from the CS thread.\n"); ++{ + const struct wined3d_cs_present *op = data; + struct wined3d_swapchain *swapchain; - -- if (queue_size - size < queue->head) -- { -- struct wined3d_cs_skip *skip; -- size_t nop_size = queue_size - queue->head; ++ + swapchain = op->swapchain; + wined3d_swapchain_set_window(swapchain, op->dst_window_override); - -- skip = _wined3d_cs_mt_require_space(cs, nop_size, prio); -- if (nop_size < sizeof(*skip)) -- { -- skip->opcode = WINED3D_CS_OP_NOP; -- } -- else -- { -- skip->opcode = WINED3D_CS_OP_SKIP; -- skip->size = nop_size; -- } ++ + swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); +} - -- if (prio) -- cs->ops->submit_prio(cs, nop_size); -- else -- cs->ops->submit(cs, nop_size); ++ +void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, + const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) +{ + struct wined3d_cs_present *op; - -- assert(!queue->head); -- } ++ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_PRESENT; + op->dst_window_override = dst_window_override; @@ -884,47 +789,26 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->src_rect = *src_rect; + op->dst_rect = *dst_rect; + op->flags = flags; - -- while(1) -- { -- LONG head = queue->head; -- LONG tail = *((volatile LONG *)&queue->tail); -- LONG new_pos; -- /* Empty */ -- if (head == tail) -- break; -- /* Head ahead of tail, take care of wrap-around */ -- new_pos = (head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -- if (head > tail && (new_pos || tail)) -- break; -- /* Tail ahead of head, but still enough space */ -- if (new_pos < tail && new_pos) -- break; ++ + cs->ops->submit(cs); +} - -- TRACE("Waiting for free space. Head %u, tail %u, want %u\n", head, tail, -- (unsigned int) size); -- } ++ +static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_clear *op = data; + struct wined3d_device *device; + RECT draw_rect; - -- return &queue->data[queue->head]; ++ + device = cs->device; + wined3d_get_draw_rect(&device->state, &draw_rect); + device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, + &device->fb, op->rect_count, op->rects, &draw_rect, op->flags, + &op->color, op->depth, op->stencil); - } - --static inline void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) ++} ++ +void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, + DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) - { -- return _wined3d_cs_mt_require_space(cs, size, FALSE); ++{ + struct wined3d_cs_clear *op; + + op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count])); @@ -937,132 +821,82 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + memcpy(op->rects, rects, sizeof(*rects) * rect_count); + + cs->ops->submit(cs); - } - --static inline void *wined3d_cs_mt_require_space_prio(struct wined3d_cs *cs, size_t size) ++} ++ +static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) - { -- return _wined3d_cs_mt_require_space(cs, size, TRUE); ++{ + const struct wined3d_cs_draw *op = data; + -+ draw_primitive(cs->device, &cs->device->state, op->start_idx, op->index_count, -+ op->start_instance, op->instance_count, op->indexed); - } - --/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -- * OP itself. */ --static void wined3d_cs_emit_stop(struct wined3d_cs *cs) -+void wined3d_cs_emit_draw(struct wined3d_cs *cs, UINT start_idx, UINT index_count, -+ UINT start_instance, UINT instance_count, BOOL indexed) - { -- struct wined3d_cs_stop *op; ++ draw_primitive(cs->device, &cs->device->state, op->base_vertex_idx, op->start_idx, ++ op->index_count, op->start_instance, op->instance_count, op->indexed); ++} ++ ++void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, ++ unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) ++{ + struct wined3d_cs_draw *op; - -- op = wined3d_cs_mt_require_space(cs, sizeof(*op)); -- op->opcode = WINED3D_CS_OP_STOP; ++ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_DRAW; ++ op->base_vertex_idx = base_vertex_idx; + op->start_idx = start_idx; + op->index_count = index_count; + op->start_instance = start_instance; + op->instance_count = instance_count; + op->indexed = indexed; - -- wined3d_cs_mt_submit(cs, sizeof(*op)); ++ + cs->ops->submit(cs); - } - --static void wined3d_cs_mt_finish(struct wined3d_cs *cs) ++} ++ +static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data) - { -- BOOL fence; -- wined3d_cs_emit_fence(cs, &fence); ++{ + const struct wined3d_cs_set_predication *op = data; - -- /* A busy wait should be fine, we're not supposed to have to wait very -- * long. */ -- while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); ++ + cs->state.predicate = op->predicate; + cs->state.predicate_value = op->value; - } - --static void wined3d_cs_mt_finish_prio(struct wined3d_cs *cs) ++} ++ +void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) - { -- BOOL fence; -- -- if (cs->thread_id == GetCurrentThreadId()) -- { -- static BOOL once; -- if (!once) -- { -- FIXME("flush_and_wait called from cs thread\n"); -- once = TRUE; -- } -- return; -- } ++{ + struct wined3d_cs_set_predication *op; - -- wined3d_cs_emit_fence_prio(cs, &fence); ++ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_PREDICATION; + op->predicate = predicate; + op->value = value; - -- /* A busy wait should be fine, we're not supposed to have to wait very -- * long. */ -- while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); ++ + cs->ops->submit(cs); - } - --static const struct wined3d_cs_ops wined3d_cs_mt_ops = ++} ++ +static void wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data) - { -- wined3d_cs_mt_require_space, -- wined3d_cs_mt_require_space_prio, -- wined3d_cs_mt_submit, -- wined3d_cs_mt_submit_prio, -- wined3d_cs_mt_finish, -- wined3d_cs_mt_finish_prio, --}; ++{ + const struct wined3d_cs_set_viewport *op = data; - --static void wined3d_cs_st_submit(struct wined3d_cs *cs, size_t size) ++ + cs->state.viewport = op->viewport; + device_invalidate_state(cs->device, STATE_VIEWPORT); +} + +void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) - { -- enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)&cs->queue.data; ++{ + struct wined3d_cs_set_viewport *op; - -- if (opcode >= WINED3D_CS_OP_STOP) -- { -- ERR("Invalid opcode %#x.\n", opcode); -- return; -- } ++ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_SET_VIEWPORT; + op->viewport = *viewport; - -- wined3d_cs_op_handlers[opcode](cs, &cs->queue.data); ++ + cs->ops->submit(cs); - } - --static void wined3d_cs_st_finish(struct wined3d_cs *cs) ++} ++ +static void wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data) - { ++{ + const struct wined3d_cs_set_scissor_rect *op = data; + + cs->state.scissor_rect = op->rect; + device_invalidate_state(cs->device, STATE_SCISSORRECT); - } - --static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) ++} ++ +void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) - { -- return cs->queue.data; ++{ + struct wined3d_cs_set_scissor_rect *op; + + op = cs->ops->require_space(cs, sizeof(*op)); @@ -1070,17 +904,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->rect = *rect; + + cs->ops->submit(cs); - } - --static const struct wined3d_cs_ops wined3d_cs_st_ops = ++} ++ +static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) - { -- wined3d_cs_st_require_space, -- wined3d_cs_st_require_space, -- wined3d_cs_st_submit, -- wined3d_cs_st_submit, -- wined3d_cs_st_finish, -- wined3d_cs_st_finish, ++{ + const struct wined3d_cs_set_rendertarget_view *op = data; + + cs->state.fb->render_targets[op->view_idx] = op->view; @@ -1123,32 +950,34 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + } + + cs->fb.depth_stencil = op->view; -+ -+ if (!prev != !op->view) -+ { -+ /* Swapping NULL / non NULL depth stencil affects the depth and tests */ -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_ZENABLE)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); -+ } -+ else if (prev && (prev->format_flags & WINED3DFMT_FLAG_FLOAT) -+ != (op->view->format_flags & WINED3DFMT_FLAG_FLOAT)) -+ { -+ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); -+ } -+ -+ device_invalidate_state(device, STATE_FRAMEBUFFER); -+} -+ -+void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -+{ -+ struct wined3d_cs_set_depth_stencil_view *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; -+ op->view = view; -+ ++#endif /* STAGING_CSMT */ + + if (!prev != !op->view) + { +@@ -983,8 +1179,10 @@ + } + + device_invalidate_state(device, STATE_FRAMEBUFFER); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) +@@ -995,6 +1193,7 @@ + op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; + op->view = view; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1006,6 +1205,17 @@ + device_invalidate_state(cs->device, STATE_VDECL); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1158,259 +987,196 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.vertex_declaration = op->declaration; + device_invalidate_state(cs->device, STATE_VDECL); -+} -+ -+void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -+{ -+ struct wined3d_cs_set_vertex_declaration *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; -+ op->declaration = declaration; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) +@@ -1016,10 +1226,17 @@ + op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; + op->declaration = declaration; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_source *op = data; -+ struct wined3d_stream_state *stream; -+ struct wined3d_buffer *prev; -+ -+ stream = &cs->state.streams[op->stream_idx]; -+ prev = stream->buffer; -+ stream->buffer = op->buffer; -+ stream->offset = op->offset; -+ stream->stride = op->stride; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_STREAMSRC); -+} -+ -+void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -+ struct wined3d_buffer *buffer, UINT offset, UINT stride) -+{ -+ struct wined3d_cs_set_stream_source *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE; -+ op->stream_idx = stream_idx; -+ op->buffer = buffer; -+ op->offset = offset; -+ op->stride = stride; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_source *op = data; + struct wined3d_stream_state *stream; +@@ -1037,8 +1254,10 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_STREAMSRC); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1053,10 +1272,17 @@ + op->offset = offset; + op->stride = stride; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_source_freq *op = data; -+ struct wined3d_stream_state *stream; -+ -+ stream = &cs->state.streams[op->stream_idx]; -+ stream->frequency = op->frequency; -+ stream->flags = op->flags; -+ -+ device_invalidate_state(cs->device, STATE_STREAMSRC); -+} -+ -+void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -+{ -+ struct wined3d_cs_set_stream_source_freq *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ; -+ op->stream_idx = stream_idx; -+ op->frequency = frequency; -+ op->flags = flags; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_source_freq *op = data; + struct wined3d_stream_state *stream; +@@ -1066,8 +1292,10 @@ + stream->flags = op->flags; + + device_invalidate_state(cs->device, STATE_STREAMSRC); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) +@@ -1080,10 +1308,17 @@ + op->frequency = frequency; + op->flags = flags; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_stream_output *op = data; -+ struct wined3d_stream_output *stream; -+ struct wined3d_buffer *prev; -+ -+ stream = &cs->state.stream_output[op->stream_idx]; -+ prev = stream->buffer; -+ stream->buffer = op->buffer; -+ stream->offset = op->offset; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+} -+ -+void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -+ struct wined3d_buffer *buffer, UINT offset) -+{ -+ struct wined3d_cs_set_stream_output *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT; -+ op->stream_idx = stream_idx; -+ op->buffer = buffer; -+ op->offset = offset; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_stream_output *op = data; + struct wined3d_stream_output *stream; +@@ -1098,8 +1333,10 @@ + InterlockedIncrement(&op->buffer->resource.bind_count); + if (prev) + InterlockedDecrement(&prev->resource.bind_count); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1113,10 +1350,17 @@ + op->buffer = buffer; + op->offset = offset; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_index_buffer *op = data; -+ struct wined3d_buffer *prev; -+ -+ prev = cs->state.index_buffer; -+ cs->state.index_buffer = op->buffer; -+ cs->state.index_format = op->format_id; -+ cs->state.index_offset = op->offset; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_INDEXBUFFER); -+} -+ -+void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -+ enum wined3d_format_id format_id, unsigned int offset) -+{ -+ struct wined3d_cs_set_index_buffer *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER; -+ op->buffer = buffer; -+ op->format_id = format_id; -+ op->offset = offset; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_index_buffer *op = data; + struct wined3d_buffer *prev; +@@ -1132,8 +1376,10 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_INDEXBUFFER); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, +@@ -1147,10 +1393,17 @@ + op->format_id = format_id; + op->offset = offset; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_constant_buffer *op = data; -+ struct wined3d_buffer *prev; -+ -+ prev = cs->state.cb[op->type][op->cb_idx]; -+ cs->state.cb[op->type][op->cb_idx] = op->buffer; -+ -+ if (op->buffer) -+ InterlockedIncrement(&op->buffer->resource.bind_count); -+ if (prev) -+ InterlockedDecrement(&prev->resource.bind_count); -+ -+ device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); -+} -+ -+void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT cb_idx, struct wined3d_buffer *buffer) -+{ -+ struct wined3d_cs_set_constant_buffer *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER; -+ op->type = type; -+ op->cb_idx = cb_idx; -+ op->buffer = buffer; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_constant_buffer *op = data; + struct wined3d_buffer *prev; +@@ -1164,7 +1417,9 @@ + InterlockedDecrement(&prev->resource.bind_count); + + device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); ++#if defined(STAGING_CSMT) + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1178,10 +1433,17 @@ + op->cb_idx = cb_idx; + op->buffer = buffer; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; -+ const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -+ const struct wined3d_cs_set_texture *op = data; -+ struct wined3d_texture *prev; -+ BOOL old_use_color_key = FALSE, new_use_color_key = FALSE; -+ -+ prev = cs->state.textures[op->stage]; -+ cs->state.textures[op->stage] = op->texture; -+ -+ if (op->texture) -+ { -+ const struct wined3d_format *new_format = op->texture->resource.format; -+ const struct wined3d_format *old_format = prev ? prev->resource.format : NULL; -+ unsigned int old_fmt_flags = prev ? prev->resource.format_flags : 0; -+ unsigned int new_fmt_flags = op->texture->resource.format_flags; -+ -+ if (InterlockedIncrement(&op->texture->resource.bind_count) == 1) -+ op->texture->sampler = op->stage; -+ -+ if (!prev || op->texture->target != prev->target -+ || (!is_same_fixup(new_format->color_fixup, old_format->color_fixup) -+ && !(can_use_texture_swizzle(gl_info, new_format) && can_use_texture_swizzle(gl_info, old_format))) -+ || (new_fmt_flags & WINED3DFMT_FLAG_SHADOW) != (old_fmt_flags & WINED3DFMT_FLAG_SHADOW)) -+ device_invalidate_state(cs->device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL)); -+ -+ if (!prev && op->stage < d3d_info->limits.ffp_blend_stages) -+ { -+ /* The source arguments for color and alpha ops have different -+ * meanings when a NULL texture is bound, so the COLOR_OP and -+ * ALPHA_OP have to be dirtified. */ -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_COLOR_OP)); -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_ALPHA_OP)); -+ } -+ -+ if (!op->stage && op->texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ new_use_color_key = TRUE; -+ } -+ -+ if (prev) -+ { -+ if (InterlockedDecrement(&prev->resource.bind_count) && prev->sampler == op->stage) -+ { -+ unsigned int i; -+ -+ /* Search for other stages the texture is bound to. Shouldn't -+ * happen if applications bind textures to a single stage only. */ -+ TRACE("Searching for other stages the texture is bound to.\n"); -+ for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) -+ { -+ if (cs->state.textures[i] == prev) -+ { -+ TRACE("Texture is also bound to stage %u.\n", i); -+ prev->sampler = i; -+ break; -+ } -+ } -+ } -+ -+ if (!op->texture && op->stage < d3d_info->limits.ffp_blend_stages) -+ { -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_COLOR_OP)); -+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_ALPHA_OP)); -+ } -+ -+ if (!op->stage && prev->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ old_use_color_key = TRUE; -+ } -+ -+ device_invalidate_state(cs->device, STATE_SAMPLER(op->stage)); -+ -+ if (new_use_color_key != old_use_color_key) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ -+ if (new_use_color_key) -+ device_invalidate_state(cs->device, STATE_COLOR_KEY); -+} -+ -+void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -+{ -+ struct wined3d_cs_set_texture *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TEXTURE; -+ op->stage = stage; -+ op->texture = texture; ++#endif /* STAGING_CSMT */ + { + const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; + const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; +@@ -1258,8 +1520,10 @@ + + if (new_use_color_key) + device_invalidate_state(cs->device, STATE_COLOR_KEY); ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) +@@ -1270,6 +1534,7 @@ + op->opcode = WINED3D_CS_OP_SET_TEXTURE; + op->stage = stage; + op->texture = texture; ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1281,6 +1546,18 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + + cs->ops->submit(cs); +} @@ -1421,19 +1187,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.shader_resource_view[op->type][op->view_idx] = op->view; + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT view_idx, struct wined3d_shader_resource_view *view) -+{ -+ struct wined3d_cs_set_shader_resource_view *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW; -+ op->type = type; -+ op->view_idx = view_idx; -+ op->view = view; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1294,6 +1571,7 @@ + op->view_idx = view_idx; + op->view = view; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1305,6 +1583,17 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1443,19 +1213,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.sampler[op->type][op->sampler_idx] = op->sampler; + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -+ UINT sampler_idx, struct wined3d_sampler *sampler) -+{ -+ struct wined3d_cs_set_sampler *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SAMPLER; -+ op->type = type; -+ op->sampler_idx = sampler_idx; -+ op->sampler = sampler; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, +@@ -1318,6 +1607,7 @@ + op->sampler_idx = sampler_idx; + op->sampler = sampler; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1330,6 +1620,18 @@ + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1466,17 +1240,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->state.shader[op->type] = op->shader; + device_invalidate_state(cs->device, STATE_SHADER(op->type)); + device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); -+} -+ -+void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -+{ -+ struct wined3d_cs_set_shader *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SHADER; -+ op->type = type; -+ op->shader = shader; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) +@@ -1341,6 +1643,7 @@ + op->type = type; + op->shader = shader; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1547,6 +1850,37 @@ + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1506,19 +1286,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.texture_states[op->stage][op->state] = op->value; + device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); -+} -+ -+void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -+ enum wined3d_texture_stage_state state, DWORD value) -+{ -+ struct wined3d_cs_set_texture_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; -+ op->stage = stage; -+ op->state = state; -+ op->value = value; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1560,6 +1894,7 @@ + op->state = state; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1571,6 +1906,17 @@ + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1528,19 +1312,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.sampler_states[op->sampler_idx][op->state] = op->value; + device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); -+} -+ -+void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -+ enum wined3d_sampler_state state, DWORD value) -+{ -+ struct wined3d_cs_set_sampler_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; -+ op->sampler_idx = sampler_idx; -+ op->state = state; -+ op->value = value; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1584,6 +1930,7 @@ + op->state = state; + op->value = value; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1596,6 +1943,18 @@ + device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1551,18 +1339,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->state.transforms[op->state] = op->matrix; + if (op->state < WINED3D_TS_WORLD_MATRIX(cs->device->adapter->d3d_info.limits.ffp_vertex_blend_matrices)) + device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); -+} -+ -+void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -+ const struct wined3d_matrix *matrix) -+{ -+ struct wined3d_cs_set_transform *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_TRANSFORM; -+ op->state = state; -+ op->matrix = *matrix; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, +@@ -1608,6 +1967,7 @@ + op->state = state; + op->matrix = *matrix; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1619,6 +1979,17 @@ + device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1572,100 +1365,52 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.clip_planes[op->plane_idx] = op->plane; + device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); -+} -+ -+void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -+{ -+ struct wined3d_cs_set_clip_plane *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE; -+ op->plane_idx = plane_idx; -+ op->plane = *plane; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) +@@ -1630,10 +2001,17 @@ + op->plane_idx = plane_idx; + op->plane = *plane; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + + static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_set_color_key *op = data; -+ struct wined3d_texture *texture = op->texture; -+ -+ if (op->set) -+ { -+ switch (op->flags) -+ { -+ case WINED3D_CKEY_DST_BLT: -+ texture->async.dst_blt_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_DST_BLT; -+ break; -+ -+ case WINED3D_CKEY_DST_OVERLAY: -+ texture->async.dst_overlay_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_DST_OVERLAY; -+ break; -+ -+ case WINED3D_CKEY_SRC_BLT: -+ if (texture == cs->state.textures[0]) -+ { -+ device_invalidate_state(cs->device, STATE_COLOR_KEY); -+ if (!(texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ } -+ -+ texture->async.src_blt_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_SRC_BLT; -+ break; -+ -+ case WINED3D_CKEY_SRC_OVERLAY: -+ texture->async.src_overlay_color_key = op->color_key; -+ texture->async.color_key_flags |= WINED3D_CKEY_SRC_OVERLAY; -+ break; -+ } -+ } -+ else -+ { -+ switch (op->flags) -+ { -+ case WINED3D_CKEY_DST_BLT: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_DST_BLT; -+ break; -+ -+ case WINED3D_CKEY_DST_OVERLAY: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_DST_OVERLAY; -+ break; -+ -+ case WINED3D_CKEY_SRC_BLT: -+ if (texture == cs->state.textures[0] && texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) -+ device_invalidate_state(cs->device, STATE_RENDER(WINED3D_RS_COLORKEYENABLE)); -+ -+ texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_BLT; -+ break; -+ -+ case WINED3D_CKEY_SRC_OVERLAY: -+ texture->async.color_key_flags &= ~WINED3D_CKEY_SRC_OVERLAY; -+ break; -+ } -+ } -+} -+ -+void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -+ WORD flags, const struct wined3d_color_key *color_key) -+{ -+ struct wined3d_cs_set_color_key *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; -+ op->texture = texture; -+ op->flags = flags; -+ if (color_key) -+ { -+ op->color_key = *color_key; -+ op->set = 1; -+ } -+ else -+ op->set = 0; -+ ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_set_color_key *op = data; + struct wined3d_texture *texture = op->texture; +@@ -1694,8 +2072,10 @@ + break; + } + } ++#if defined(STAGING_CSMT) + + return sizeof(*op); ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, +@@ -1715,6 +2095,7 @@ + else + op->set = 0; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1726,6 +2107,17 @@ + device_invalidate_state(cs->device, STATE_MATERIAL); + + return sizeof(*op); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1675,16 +1420,23 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + + cs->state.material = op->material; + device_invalidate_state(cs->device, STATE_MATERIAL); -+} -+ -+void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -+{ -+ struct wined3d_cs_set_material *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_SET_MATERIAL; -+ op->material = *material; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) +@@ -1736,6 +2128,7 @@ + op->opcode = WINED3D_CS_OP_SET_MATERIAL; + op->material = *material; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -1751,6 +2144,19 @@ + ERR("Failed to initialize CS state, hr %#x.\n", hr); + + return sizeof(struct wined3d_cs_reset_state); ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + @@ -1696,21 +1448,28 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + memset(&cs->state, 0, sizeof(cs->state)); + state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, + WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); -+} -+ -+void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -+{ -+ struct wined3d_cs_reset_state *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_RESET_STATE; -+ ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1760,6 +2166,7 @@ + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_RESET_STATE; + ++#if defined(STAGING_CSMT) + cs->ops->submit(cs, sizeof(*op)); + } + +@@ -3209,5 +3616,151 @@ + ERR("Closing event failed.\n"); + } + ++#else /* STAGING_CSMT */ + cs->ops->submit(cs); +} + +static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = +{ -+#endif /* STAGING_CSMT */ + /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, + /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, + /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, @@ -1737,207 +1496,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, + /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, + /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, -+#if defined(STAGING_CSMT) -+ /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f, -+ /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b, -+ /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_B */ wined3d_cs_exec_set_ps_consts_b, -+ /* WINED3D_CS_OP_SET_PS_CONSTS_I */ wined3d_cs_exec_set_ps_consts_i, -+ /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, -+ /* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index, -+ /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type, -+ /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, -+ /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, -+ /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, -+ /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, -+ /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, -+ /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, -+ /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, -+ /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, -+ /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, -+ /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, -+ /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, -+ /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, -+ /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, -+ /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -+ /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, -+ /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, -+ /* WINED3D_CS_OP_VIEW_DESTROY */ wined3d_cs_exec_view_destroy, -+ /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, -+ /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, -+ /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, -+ /* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup, -+ /* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup, -+ /* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup, -+ /* WINED3D_CS_OP_SAMPLER_DESTROY */ wined3d_cs_exec_sampler_destroy, -+ /* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init, -+ /* WINED3D_CS_OP_SRV_DESTROY */ wined3d_cs_exec_shader_resource_view_destroy, -+ /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, -+ /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, -+ /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures, -+ /* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context, -+ /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts, -+ /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval, -+}; -+ -+static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) -+{ -+ struct wined3d_cs_queue *queue = prio ? &cs->prio_queue : &cs->queue; -+ size_t queue_size = sizeof(queue->data) / sizeof(*queue->data); -+ -+ if (cs->thread_id == GetCurrentThreadId()) -+ ERR("Attempting to queue a command from the CS thread.\n"); -+ -+ if (queue_size - size < queue->head) -+ { -+ struct wined3d_cs_skip *skip; -+ size_t nop_size = queue_size - queue->head; -+ -+ skip = _wined3d_cs_mt_require_space(cs, nop_size, prio); -+ if (nop_size < sizeof(*skip)) -+ { -+ skip->opcode = WINED3D_CS_OP_NOP; -+ } -+ else -+ { -+ skip->opcode = WINED3D_CS_OP_SKIP; -+ skip->size = nop_size; -+ } -+ -+ if (prio) -+ cs->ops->submit_prio(cs, nop_size); -+ else -+ cs->ops->submit(cs, nop_size); -+ -+ assert(!queue->head); -+ } -+ -+ while(1) -+ { -+ LONG head = queue->head; -+ LONG tail = *((volatile LONG *)&queue->tail); -+ LONG new_pos; -+ /* Empty */ -+ if (head == tail) -+ break; -+ /* Head ahead of tail, take care of wrap-around */ -+ new_pos = (head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -+ if (head > tail && (new_pos || tail)) -+ break; -+ /* Tail ahead of head, but still enough space */ -+ if (new_pos < tail && new_pos) -+ break; -+ -+ TRACE("Waiting for free space. Head %u, tail %u, want %u\n", head, tail, -+ (unsigned int) size); -+ } -+ -+ return &queue->data[queue->head]; -+} -+ -+static inline void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) -+{ -+ return _wined3d_cs_mt_require_space(cs, size, FALSE); -+} -+ -+static inline void *wined3d_cs_mt_require_space_prio(struct wined3d_cs *cs, size_t size) -+{ -+ return _wined3d_cs_mt_require_space(cs, size, TRUE); -+} -+ -+/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an -+ * OP itself. */ -+static void wined3d_cs_emit_stop(struct wined3d_cs *cs) -+{ -+ struct wined3d_cs_stop *op; -+ -+ op = wined3d_cs_mt_require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_STOP; -+ -+ wined3d_cs_mt_submit(cs, sizeof(*op)); -+} -+ -+static void wined3d_cs_mt_finish(struct wined3d_cs *cs) -+{ -+ BOOL fence; -+ wined3d_cs_emit_fence(cs, &fence); -+ -+ /* A busy wait should be fine, we're not supposed to have to wait very -+ * long. */ -+ while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); -+} -+ -+static void wined3d_cs_mt_finish_prio(struct wined3d_cs *cs) -+{ -+ BOOL fence; -+ -+ if (cs->thread_id == GetCurrentThreadId()) -+ { -+ static BOOL once; -+ if (!once) -+ { -+ FIXME("flush_and_wait called from cs thread\n"); -+ once = TRUE; -+ } -+ return; -+ } -+ -+ wined3d_cs_emit_fence_prio(cs, &fence); -+ -+ /* A busy wait should be fine, we're not supposed to have to wait very -+ * long. */ -+ while (!InterlockedCompareExchange(&fence, TRUE, TRUE)); -+} -+ -+static const struct wined3d_cs_ops wined3d_cs_mt_ops = -+{ -+ wined3d_cs_mt_require_space, -+ wined3d_cs_mt_require_space_prio, -+ wined3d_cs_mt_submit, -+ wined3d_cs_mt_submit_prio, -+ wined3d_cs_mt_finish, -+ wined3d_cs_mt_finish_prio, -+}; -+ -+static void wined3d_cs_st_submit(struct wined3d_cs *cs, size_t size) -+{ -+ enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)&cs->queue.data; -+ -+ if (opcode >= WINED3D_CS_OP_STOP) -+ { -+ ERR("Invalid opcode %#x.\n", opcode); -+ return; -+ } -+ -+ wined3d_cs_op_handlers[opcode](cs, &cs->queue.data); -+} -+ -+static void wined3d_cs_st_finish(struct wined3d_cs *cs) -+{ -+} -+ -+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -+{ -+ return cs->queue.data; -+} -+ -+static const struct wined3d_cs_ops wined3d_cs_st_ops = -+{ -+ wined3d_cs_st_require_space, -+ wined3d_cs_st_require_space, -+ wined3d_cs_st_submit, -+ wined3d_cs_st_submit, -+ wined3d_cs_st_finish, -+ wined3d_cs_st_finish, - }; - - void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, -@@ -3207,5 +3990,120 @@ - ERR("Closing event failed.\n"); - } - -+#else /* STAGING_CSMT */ +}; + +static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) @@ -2737,7 +2295,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c + } + +#endif /* STAGING_CSMT */ - wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); + wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; @@ -3475,6 +3793,10 @@ @@ -2764,18 +2322,18 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c + } + +#endif /* STAGING_CSMT */ - wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); + wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3501,6 +3832,7 @@ - wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); +@@ -3502,6 +3833,7 @@ + start_idx, index_count, start_instance, instance_count, TRUE); } +#if defined(STAGING_CSMT) /* Context activation is done by the caller. */ static void wined3d_device_update_texture_3d(struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_level, -@@ -3511,6 +3843,36 @@ +@@ -3512,6 +3844,36 @@ TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n", context, src_texture, src_level, dst_texture, level_count); @@ -2812,7 +2370,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3518,6 +3880,7 @@ +@@ -3519,6 +3881,7 @@ for (i = 0; i < level_count; ++i) { @@ -2820,7 +2378,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_texture_get_memory(src_texture, src_level + i, &data, src_texture->resource.map_binding, FALSE); -@@ -3595,6 +3958,34 @@ +@@ -3596,6 +3959,34 @@ unsigned int src_size, dst_size, src_skip_levels = 0; unsigned int layer_count; enum wined3d_resource_type type; @@ -2855,7 +2413,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3631,6 +4022,7 @@ +@@ -3632,6 +4023,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2863,7 +2421,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* FIXME: This isn't necessary for 2D textures, but currently surface_upload_from_surface * rejects mismatching formats, and we can't report the error back after dispatching the * call. */ -@@ -3673,6 +4065,65 @@ +@@ -3674,6 +4066,65 @@ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); return WINED3D_OK; @@ -2929,7 +2487,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3720,8 +4171,13 @@ +@@ -3721,8 +4172,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -2943,7 +2501,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3910,7 +4366,9 @@ +@@ -3911,7 +4367,9 @@ struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -2953,7 +2511,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -3998,6 +4456,7 @@ +@@ -3999,6 +4457,7 @@ if (src_box) { @@ -2961,7 +2519,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !wined3d_texture_check_block_align(src_texture, src_sub_resource_idx % src_texture->level_count, src_box)) -@@ -4006,6 +4465,7 @@ +@@ -4007,6 +4466,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2969,7 +2527,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4019,6 +4479,7 @@ +@@ -4020,6 +4480,7 @@ SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -2977,7 +2535,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) { dst_box.left = dst_rect.left; -@@ -4036,6 +4497,7 @@ +@@ -4037,6 +4498,7 @@ } } @@ -2985,7 +2543,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4048,7 +4510,18 @@ +@@ -4049,7 +4511,18 @@ unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; @@ -3004,7 +2562,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); -@@ -4082,6 +4555,7 @@ +@@ -4083,6 +4556,7 @@ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -3012,7 +2570,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box) { -@@ -4091,6 +4565,18 @@ +@@ -4092,6 +4566,18 @@ width = wined3d_texture_get_level_width(texture, level); height = wined3d_texture_get_level_height(texture, level); @@ -3031,7 +2589,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box->left >= box->right || box->right > width || box->top >= box->bottom || box->bottom > height || box->front >= box->back) -@@ -4098,9 +4584,46 @@ +@@ -4099,9 +4585,46 @@ WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -3078,7 +2636,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4109,8 +4632,13 @@ +@@ -4110,8 +4633,13 @@ { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -3092,7 +2650,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); -@@ -4149,8 +4677,15 @@ +@@ -4150,8 +4678,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3108,7 +2666,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4164,6 +4699,7 @@ +@@ -4165,6 +4700,7 @@ return NULL; } @@ -3116,7 +2674,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -4179,6 +4715,22 @@ +@@ -4180,6 +4716,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -3139,7 +2697,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4218,6 +4770,7 @@ +@@ -4219,6 +4771,7 @@ } @@ -3147,7 +2705,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prev = fb->render_targets[view_idx]; if (view == prev) return WINED3D_OK; -@@ -4225,6 +4778,15 @@ +@@ -4226,6 +4779,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -3163,7 +2721,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ -@@ -4236,6 +4798,7 @@ +@@ -4237,6 +4799,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -3171,7 +2729,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_fb_state *fb = &device->state.fb; struct wined3d_rendertarget_view *prev; -@@ -4249,6 +4812,20 @@ +@@ -4250,6 +4813,20 @@ } if ((fb->depth_stencil = view)) @@ -3192,7 +2750,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4470,8 +5047,10 @@ +@@ -4471,8 +5048,10 @@ TRACE("device %p.\n", device); @@ -3203,7 +2761,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4479,6 +5058,7 @@ +@@ -4480,6 +5059,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -3211,7 +2769,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4497,6 +5077,36 @@ +@@ -4498,6 +5078,36 @@ context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -3248,7 +2806,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4518,6 +5128,7 @@ +@@ -4519,6 +5129,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -3256,7 +2814,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4536,6 +5147,14 @@ +@@ -4537,6 +5148,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -3271,7 +2829,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4552,6 +5171,7 @@ +@@ -4553,6 +5172,7 @@ return hr; } @@ -3279,7 +2837,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); if (FAILED(hr)) { -@@ -4562,6 +5182,33 @@ +@@ -4563,6 +5183,33 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -3313,7 +2871,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4581,12 +5228,14 @@ +@@ -4582,12 +5229,14 @@ TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -3328,7 +2886,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4606,9 +5255,16 @@ +@@ -4607,9 +5256,16 @@ wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -3345,7 +2903,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4617,6 +5273,7 @@ +@@ -4618,6 +5274,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -3353,7 +2911,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4626,6 +5283,12 @@ +@@ -4627,6 +5284,12 @@ { wined3d_texture_decref(device->cs->onscreen_depth_stencil->container); device->cs->onscreen_depth_stencil = NULL; @@ -3366,7 +2924,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4847,6 +5510,7 @@ +@@ -4848,6 +5511,7 @@ if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -3374,7 +2932,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = state_init(&device->state, &device->adapter->gl_info, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); -@@ -4871,6 +5535,32 @@ +@@ -4872,6 +5536,32 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -3407,7 +2965,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4878,7 +5568,11 @@ +@@ -4879,7 +5569,11 @@ { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -3419,7 +2977,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -4958,6 +5652,7 @@ +@@ -4959,6 +5653,7 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -3427,7 +2985,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource) -@@ -4965,6 +5660,17 @@ +@@ -4966,6 +5661,17 @@ } if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource) @@ -3445,7 +3003,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5100,12 +5806,17 @@ +@@ -5101,12 +5807,17 @@ device->blitter = adapter->blitter; @@ -3463,7 +3021,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state = &device->state; if (!(device->cs = wined3d_cs_create(device))) -@@ -5199,6 +5910,7 @@ +@@ -5200,6 +5911,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -3471,7 +3029,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller */ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, -@@ -5252,3 +5964,4 @@ +@@ -5253,3 +5965,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -3479,9 +3037,9 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c -@@ -411,7 +411,11 @@ - unsigned int start_idx, unsigned int index_count, unsigned int start_instance, - unsigned int instance_count, BOOL indexed) +@@ -412,7 +412,11 @@ + int base_vertex_idx, unsigned int start_idx, unsigned int index_count, + unsigned int start_instance, unsigned int instance_count, BOOL indexed) { +#if defined(STAGING_CSMT) const struct wined3d_fb_state *fb = &state->fb; @@ -3491,7 +3049,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c const struct wined3d_stream_info *stream_info; struct wined3d_event_query *ib_query = NULL; struct wined3d_stream_info si_emulated; -@@ -437,6 +441,7 @@ +@@ -438,6 +442,7 @@ for (i = 0; i < gl_info->limits.buffers; ++i) { struct wined3d_rendertarget_view *rtv = fb->render_targets[i]; @@ -3499,7 +3057,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c if (rtv && rtv->format->id != WINED3DFMT_NULL) { -@@ -450,6 +455,21 @@ +@@ -451,6 +456,21 @@ else { wined3d_texture_prepare_location(target, rtv->sub_resource_idx, @@ -3521,7 +3079,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c context, rtv->resource->draw_binding); } } -@@ -469,8 +489,13 @@ +@@ -470,8 +490,13 @@ { RECT current_rect, draw_rect, r; @@ -3535,7 +3093,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c if (surface_get_sub_resource(ds)->locations & location) SetRect(¤t_rect, 0, 0, ds->ds_current_size.cx, ds->ds_current_size.cy); -@@ -481,7 +506,11 @@ +@@ -482,7 +507,11 @@ IntersectRect(&r, &draw_rect, ¤t_rect); if (!EqualRect(&r, &draw_rect)) @@ -7274,7 +6832,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -1321,8 +1325,10 @@ +@@ -1316,8 +1320,10 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -7285,7 +6843,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1358,6 +1364,7 @@ +@@ -1353,6 +1359,7 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -7293,7 +6851,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT64 timestamp; }; -@@ -1393,6 +1400,12 @@ +@@ -1388,6 +1395,12 @@ for (i = 0; i < min(dst->rt_size, src->rt_size); i++) dst->render_targets[i] = src->render_targets[i]; } @@ -7306,7 +6864,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { -@@ -1408,7 +1421,9 @@ +@@ -1403,7 +1416,9 @@ DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -7316,7 +6874,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct -@@ -1516,6 +1531,14 @@ +@@ -1511,6 +1526,14 @@ GLuint dummy_arbfp_prog; }; @@ -7331,7 +6889,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1654,7 +1677,11 @@ +@@ -1649,7 +1672,11 @@ void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN; @@ -7343,7 +6901,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2274,7 +2301,11 @@ +@@ -2269,7 +2296,11 @@ struct wined3d_state { DWORD flags; @@ -7355,7 +6913,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2320,6 +2351,7 @@ +@@ -2315,6 +2346,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -7363,7 +6921,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -2328,6 +2360,7 @@ +@@ -2323,6 +2355,7 @@ UINT size; }; @@ -7371,7 +6929,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2380,11 +2413,23 @@ +@@ -2375,11 +2408,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -7395,7 +6953,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2432,6 +2477,7 @@ +@@ -2427,6 +2472,7 @@ UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -7403,7 +6961,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, -@@ -2443,6 +2489,11 @@ +@@ -2438,6 +2484,11 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7415,7 +6973,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2486,9 +2537,14 @@ +@@ -2481,9 +2532,14 @@ UINT depth; UINT size; DWORD priority; @@ -7430,7 +6988,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2514,7 +2570,9 @@ +@@ -2509,7 +2565,9 @@ const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -7440,7 +6998,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -@@ -2522,6 +2580,7 @@ +@@ -2517,6 +2575,7 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -7448,7 +7006,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline void wined3d_resource_inc_fence(struct wined3d_resource *resource) { InterlockedIncrement(&resource->access_fence); -@@ -2537,6 +2596,7 @@ +@@ -2532,6 +2591,7 @@ while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -7456,7 +7014,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -@@ -2594,7 +2654,9 @@ +@@ -2589,7 +2649,9 @@ DWORD flags; GLenum target; DWORD update_map_binding; @@ -7466,7 +7024,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2632,8 +2694,12 @@ +@@ -2627,8 +2689,12 @@ unsigned int map_count; DWORD locations; @@ -7479,7 +7037,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2684,6 +2750,7 @@ +@@ -2679,6 +2745,7 @@ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -7487,7 +7045,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer, void *swap_heap_memory) DECLSPEC_HIDDEN; -@@ -2694,6 +2761,13 @@ +@@ -2689,6 +2756,13 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN; @@ -7501,7 +7059,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -@@ -2704,6 +2778,7 @@ +@@ -2699,6 +2773,7 @@ const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -7509,7 +7067,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location); void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, -@@ -2719,6 +2794,15 @@ +@@ -2714,6 +2789,15 @@ const struct wined3d_gl_info *gl_info, GLenum binding) DECLSPEC_HIDDEN; void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -7525,7 +7083,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; -@@ -2836,7 +2920,11 @@ +@@ -2831,7 +2915,11 @@ unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -7537,7 +7095,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -@@ -2847,9 +2935,11 @@ +@@ -2842,9 +2930,11 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -7549,7 +7107,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2864,12 +2954,14 @@ +@@ -2859,12 +2949,14 @@ GLuint name; }; @@ -7564,7 +7122,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2898,8 +2990,10 @@ +@@ -2893,8 +2985,10 @@ BOOL half_float_conv_needed; }; @@ -7575,7 +7133,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_saved_states { DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; -@@ -2967,6 +3061,7 @@ +@@ -2962,6 +3056,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7583,7 +7141,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -3017,6 +3112,44 @@ +@@ -3012,6 +3107,44 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; @@ -7628,7 +7186,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -@@ -3065,6 +3198,7 @@ +@@ -3060,6 +3193,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; @@ -7636,7 +7194,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, -@@ -3132,6 +3266,14 @@ +@@ -3127,6 +3261,14 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7651,7 +7209,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3146,8 +3288,12 @@ +@@ -3141,8 +3283,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -7664,7 +7222,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -3161,12 +3307,16 @@ +@@ -3156,12 +3302,16 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -7681,7 +7239,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3193,7 +3343,9 @@ +@@ -3188,7 +3338,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -7691,7 +7249,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3218,6 +3370,7 @@ +@@ -3213,6 +3365,7 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7699,7 +7257,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, -@@ -3227,6 +3380,13 @@ +@@ -3222,6 +3375,13 @@ void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; @@ -7713,7 +7271,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3259,8 +3419,10 @@ +@@ -3254,8 +3414,10 @@ return texture->sub_resources[view->sub_resource_idx].u.surface; } @@ -7724,7 +7282,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_shader_resource_view { LONG refcount; -@@ -3276,6 +3438,7 @@ +@@ -3271,6 +3433,7 @@ void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -7732,7 +7290,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_shader_resource_view_destroy_cs(struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN; struct wined3d_swapchain_ops -@@ -3283,6 +3446,12 @@ +@@ -3278,6 +3441,12 @@ void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, DWORD flags, struct wined3d_rendertarget_view *depth_stencil); @@ -7745,7 +7303,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3318,8 +3487,10 @@ +@@ -3313,8 +3482,10 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7756,7 +7314,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3531,7 +3702,9 @@ +@@ -3526,7 +3697,9 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;