From e4b4e5c9437902e2b61efad6d142d7ef60921a58 Mon Sep 17 00:00:00 2001 From: Simon Anciaux <14198779+mrmixer@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:26:38 +0100 Subject: [PATCH] =?UTF-8?q?code/platform=5Fwin32/4ed=5Fdirectx=5Frender.cp?= =?UTF-8?q?p:=20Fixed=20the=20way=20texture=20array=20are=20updated.=20Not?= =?UTF-8?q?e=20that=20the=20font=20provider=20rectangle=20packer=20contain?= =?UTF-8?q?s=20a=20bug,=20and=20it=20will=20never=20produce=20several=20te?= =?UTF-8?q?xture=20slice,=20it=20will=20only=20grow=20the=20texture=20on?= =?UTF-8?q?=20y=20to=20accommodate=20for=20more=20characters.=20code/platf?= =?UTF-8?q?orm=5Fwin32/win32=5Fopengl.cpp:=20Enabled=20double=20buffering?= =?UTF-8?q?=20to=20fix=20graphical=20glitches=20on=20AMD=C2=A0cards.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/platform_win32/4ed_directx_render.cpp | 9 +++++---- code/platform_win32/win32_opengl.cpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/platform_win32/4ed_directx_render.cpp b/code/platform_win32/4ed_directx_render.cpp index 405e4490..11c4d5b8 100644 --- a/code/platform_win32/4ed_directx_render.cpp +++ b/code/platform_win32/4ed_directx_render.cpp @@ -130,10 +130,11 @@ gl__fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 di box.right = p.x + dim.x; box.top = p.y; box.bottom = p.y + dim.y; - box.front = p.z; - box.back = p.z + dim.z; - // TODO(simon): Try to make the font renderer several texture in the array to verify this works. - g_directx.context->UpdateSubresource( tex->pointer, 0, &box, data, dim.x, dim.x * dim.y ); + box.front = 0; + box.back = 1; + + u32 sub_resource_index = D3D11CalcSubresource( 0 /* MipSlice */, p.z /* ArraySlice */, 1 /* MipLevels */ ); + g_directx.context->UpdateSubresource( tex->pointer, sub_resource_index, &box, data, dim.x, dim.x * dim.y ); } return(result); diff --git a/code/platform_win32/win32_opengl.cpp b/code/platform_win32/win32_opengl.cpp index 8c2c50c9..46815f02 100644 --- a/code/platform_win32/win32_opengl.cpp +++ b/code/platform_win32/win32_opengl.cpp @@ -191,7 +191,7 @@ win32_gl_create_window(HWND *wnd_out, HGLRC *context_out, DWORD style, RECT rect /* 0*/WGL_DRAW_TO_WINDOW_ARB, TRUE, /* 2*/WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, /* 4*/WGL_SUPPORT_OPENGL_ARB, TRUE, - /* 6*/WGL_DOUBLE_BUFFER_ARB, false, + /* 6*/WGL_DOUBLE_BUFFER_ARB, true, /* 8*/WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, /*10*/WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE, /*12*/0,