From 559b29238c89513cdfae725306652249d499ffde Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 16 Aug 2023 08:04:00 +1000 Subject: [PATCH] Rebase against 5cd11ade210ce4a7b5b7b500be664b3661d3e710. --- ...d-semi-stub-for-D3DXOptimizeVertices.patch | 4 +- ...more-tests-for-IDirect3DTexture2-Loa.patch | 86 ++++++------ ...e-bindless-textures-for-GLSL-shaders.patch | 128 +++++++++--------- staging/upstream-commit | 2 +- 4 files changed, 110 insertions(+), 110 deletions(-) diff --git a/patches/d3dx9_36-D3DXOptimizeVertices/0002-d3dx9_36-Add-semi-stub-for-D3DXOptimizeVertices.patch b/patches/d3dx9_36-D3DXOptimizeVertices/0002-d3dx9_36-Add-semi-stub-for-D3DXOptimizeVertices.patch index e4c8f79b..3815a4d5 100644 --- a/patches/d3dx9_36-D3DXOptimizeVertices/0002-d3dx9_36-Add-semi-stub-for-D3DXOptimizeVertices.patch +++ b/patches/d3dx9_36-D3DXOptimizeVertices/0002-d3dx9_36-Add-semi-stub-for-D3DXOptimizeVertices.patch @@ -254,14 +254,14 @@ index f437a83cbd8..c5faae520c9 100644 + hr = D3DXOptimizeVertices(indices, num_faces, + num_vertices, FALSE, + vertex_remap); -+ ok(hr == D3D_OK, "D3DXOptimizeVertices failed. Got %x, expected D3D_OK.\n", hr); ++ ok(hr == D3D_OK, "D3DXOptimizeVertices failed. Got %lx, expected D3D_OK.\n", hr); + + /* vertex_remap must not be NULL */ + hr = D3DXOptimizeVertices(indices, num_faces, + num_vertices, FALSE, + NULL); + ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeVertices passed NULL vertex_remap " -+ "pointer. Got %x, expected D3DERR_INVALIDCALL.\n", hr); ++ "pointer. Got %lx, expected D3DERR_INVALIDCALL.\n", hr); +} + static void test_optimize_faces(void) diff --git a/patches/ddraw-IDirect3DTexture2_Load/0002-ddraw-tests-Add-more-tests-for-IDirect3DTexture2-Loa.patch b/patches/ddraw-IDirect3DTexture2_Load/0002-ddraw-tests-Add-more-tests-for-IDirect3DTexture2-Loa.patch index f161fc2b..5ea3e5f2 100644 --- a/patches/ddraw-IDirect3DTexture2_Load/0002-ddraw-tests-Add-more-tests-for-IDirect3DTexture2-Loa.patch +++ b/patches/ddraw-IDirect3DTexture2_Load/0002-ddraw-tests-Add-more-tests-for-IDirect3DTexture2-Loa.patch @@ -37,19 +37,19 @@ index 87d0648b699..e88bbf59767 100644 + ddsd.dwSize = sizeof(ddsd); + + hr = IDirectDrawSurface_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); -+ ok(hr == DD_OK, "IDirectDrawSurface_Lock returned: %x\n", hr); ++ ok(hr == DD_OK, "IDirectDrawSurface_Lock returned: %lx\n", hr); + + for (y = 0; y < ddsd.dwHeight; y++) + { -+ if (U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount == 32) ++ if (ddsd.ddpfPixelFormat.dwRGBBitCount == 32) + { -+ DWORD *textureRow = (DWORD *)((char *)ddsd.lpSurface + y * U1(ddsd).lPitch); ++ DWORD *textureRow = (DWORD *)((char *)ddsd.lpSurface + y * ddsd.lPitch); + for (x = 0; x < ddsd.dwWidth; x++) + *textureRow++ = fillcolor; + } -+ else if (U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount == 16) ++ else if (ddsd.ddpfPixelFormat.dwRGBBitCount == 16) + { -+ WORD *textureRow = (WORD *)((char *)ddsd.lpSurface + y * U1(ddsd).lPitch); ++ WORD *textureRow = (WORD *)((char *)ddsd.lpSurface + y * ddsd.lPitch); + for (x = 0; x < ddsd.dwWidth; x++) + *textureRow++ = fillcolor; + } @@ -61,7 +61,7 @@ index 87d0648b699..e88bbf59767 100644 + } + + hr = IDirectDrawSurface_Unlock(surface, NULL); -+ ok(hr == DD_OK, "IDirectDrawSurface_Unlock returned: %x\n", hr); ++ ok(hr == DD_OK, "IDirectDrawSurface_Unlock returned: %lx\n", hr); + } + + if (level != -1 && curlevel >= level) @@ -101,18 +101,18 @@ index 87d0648b699..e88bbf59767 100644 + ddsd.dwSize = sizeof(ddsd); + + hr = IDirectDrawSurface_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); -+ ok(hr == DD_OK, "IDirectDrawSurface_Lock returned: %x\n", hr); ++ ok(hr == DD_OK, "IDirectDrawSurface_Lock returned: %lx\n", hr); + + for (y = 0; y < ddsd.dwHeight; y++) + { -+ if (U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount == 32) ++ if (ddsd.ddpfPixelFormat.dwRGBBitCount == 32) + { -+ DWORD *textureRow = (DWORD *)((char *)ddsd.lpSurface + y * U1(ddsd).lPitch); ++ DWORD *textureRow = (DWORD *)((char *)ddsd.lpSurface + y * ddsd.lPitch); + for (x = 0; x < ddsd.dwWidth; x++) + { + if ((*textureRow & 0x00ffffff) != fillcolor) + { -+ ok(0, "Expected color %x, got %x at (%d, %d) in level %d\n", ++ ok(0, "Expected color %lx, got %lx at (%ld, %ld) in level %d\n", + fillcolor, *textureRow, x, y, curlevel); + result = FALSE; + goto end; @@ -120,14 +120,14 @@ index 87d0648b699..e88bbf59767 100644 + textureRow++; + } + } -+ else if (U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount == 16) ++ else if (ddsd.ddpfPixelFormat.dwRGBBitCount == 16) + { -+ WORD *textureRow = (WORD *)((char *)ddsd.lpSurface + y * U1(ddsd).lPitch); ++ WORD *textureRow = (WORD *)((char *)ddsd.lpSurface + y * ddsd.lPitch); + for (x = 0; x < ddsd.dwWidth; x++) + { + if (*textureRow != fillcolor) + { -+ ok(0, "Expected color %x, got %x at (%d, %d) in level %d\n", ++ ok(0, "Expected color %lx, got %lx at (%ld, %ld) in level %ld\n", + fillcolor, *textureRow, x, y, curlevel); + result = FALSE; + goto end; @@ -144,7 +144,7 @@ index 87d0648b699..e88bbf59767 100644 + + end: + hr = IDirectDrawSurface_Unlock(surface, NULL); -+ ok(hr == DD_OK, "IDirectDrawSurface_Unlock returned: %x\n", hr); ++ ok(hr == DD_OK, "IDirectDrawSurface_Unlock returned: %lx\n", hr); + } + + if (level != -1 && curlevel >= level) @@ -322,24 +322,24 @@ index 87d0648b699..e88bbf59767 100644 + ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + ddsd2.ddpfPixelFormat.dwSize = sizeof(ddsd2.ddpfPixelFormat); + ddsd2.ddpfPixelFormat.dwFlags = DDPF_RGB; -+ U1(U4(ddsd2).ddpfPixelFormat).dwRGBBitCount = load_tests[i].surfaces[j].format->dwRGBBitCount; -+ U2(U4(ddsd2).ddpfPixelFormat).dwRBitMask = load_tests[i].surfaces[j].format->dwRBitMask; -+ U3(U4(ddsd2).ddpfPixelFormat).dwGBitMask = load_tests[i].surfaces[j].format->dwGBitMask; -+ U4(U4(ddsd2).ddpfPixelFormat).dwBBitMask = load_tests[i].surfaces[j].format->dwBBitMask; ++ ddsd2.ddpfPixelFormat.dwRGBBitCount = load_tests[i].surfaces[j].format->dwRGBBitCount; ++ ddsd2.ddpfPixelFormat.dwRBitMask = load_tests[i].surfaces[j].format->dwRBitMask; ++ ddsd2.ddpfPixelFormat.dwGBitMask = load_tests[i].surfaces[j].format->dwGBitMask; ++ ddsd2.ddpfPixelFormat.dwBBitMask = load_tests[i].surfaces[j].format->dwBBitMask; + + if (load_tests[i].surfaces[j].levels) + { + ddsd2.dwFlags |= DDSD_MIPMAPCOUNT; + ddsd2.ddsCaps.dwCaps |= DDSCAPS_MIPMAP | DDSCAPS_COMPLEX; -+ U2(ddsd2).dwMipMapCount = load_tests[i].surfaces[j].levels; ++ ddsd2.dwMipMapCount = load_tests[i].surfaces[j].levels; + } + + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd2, &TexSurfaces[j], NULL); -+ ok(hr == D3D_OK, "IDirectDraw_CreateSurface returned %08x for surface %d in test %d\n", hr, j, i); ++ ok(hr == D3D_OK, "IDirectDraw_CreateSurface returned %08lx for surface %d in test %d\n", hr, j, i); + if (FAILED(hr)) goto next; + + hr = IDirectDrawSurface_QueryInterface(TexSurfaces[j], &IID_IDirect3DTexture, (void *)&Textures[j]); -+ ok(hr == D3D_OK, "IDirectDrawSurface_QueryInterface returned %08x for surface %d in test %d\n", hr, j, i); ++ ok(hr == D3D_OK, "IDirectDrawSurface_QueryInterface returned %08lx for surface %d in test %d\n", hr, j, i); + if (FAILED(hr)) goto next; + + if (load_tests[i].surfaces[j].levels) @@ -352,19 +352,19 @@ index 87d0648b699..e88bbf59767 100644 + } + + hr = IDirect3DTexture_Load(Textures[1], Textures[0]); -+ ok(hr == load_tests[i].hres, "IDirect3DTexture_Load returned %08x, expected %08x\n", hr, load_tests[i].hres); ++ ok(hr == load_tests[i].hres, "IDirect3DTexture_Load returned %08lx, expected %08x\n", hr, load_tests[i].hres); + if (hr != DD_OK) goto next; + + memset(&ddsd2, 0, sizeof (ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + hr = IDirectDrawSurface_GetSurfaceDesc(TexSurfaces[1], &ddsd2); -+ ok(hr == DD_OK, "IDirectDrawSurface_GetSurfaceDesc returned %08x\n", hr); ++ ok(hr == DD_OK, "IDirectDrawSurface_GetSurfaceDesc returned %08lx\n", hr); + + if (load_tests[i].surfaces[1].levels) + { -+ ok(U2(ddsd2).dwMipMapCount == load_tests[i].surfaces[1].levels, ++ ok(ddsd2.dwMipMapCount == load_tests[i].surfaces[1].levels, + "Expected %d mipmap levels, got %d in run %d\n", load_tests[i].surfaces[1].levels, -+ U2(ddsd2).dwMipMapCount, i); ++ ddsd2.dwMipMapCount, i); + } + + for (k = 0; k < load_tests[i].level_check; k++) @@ -373,21 +373,21 @@ index 87d0648b699..e88bbf59767 100644 + ok(0, "Check surface failed in test %d\n", i); + } + -+ ok(U1(U4(ddsd2).ddpfPixelFormat).dwRGBBitCount == load_tests[i].surfaces[1].format->dwRGBBitCount, ++ ok(ddsd2.ddpfPixelFormat.dwRGBBitCount == load_tests[i].surfaces[1].format->dwRGBBitCount, + "Expected %d rgb bits, got %d in run %d\n", load_tests[i].surfaces[1].format->dwRGBBitCount, -+ U1(U4(ddsd2).ddpfPixelFormat).dwRGBBitCount, i); ++ ddsd2.ddpfPixelFormat.dwRGBBitCount, i); + -+ ok(U1(U4(ddsd2).ddpfPixelFormat).dwRBitMask == load_tests[i].surfaces[1].format->dwRBitMask, ++ ok(ddsd2.ddpfPixelFormat.dwRBitMask == load_tests[i].surfaces[1].format->dwRBitMask, + "Expected %08x red bits, got %08x in run %d\n", load_tests[i].surfaces[1].format->dwRBitMask, -+ U1(U4(ddsd2).ddpfPixelFormat).dwRBitMask, i); ++ ddsd2.ddpfPixelFormat.dwRBitMask, i); + -+ ok(U1(U4(ddsd2).ddpfPixelFormat).dwGBitMask == load_tests[i].surfaces[1].format->dwGBitMask, ++ ok(ddsd2.ddpfPixelFormat.dwGBitMask == load_tests[i].surfaces[1].format->dwGBitMask, + "Expected %08x green bits, got %08x in run %d\n", load_tests[i].surfaces[1].format->dwGBitMask, -+ U1(U4(ddsd2).ddpfPixelFormat).dwGBitMask, i); ++ ddsd2.ddpfPixelFormat.dwGBitMask, i); + -+ ok(U1(U4(ddsd2).ddpfPixelFormat).dwBBitMask == load_tests[i].surfaces[1].format->dwBBitMask, ++ ok(ddsd2.ddpfPixelFormat.dwBBitMask == load_tests[i].surfaces[1].format->dwBBitMask, + "Expected %08x blue bits, got %08x in run %d\n", load_tests[i].surfaces[1].format->dwBBitMask, -+ U1(U4(ddsd2).ddpfPixelFormat).dwBBitMask, i); ++ ddsd2.ddpfPixelFormat.dwBBitMask, i); + + next: + if (Textures[0]) IDirect3DTexture_Release(Textures[0]); @@ -425,10 +425,10 @@ index 2d08718d131..0a2d575e8cc 100644 ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY; + ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat); + ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; -+ U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32; -+ U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00FF0000; -+ U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000FF00; -+ U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000FF; ++ ddsd.ddpfPixelFormat.dwRGBBitCount = 32; ++ ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; ++ ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; ++ ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; + hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &src, NULL); ok(SUCCEEDED(hr), "Failed to create source texture, hr %#lx.\n", hr); @@ -436,13 +436,13 @@ index 2d08718d131..0a2d575e8cc 100644 hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &dst, NULL); ok(SUCCEEDED(hr), "Failed to create destination texture, hr %#lx.\n", hr); -+ U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 16; -+ U2(ddsd.ddpfPixelFormat).dwRBitMask = 0xf800; -+ U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x07e0; -+ U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x001f; ++ ddsd.ddpfPixelFormat.dwRGBBitCount = 16; ++ ddsd.ddpfPixelFormat.dwRBitMask = 0xf800; ++ ddsd.ddpfPixelFormat.dwGBitMask = 0x07e0; ++ ddsd.ddpfPixelFormat.dwBBitMask = 0x001f; + + hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &dst2, NULL); -+ ok(SUCCEEDED(hr), "Failed to create destination texture, hr %#x.\n", hr); ++ ok(SUCCEEDED(hr), "Failed to create destination texture, hr %#lx.\n", hr); + hr = IDirectDrawSurface_QueryInterface(src, &IID_IDirect3DTexture, (void **)&src_tex); ok(SUCCEEDED(hr) || hr == E_NOINTERFACE, "Failed to get Direct3DTexture interface, hr %#lx.\n", hr); @@ -463,7 +463,7 @@ index 2d08718d131..0a2d575e8cc 100644 + /* Source surface has a color key but destination differs in format */ + ckey.dwColorSpaceLowValue = ckey.dwColorSpaceHighValue = 0x0; + hr = IDirect3DTexture_Load(dst2_tex, src_tex); -+ ok(hr == E_FAIL, "Got unexpected hr %#x, expected E_FAIL.\n", hr); ++ ok(hr == E_FAIL, "Got unexpected hr %#lx, expected E_FAIL.\n", hr); + /* Both surfaces have a color key: Dest ckey is overwritten */ ckey.dwColorSpaceLowValue = ckey.dwColorSpaceHighValue = 0x000000ff; diff --git a/patches/wined3d-bindless-texture/0001-wined3d-Use-bindless-textures-for-GLSL-shaders.patch b/patches/wined3d-bindless-texture/0001-wined3d-Use-bindless-textures-for-GLSL-shaders.patch index 0038c5b2..b21eb58b 100644 --- a/patches/wined3d-bindless-texture/0001-wined3d-Use-bindless-textures-for-GLSL-shaders.patch +++ b/patches/wined3d-bindless-texture/0001-wined3d-Use-bindless-textures-for-GLSL-shaders.patch @@ -1,4 +1,4 @@ -From 978c4aaa20278ef16009351e1f65ec543df4aefa Mon Sep 17 00:00:00 2001 +From 83f5eda40173f8d4d782179449814f6eeb153f7b Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Tue, 2 Oct 2018 23:28:01 -0500 Subject: [PATCH] wined3d: Use bindless textures for GLSL shaders. @@ -14,12 +14,12 @@ Signed-off-by: Andrew Wesie dlls/wined3d/shader.c | 7 ++ dlls/wined3d/texture.c | 18 +++-- dlls/wined3d/view.c | 30 ++++++++ - dlls/wined3d/wined3d_gl.h | 1 + - dlls/wined3d/wined3d_private.h | 25 +++++++ + dlls/wined3d/wined3d_gl.h | 19 +++++ + dlls/wined3d/wined3d_private.h | 7 ++ 10 files changed, 261 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c -index 4d55655e7bf..938fd4b4f02 100644 +index 8adfabaa590..af543ee1219 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -56,6 +56,7 @@ static const struct wined3d_extension_map gl_extension_map[] = @@ -30,7 +30,7 @@ index 4d55655e7bf..938fd4b4f02 100644 {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED }, {"GL_ARB_buffer_storage", ARB_BUFFER_STORAGE }, {"GL_ARB_clear_buffer_object", ARB_CLEAR_BUFFER_OBJECT }, -@@ -2121,6 +2122,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info) +@@ -2122,6 +2123,11 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info) /* GL_ARB_base_instance */ USE_GL_FUNC(glDrawArraysInstancedBaseInstance) USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance) @@ -43,10 +43,10 @@ index 4d55655e7bf..938fd4b4f02 100644 USE_GL_FUNC(glBindFragDataLocationIndexed) USE_GL_FUNC(glGetFragDataIndex) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c -index 592216051c2..64782f7c286 100644 +index 14703e9c66c..391c4cb570a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c -@@ -5631,6 +5631,12 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv) +@@ -5654,6 +5654,12 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv) return priv->ffp_proj_control; } @@ -59,7 +59,7 @@ index 592216051c2..64782f7c286 100644 static void shader_arb_precompile(void *shader_priv, struct wined3d_shader *shader) {} static uint64_t shader_arb_shader_compile(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc, -@@ -5659,6 +5665,7 @@ const struct wined3d_shader_backend_ops arb_program_shader_backend = +@@ -5682,6 +5688,7 @@ const struct wined3d_shader_backend_ops arb_program_shader_backend = shader_arb_get_caps, shader_arb_color_fixup_supported, shader_arb_has_ffp_proj_control, @@ -68,10 +68,10 @@ index 592216051c2..64782f7c286 100644 }; diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c -index a8c5160a5b3..3cf56c321d1 100644 +index 36786cc5a29..ed13bee01f5 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c -@@ -4006,6 +4006,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl * +@@ -4002,6 +4002,12 @@ static void wined3d_context_gl_bind_shader_resources(struct wined3d_context_gl * if (!(shader = state->shader[shader_type])) return; @@ -85,7 +85,7 @@ index a8c5160a5b3..3cf56c321d1 100644 &shader->reg_maps.shader_version, &base, &count); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 496d1038f55..d6e91c47229 100644 +index 8501fcbbaf5..330338f8597 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -579,6 +579,59 @@ void wined3d_device_destroy_default_samplers(struct wined3d_device *device) @@ -109,7 +109,7 @@ index 496d1038f55..d6e91c47229 100644 +{ + const struct wined3d_gl_info *gl_info = context_gl->gl_info; + const struct wined3d_dummy_textures *textures = &wined3d_device_gl(device)->dummy_textures; -+ struct wined3d_dummy_sampler_handles *handles = &device->dummy_sampler_handles; ++ struct wined3d_dummy_sampler_handles *handles = &wined3d_device_gl(device)->dummy_sampler_handles; + + if (!gl_info->supported[ARB_BINDLESS_TEXTURE]) + return; @@ -148,7 +148,7 @@ index 496d1038f55..d6e91c47229 100644 static bool wined3d_null_image_vk_init(struct wined3d_image_vk *image, struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, VkImageType type, unsigned int layer_count, unsigned int sample_count) { -@@ -1289,6 +1342,7 @@ void wined3d_device_gl_create_primary_opengl_context_cs(void *object) +@@ -1290,6 +1343,7 @@ void wined3d_device_gl_create_primary_opengl_context_cs(void *object) wined3d_device_gl_create_dummy_textures(device_gl, context_gl); wined3d_device_create_default_samplers(device, context); @@ -157,10 +157,10 @@ index 496d1038f55..d6e91c47229 100644 } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c -index 5d878857ae8..dc50dc1858c 100644 +index a1a9c5d387c..52ea047d762 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -742,6 +742,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b +@@ -730,6 +730,113 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b ERR("Unmapped sampler %u.\n", sampler_idx); } @@ -176,7 +176,7 @@ index 5d878857ae8..dc50dc1858c 100644 +static GLuint64 shader_glsl_dummy_sampler_handle(const struct wined3d_context *context, + enum wined3d_shader_resource_type type) +{ -+ const struct wined3d_device *device = context->device; ++ const struct wined3d_device_gl *device = wined3d_device_gl(context->device); + + switch (type) + { @@ -274,7 +274,7 @@ index 5d878857ae8..dc50dc1858c 100644 /* Context activation is done by the caller. */ static void shader_glsl_load_samplers(const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps) -@@ -2549,7 +2656,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c +@@ -2443,7 +2550,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c break; } @@ -285,7 +285,7 @@ index 5d878857ae8..dc50dc1858c 100644 shader_glsl_append_sampler_binding_qualifier(buffer, &context_gl->c, version, entry->bind_idx); shader_addline(buffer, "uniform %s%s %s_sampler%u;\n", sampler_type_prefix, sampler_type, prefix, entry->bind_idx); -@@ -7631,6 +7740,8 @@ static void shader_glsl_generate_colour_key_test(struct wined3d_string_buffer *b +@@ -7620,6 +7729,8 @@ static void shader_glsl_generate_colour_key_test(struct wined3d_string_buffer *b static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info) { @@ -294,7 +294,7 @@ index 5d878857ae8..dc50dc1858c 100644 if (gl_info->supported[ARB_CULL_DISTANCE]) shader_addline(buffer, "#extension GL_ARB_cull_distance : enable\n"); if (gl_info->supported[ARB_GPU_SHADER5]) -@@ -11771,6 +11882,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend = +@@ -11631,6 +11742,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend = shader_glsl_get_caps, shader_glsl_color_fixup_supported, shader_glsl_has_ffp_proj_control, @@ -303,10 +303,10 @@ index 5d878857ae8..dc50dc1858c 100644 }; diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c -index 3d60af16359..2d3614f67d5 100644 +index 96b47db9ed6..3cb7feeddda 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2047,6 +2047,12 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv) +@@ -2032,6 +2032,12 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv) return priv->ffp_proj_control; } @@ -319,7 +319,7 @@ index 3d60af16359..2d3614f67d5 100644 static uint64_t shader_none_shader_compile(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc, enum wined3d_shader_type shader_type) { -@@ -2072,6 +2078,7 @@ const struct wined3d_shader_backend_ops none_shader_backend = +@@ -2057,6 +2063,7 @@ const struct wined3d_shader_backend_ops none_shader_backend = shader_none_get_caps, shader_none_color_fixup_supported, shader_none_has_ffp_proj_control, @@ -328,10 +328,10 @@ index 3d60af16359..2d3614f67d5 100644 }; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 78b1f52221c..8a0d9031d67 100644 +index 664e012cfe5..9e81e4085b1 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1259,7 +1259,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_ +@@ -1260,7 +1260,7 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_ } /* Context activation is done by the caller. */ @@ -340,7 +340,7 @@ index 78b1f52221c..8a0d9031d67 100644 struct wined3d_context_gl *context_gl, BOOL srgb) { const struct wined3d_format *format = texture_gl->t.resource.format; -@@ -1283,10 +1283,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, +@@ -1284,10 +1284,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, target = texture_gl->target; if (gl_tex->name) @@ -352,7 +352,7 @@ index 78b1f52221c..8a0d9031d67 100644 gl_info->gl_ops.gl.p_glGenTextures(1, &gl_tex->name); checkGLcall("glGenTextures"); -@@ -1295,7 +1292,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, +@@ -1296,7 +1293,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, if (!gl_tex->name) { ERR("Failed to generate a texture name.\n"); @@ -361,7 +361,7 @@ index 78b1f52221c..8a0d9031d67 100644 } /* Initialise the state of the texture object to the OpenGL defaults, not -@@ -1379,6 +1376,15 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, +@@ -1380,6 +1377,15 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, gl_info->gl_ops.gl.p_glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle); checkGLcall("set format swizzle"); } @@ -378,10 +378,10 @@ index 78b1f52221c..8a0d9031d67 100644 /* Context activation is done by the caller. */ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index d318318d2b3..5f4c7684a7e 100644 +index 675cc186b36..4632b136c28 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c -@@ -1260,6 +1260,36 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl +@@ -1267,6 +1267,36 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl wined3d_sampler_gl_bind(sampler_gl, unit, texture_gl, context_gl); } @@ -419,10 +419,10 @@ index d318318d2b3..5f4c7684a7e 100644 static void shader_resource_view_gl_bind_and_dirtify(struct wined3d_shader_resource_view_gl *view_gl, struct wined3d_context_gl *context_gl) diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h -index 75c4cd732ab..ccc1ce2f0ff 100644 +index 4e62a456526..39af467d677 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h -@@ -42,6 +42,7 @@ enum wined3d_gl_extension +@@ -48,6 +48,7 @@ enum wined3d_gl_extension APPLE_YCBCR_422, /* ARB */ ARB_BASE_INSTANCE, @@ -430,28 +430,7 @@ index 75c4cd732ab..ccc1ce2f0ff 100644 ARB_BLEND_FUNC_EXTENDED, ARB_BUFFER_STORAGE, ARB_CLEAR_BUFFER_OBJECT, -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d5e4081d37f..af016db240a 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -113,6 +113,7 @@ static inline const char *wined3d_get_line(const char **ptr, const char *end) - struct wined3d_fragment_pipe_ops; - struct wined3d_adapter; - struct wined3d_context; -+struct wined3d_context_gl; - struct wined3d_gl_info; - struct wined3d_state; - struct wined3d_swapchain_gl; -@@ -1609,6 +1610,8 @@ struct wined3d_shader_backend_ops - void (*shader_get_caps)(const struct wined3d_adapter *adapter, struct shader_caps *caps); - BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup); - BOOL (*shader_has_ffp_proj_control)(void *shader_priv); -+ void (*shader_load_sampler_handles)(void *shader_priv, struct wined3d_context_gl *context_gl, -+ const struct wined3d_state *state, const struct wined3d_shader *shader); - uint64_t (*shader_compile)(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc, - enum wined3d_shader_type shader_type); - }; -@@ -3524,6 +3527,21 @@ struct wined3d_dummy_textures +@@ -828,6 +829,21 @@ struct wined3d_dummy_textures GLuint tex_2d_ms_array; }; @@ -470,20 +449,41 @@ index d5e4081d37f..af016db240a 100644 + GLuint64 tex_2d_ms_array; +}; + - #define WINED3D_UNMAPPED_STAGE ~0u - - /* Multithreaded flag. Removed from the public header to signal that -@@ -3599,6 +3617,9 @@ struct wined3d_device - struct wined3d_sampler *default_sampler; - struct wined3d_sampler *null_sampler; + struct wined3d_device_gl + { + struct wined3d_device d; +@@ -835,6 +851,9 @@ struct wined3d_device_gl + /* Textures for when no other textures are bound. */ + struct wined3d_dummy_textures dummy_textures; + /* Texture sampler handles for when no texture is mapped */ + struct wined3d_dummy_sampler_handles dummy_sampler_handles; + - /* Command stream */ - struct wined3d_cs *cs; - -@@ -4177,6 +4198,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture, + CRITICAL_SECTION allocator_cs; + struct wined3d_allocator allocator; + uint64_t completed_fence_id; +diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h +index e52754f6625..fefd8753af3 100644 +--- a/dlls/wined3d/wined3d_private.h ++++ b/dlls/wined3d/wined3d_private.h +@@ -95,6 +95,7 @@ static inline const char *wined3d_get_line(const char **ptr, const char *end) + struct wined3d_fragment_pipe_ops; + struct wined3d_adapter; + struct wined3d_context; ++struct wined3d_context_gl; + struct wined3d_gl_info; + struct wined3d_state; + struct wined3d_swapchain_gl; +@@ -1553,6 +1554,8 @@ struct wined3d_shader_backend_ops + void (*shader_get_caps)(const struct wined3d_adapter *adapter, struct shader_caps *caps); + BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup); + BOOL (*shader_has_ffp_proj_control)(void *shader_priv); ++ void (*shader_load_sampler_handles)(void *shader_priv, struct wined3d_context_gl *context_gl, ++ const struct wined3d_state *state, const struct wined3d_shader *shader); + uint64_t (*shader_compile)(struct wined3d_context *context, const struct wined3d_shader_desc *shader_desc, + enum wined3d_shader_type shader_type); + }; +@@ -3504,6 +3507,8 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture, void wined3d_texture_get_bo_address(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, uint32_t location) DECLSPEC_HIDDEN; GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; @@ -492,7 +492,7 @@ index d5e4081d37f..af016db240a 100644 void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location) DECLSPEC_HIDDEN; void wined3d_texture_load(struct wined3d_texture *texture, -@@ -4889,6 +4912,8 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view +@@ -4210,6 +4215,8 @@ HRESULT wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void wined3d_shader_resource_view_gl_update(struct wined3d_shader_resource_view_gl *srv_gl, struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN; diff --git a/staging/upstream-commit b/staging/upstream-commit index ee3c1893..3c474a99 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -8f76cc687da9c0fc7fb10e84a8cf36bcad0ef473 +5cd11ade210ce4a7b5b7b500be664b3661d3e710