- updated startup dialog and fixed multisampling not active in the 3D scene.

This commit is contained in:
Christoph Oelckers 2020-06-14 20:59:26 +02:00
parent 946da7d622
commit 5effc95ae1
7 changed files with 45 additions and 56 deletions

View file

@ -41,6 +41,9 @@
#include <commctrl.h>
#include <richedit.h>
#include <processenv.h>
#include <shellapi.h>
#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif
@ -189,14 +192,21 @@ static void UnWTS (void)
static int LayoutErrorPane (HWND pane, int w)
{
HWND ctl;
RECT rectc;
HWND ctl, ctl_two;
RECT rectc, rectc_two;
// Right-align the Quit button.
ctl = GetDlgItem (pane, IDOK);
GetClientRect (ctl, &rectc); // Find out how big it is.
MoveWindow (ctl, w - rectc.right - 1, 1, rectc.right, rectc.bottom, TRUE);
// Second-right-align the Restart button
ctl_two = GetDlgItem (pane, IDC_BUTTON1);
GetClientRect (ctl_two, &rectc_two); // Find out how big it is.
MoveWindow (ctl_two, w - rectc.right - rectc_two.right - 2, 1, rectc.right, rectc.bottom, TRUE);
InvalidateRect (ctl, NULL, TRUE);
InvalidateRect (ctl_two, NULL, TRUE);
// Return the needed height for this layout
return rectc.bottom + 2;
@ -545,9 +555,16 @@ INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
return TRUE;
case WM_COMMAND:
// There is only one button, and it's "Ok" and makes us quit.
if (HIWORD(wParam) == BN_CLICKED)
{
if (LOWORD(wParam) == IDC_BUTTON1) // we pressed the restart button, so run GZDoom again
{
HMODULE hModule = GetModuleHandleW(NULL);
WCHAR path[MAX_PATH];
GetModuleFileNameW(hModule, path, MAX_PATH);
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
}
PostQuitMessage (0);
return TRUE;
}

View file

@ -43,6 +43,7 @@
#include "v_font.h"
#include "palette.h"
#include "build.h"
#include "v_video.h"
//===========================================================================
//
@ -100,7 +101,7 @@ void PaletteManager::BindPalette(int index)
if (palettetextures[index] == nullptr)
{
auto p = GLInterface.NewTexture(4);
auto p = screen->CreateHardwareTexture(4);
p->CreateTexture((uint8_t*)palettedata->Palette, 256, 1, 15, false, "Palette");
palettetextures[index] = p;
}
@ -126,7 +127,7 @@ void PaletteManager::BindPalswap(int index)
lastsindex = index;
if (palswaptextures[index] == nullptr)
{
auto p = GLInterface.NewTexture(1);
auto p = screen->CreateHardwareTexture(1);
// Perform a 0<->255 index swap. The lookup tables are still the original data.
TArray<uint8_t> lookup(numshades * 256, true);

View file

@ -50,17 +50,6 @@
//
//===========================================================================
OpenGLRenderer::FHardwareTexture* GLInstance::LoadTexture(FTexture *tex, int textype, int palid)
{
if (textype == TT_INDEXED) palid = -1;
auto phwtex = tex->SystemTextures.GetHardwareTexture(palid, false);
if (phwtex) return (OpenGLRenderer::FHardwareTexture*)phwtex;
auto hwtex = static_cast<OpenGLRenderer::FHardwareTexture*>(screen->CreateHardwareTexture(textype == TT_INDEXED? 1:4));
if (hwtex) tex->SystemTextures.AddHardwareTexture(palid, false, hwtex);
return hwtex;
}
bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler)
{
TexturePick texpick;

View file

@ -96,11 +96,6 @@ void GLInstance::Deinit()
lastPalswapIndex = -1;
}
OpenGLRenderer::FHardwareTexture* GLInstance::NewTexture(int numchannels)
{
return new OpenGLRenderer::FHardwareTexture(numchannels);
}
void GLInstance::Draw(EDrawType type, size_t start, size_t count)
{
assert (BufferLock > 0);
@ -121,6 +116,7 @@ void GLInstance::DoDraw()
{
lastState.Flags = ~rendercommands[0].StateFlags; // Force ALL flags to be considered 'changed'.
lastState.DepthFunc = INT_MIN; // Something totally invalid.
screen->RenderState()->EnableMultisampling(true);
for (auto& rs : rendercommands)
{
@ -177,7 +173,6 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
if (StateFlags != oldState.Flags)
{
state.EnableDepthTest(StateFlags & STF_DEPTHTEST);
state.EnableMultisampling(StateFlags & STF_MULTISAMPLE);
if ((StateFlags ^ oldState.Flags) & (STF_STENCILTEST | STF_STENCILWRITE))
{

View file

@ -28,16 +28,14 @@ enum
class PaletteManager
{
OpenGLRenderer::FHardwareTexture* palettetextures[256] = {};
OpenGLRenderer::FHardwareTexture* palswaptextures[256] = {};
IHardwareTexture* palettetextures[256] = {};
IHardwareTexture* palswaptextures[256] = {};
uint32_t lastindex = ~0u;
uint32_t lastsindex = ~0u;
GLInstance* const inst;
//OpenGLRenderer::GLDataBuffer* palswapBuffer = nullptr;
unsigned FindPalswap(const uint8_t* paldata, palette_t& fadecolor);
public:
@ -86,7 +84,6 @@ public:
TArray<PolymostRenderState> rendercommands;
PaletteManager palmanager;
int lastPalswapIndex = -1;
OpenGLRenderer::FHardwareTexture* texv;
FGameTexture* currentTexture = nullptr;
int MatrixChange = 0;
@ -112,8 +109,6 @@ public:
void Draw(EDrawType type, size_t start, size_t count);
void DoDraw();
OpenGLRenderer::FHardwareTexture* NewTexture(int numchannels = 4);
float GetProjectionM5() { return mProjectionM5; }
int SetMatrix(int num, const VSMatrix *mat );
int SetMatrix(int num, const float *mat)
@ -171,12 +166,6 @@ public:
else renderState.StateFlags &= ~STF_DEPTHTEST;
}
void EnableMultisampling(bool on)
{
if (on) renderState.StateFlags |= STF_MULTISAMPLE;
else renderState.StateFlags &= ~STF_MULTISAMPLE;
}
void EnableStencilWrite(int value)
{
renderState.StateFlags |= STF_STENCILWRITE;
@ -370,14 +359,12 @@ public:
renderState.AlphaThreshold = al;
}
OpenGLRenderer::FHardwareTexture *LoadTexture(FTexture* tex, int texturetype, int palid);
void SetPaletteTexture(OpenGLRenderer::FHardwareTexture* tex)
void SetPaletteTexture(IHardwareTexture* tex)
{
renderState.PaletteTexture = tex;
}
void SetLookupTexture(OpenGLRenderer::FHardwareTexture* tex)
void SetLookupTexture(IHardwareTexture* tex)
{
renderState.LookupTexture = tex;
}

View file

@ -34,7 +34,6 @@ enum PRSFlags
STF_COLORMASK = 2,
STF_DEPTHMASK = 4,
STF_DEPTHTEST = 8,
STF_MULTISAMPLE = 16,
STF_STENCILWRITE = 32,
STF_STENCILTEST = 64,
STF_CULLCW = 128,
@ -62,7 +61,7 @@ struct PolymostRenderState
int hictint_flags = -1;
FDepthBiasState mBias{ };
FMaterialState mMaterial;
OpenGLRenderer::FHardwareTexture* PaletteTexture = nullptr, * LookupTexture = nullptr;
IHardwareTexture* PaletteTexture = nullptr, * LookupTexture = nullptr;
int StateFlags = STF_COLORMASK|STF_DEPTHMASK;
FRenderStyle Style{};

View file

@ -18,17 +18,17 @@ BEGIN
LTEXT "Select which game file (GRP) to run.",IDC_STATIC,12,44,190,8
LISTBOX IDC_IWADLIST,12,56,200,87,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Video settings",IDC_STATIC,8,155,109,52
CONTROL "Fullscreen",IDC_WELCOME_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,167,48,10
CONTROL "&Fullscreen",IDC_WELCOME_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,167,48,10
GROUPBOX "Resource settings",IDC_STATIC,123,155,95,52
CONTROL "Disable autoload",IDC_WELCOME_NOAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,170,65,10
//CONTROL "Load lights",IDC_WELCOME_LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,180,51,10
//CONTROL "Load brightmaps",IDC_WELCOME_BRIGHTMAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,190,65,10
CONTROL "Don't ask me this again",IDC_DONTASKIWAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,211,87,10
DEFPUSHBUTTON "Play!",IDOK,8,228,90,14
PUSHBUTTON "Exit",IDCANCEL,166,228,50,14
CONTROL "OpenGL",IDC_WELCOME_VULKAN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,167,41,10
CONTROL "Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,13,177,37,10
CONTROL "SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,13,188,43,10
CONTROL "Disable &autoload",IDC_WELCOME_NOAUTOLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,170,65,10
CONTROL "Load &lights",IDC_WELCOME_LIGHTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,180,51,10
CONTROL "Load &brightmaps",IDC_WELCOME_BRIGHTMAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,190,65,10
CONTROL "&Don't ask me this again",IDC_DONTASKIWAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,211,87,10
DEFPUSHBUTTON "&Play GZDoom",IDOK,8,228,90,14
PUSHBUTTON "E&xit",IDCANCEL,166,228,50,14
CONTROL "&OpenGL",IDC_WELCOME_VULKAN1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,167,41,10
CONTROL "&Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON,13,177,37,10
CONTROL "&SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10
END
IDD_CRASHDIALOG DIALOGEX 0, 0, 415, 308
@ -38,7 +38,7 @@ CAPTION "Very Fatal Error"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
CONTROL "",IDC_CRASHTAB,"SysTabControl32",WS_TABSTOP,4,4,404,280
PUSHBUTTON "Save Report to Disk...",IDC_SAVEREPORT,242,289,91,14
PUSHBUTTON "&Save Report to Disk...",IDC_SAVEREPORT,242,289,91,14
PUSHBUTTON "&Discard Report",IDNO,338,289,70,14
END
@ -47,10 +47,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_CRASHINFO,7,126,377,90,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
CONTROL "",IDC_PLEASETELLUS,"RichEdit20A",ES_MULTILINE | ES_READONLY,7,50,377,54,WS_EX_TRANSPARENT
CONTROL "",IDC_PLEASETELLUS,"RichEdit20W",ES_MULTILINE | ES_READONLY,7,50,377,54,WS_EX_TRANSPARENT
LTEXT "(Optional) To help diagnose the cause of this error, please describe what you were doing when the error occured. If you were playing with custom data, please also indicate where to obtain them:",IDC_STATIC,7,108,377,16,0,WS_EX_TRANSPARENT
CONTROL 131,IDC_DEADGUYVIEWER,"Static",SS_BITMAP,345,7,23,26
CONTROL "",IDC_CRASHHEADER,"RichEdit20A",ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY,18,13,306,25,WS_EX_TRANSPARENT
CONTROL "",IDC_CRASHHEADER,"RichEdit20W",ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY,18,13,306,25,WS_EX_TRANSPARENT
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,42,407,1
GROUPBOX "Summary",IDC_STATIC,7,223,377,34
LTEXT "Static",IDC_CRASHSUMMARY,14,233,363,20
@ -64,7 +64,7 @@ BEGIN
LTEXT "The selected file contains this information:",IDC_STATIC,7,74,136,8
RTEXT "Static",IDC_CRASHFILESIZE,337,74,55,8
LISTBOX IDC_CRASHFILES,7,15,385,53,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_CRASHFILECONTENTS,"RichEdit20A",ES_MULTILINE | ES_READONLY | WS_BORDER | WS_VSCROLL | WS_TABSTOP,7,83,385,174
CONTROL "",IDC_CRASHFILECONTENTS,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_BORDER | WS_VSCROLL | WS_TABSTOP,7,83,385,174
END
IDD_ERRORPANE DIALOGEX 0, 0, 190, 28
@ -72,7 +72,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CL
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Quit",IDOK,133,7,50,14
DEFPUSHBUTTON "E&xit",IDOK,133,7,50,14
PUSHBUTTON "&Restart",IDC_BUTTON1,79,7,50,14
END