- 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 <commctrl.h>
#include <richedit.h> #include <richedit.h>
#include <processenv.h>
#include <shellapi.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable:4244) #pragma warning(disable:4244)
#endif #endif
@ -189,14 +192,21 @@ static void UnWTS (void)
static int LayoutErrorPane (HWND pane, int w) static int LayoutErrorPane (HWND pane, int w)
{ {
HWND ctl; HWND ctl, ctl_two;
RECT rectc; RECT rectc, rectc_two;
// Right-align the Quit button. // Right-align the Quit button.
ctl = GetDlgItem (pane, IDOK); ctl = GetDlgItem (pane, IDOK);
GetClientRect (ctl, &rectc); // Find out how big it is. GetClientRect (ctl, &rectc); // Find out how big it is.
MoveWindow (ctl, w - rectc.right - 1, 1, rectc.right, rectc.bottom, TRUE); 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, NULL, TRUE);
InvalidateRect (ctl_two, NULL, TRUE);
// Return the needed height for this layout // Return the needed height for this layout
return rectc.bottom + 2; return rectc.bottom + 2;
@ -545,9 +555,16 @@ INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
// There is only one button, and it's "Ok" and makes us quit.
if (HIWORD(wParam) == BN_CLICKED) 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); PostQuitMessage (0);
return TRUE; return TRUE;
} }

View file

@ -43,6 +43,7 @@
#include "v_font.h" #include "v_font.h"
#include "palette.h" #include "palette.h"
#include "build.h" #include "build.h"
#include "v_video.h"
//=========================================================================== //===========================================================================
// //
@ -100,7 +101,7 @@ void PaletteManager::BindPalette(int index)
if (palettetextures[index] == nullptr) 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"); p->CreateTexture((uint8_t*)palettedata->Palette, 256, 1, 15, false, "Palette");
palettetextures[index] = p; palettetextures[index] = p;
} }
@ -126,7 +127,7 @@ void PaletteManager::BindPalswap(int index)
lastsindex = index; lastsindex = index;
if (palswaptextures[index] == nullptr) 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. // Perform a 0<->255 index swap. The lookup tables are still the original data.
TArray<uint8_t> lookup(numshades * 256, true); 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) bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler)
{ {
TexturePick texpick; TexturePick texpick;

View file

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

View file

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

View file

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

View file

@ -18,17 +18,17 @@ BEGIN
LTEXT "Select which game file (GRP) to run.",IDC_STATIC,12,44,190,8 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 LISTBOX IDC_IWADLIST,12,56,200,87,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Video settings",IDC_STATIC,8,155,109,52 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 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 "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 &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 "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 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 DEFPUSHBUTTON "&Play GZDoom",IDOK,8,228,90,14
PUSHBUTTON "Exit",IDCANCEL,166,228,50,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 "&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 "&Vulkan",IDC_WELCOME_VULKAN2,"Button",BS_AUTORADIOBUTTON,13,177,37,10
CONTROL "SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,13,188,43,10 CONTROL "&SoftPoly",IDC_WELCOME_VULKAN3,"Button",BS_AUTORADIOBUTTON,13,188,43,10
END END
IDD_CRASHDIALOG DIALOGEX 0, 0, 415, 308 IDD_CRASHDIALOG DIALOGEX 0, 0, 415, 308
@ -38,7 +38,7 @@ CAPTION "Very Fatal Error"
FONT 8, "MS Shell Dlg", 400, 0, 0x0 FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN BEGIN
CONTROL "",IDC_CRASHTAB,"SysTabControl32",WS_TABSTOP,4,4,404,280 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 PUSHBUTTON "&Discard Report",IDNO,338,289,70,14
END END
@ -47,10 +47,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
EDITTEXT IDC_CRASHINFO,7,126,377,90,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL 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 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 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 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,42,407,1
GROUPBOX "Summary",IDC_STATIC,7,223,377,34 GROUPBOX "Summary",IDC_STATIC,7,223,377,34
LTEXT "Static",IDC_CRASHSUMMARY,14,233,363,20 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 LTEXT "The selected file contains this information:",IDC_STATIC,7,74,136,8
RTEXT "Static",IDC_CRASHFILESIZE,337,74,55,8 RTEXT "Static",IDC_CRASHFILESIZE,337,74,55,8
LISTBOX IDC_CRASHFILES,7,15,385,53,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP 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 END
IDD_ERRORPANE DIALOGEX 0, 0, 190, 28 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 EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN 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 END