mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- backend sync with GZDoom.
This commit is contained in:
parent
bd0c8acd46
commit
c26b6cdf59
19 changed files with 44 additions and 44 deletions
|
@ -5346,6 +5346,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
|||
|
||||
void videoInit()
|
||||
{
|
||||
lookups.postLoadLookups();
|
||||
V_Init2();
|
||||
videoSetGameMode(vid_fullscreen, SCREENWIDTH, SCREENHEIGHT, 32, 1);
|
||||
|
||||
|
|
|
@ -91,7 +91,6 @@ OpenGLFrameBuffer::OpenGLFrameBuffer(void *hMonitor, bool fullscreen) :
|
|||
FHardwareTexture::InitGlobalState();
|
||||
|
||||
// Make sure all global variables tracking OpenGL context state are reset..
|
||||
|
||||
gl_RenderState.Reset();
|
||||
|
||||
GLRenderer = nullptr;
|
||||
|
@ -266,6 +265,7 @@ void OpenGLFrameBuffer::Swap()
|
|||
Finish.Unclock();
|
||||
camtexcount = 0;
|
||||
FHardwareTexture::UnbindAll();
|
||||
gl_RenderState.ClearLastMaterial();
|
||||
mDebug->Update();
|
||||
mVertexData->Reset();
|
||||
}
|
||||
|
@ -296,16 +296,15 @@ void OpenGLFrameBuffer::SetVSync(bool vsync)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
IHardwareTexture *OpenGLFrameBuffer::CreateHardwareTexture(int numchannels)
|
||||
{
|
||||
return new FHardwareTexture(numchannels);
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::SetTextureFilterMode()
|
||||
{
|
||||
if (GLRenderer != nullptr && GLRenderer->mSamplerManager != nullptr) GLRenderer->mSamplerManager->SetTextureFilterMode();
|
||||
}
|
||||
|
||||
IHardwareTexture *OpenGLFrameBuffer::CreateHardwareTexture(int numchannels)
|
||||
{
|
||||
return new FHardwareTexture(numchannels);
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||
{
|
||||
|
@ -326,6 +325,7 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
}
|
||||
// unbind everything.
|
||||
FHardwareTexture::UnbindAll();
|
||||
gl_RenderState.ClearLastMaterial();
|
||||
}
|
||||
|
||||
IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer()
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
FRenderState* RenderState() override;
|
||||
void UpdatePalette() override;
|
||||
const char* DeviceName() const override;
|
||||
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
|
||||
void SetTextureFilterMode() override;
|
||||
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
|
||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||
void BeginFrame() override;
|
||||
void SetViewportRects(IntRect *bounds) override;
|
||||
|
|
|
@ -91,7 +91,7 @@ void FGLRenderer::BlurScene(float gameinfobluramount)
|
|||
int eyeCount = vrmode->mEyeCount;
|
||||
for (int i = 0; i < eyeCount; ++i)
|
||||
{
|
||||
hw_postprocess.bloom.RenderBlur(&renderstate, sceneWidth, sceneHeight, gameinfobluramount);
|
||||
hw_postprocess.bloom.RenderBlur(&renderstate, sceneWidth, sceneHeight, gameinfobluramount);
|
||||
if (eyeCount - i > 1) mBuffers->NextEye(eyeCount);
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void FGLRenderer::Flush()
|
|||
auto vrmode = VRMode::GetVRMode(true);
|
||||
if (vrmode->mEyeCount == 1)
|
||||
{
|
||||
CopyToBackbuffer(nullptr, true);
|
||||
CopyToBackbuffer(nullptr, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -78,10 +78,10 @@ void FGLRenderBuffers::ClearScene()
|
|||
}
|
||||
else
|
||||
{
|
||||
DeleteRenderBuffer(mSceneMultisampleBuf);
|
||||
DeleteRenderBuffer(mSceneFogBuf);
|
||||
DeleteRenderBuffer(mSceneNormalBuf);
|
||||
DeleteRenderBuffer(mSceneDepthStencilBuf);
|
||||
DeleteRenderBuffer(mSceneMultisampleBuf);
|
||||
DeleteRenderBuffer(mSceneFogBuf);
|
||||
DeleteRenderBuffer(mSceneNormalBuf);
|
||||
DeleteRenderBuffer(mSceneDepthStencilBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __GL_SAMPLERS_H
|
||||
#define __GL_SAMPLERS_H
|
||||
|
||||
#include "gl_hwtexture.h"
|
||||
#include "textures.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
|
|
|
@ -379,14 +379,16 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
vp_comb << "#define SUPPORTS_SHADOWMAPS\n";
|
||||
}
|
||||
|
||||
vp_comb << defines << i_data.GetChars();
|
||||
FString fp_comb = vp_comb;
|
||||
vp_comb << defines << i_data.GetChars();
|
||||
fp_comb << "$placeholder$\n" << defines << i_data.GetChars();
|
||||
|
||||
vp_comb << "#line 1\n";
|
||||
fp_comb << "#line 1\n";
|
||||
|
||||
vp_comb << RemoveLayoutLocationDecl(vp_data.GetString(), "out").GetChars() << "\n";
|
||||
fp_comb << RemoveLayoutLocationDecl(fp_data.GetString(), "in").GetChars() << "\n";
|
||||
FString placeholder = "\n";
|
||||
|
||||
if (proc_prog_lump != NULL)
|
||||
{
|
||||
|
@ -448,9 +450,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
if (pp_data.GetString().IndexOf("ProcessMaterial") >= 0 && pp_data.GetString().IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// This reactivates the old logic and disables all features that cannot be supported with that method.
|
||||
fp_comb.Insert(0, "#define LEGACY_USER_SHADER\n");
|
||||
placeholder << "#define LEGACY_USER_SHADER\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -458,6 +459,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
fp_comb << proc_prog_lump + 1;
|
||||
}
|
||||
}
|
||||
fp_comb.Substitute("$placeholder$", placeholder);
|
||||
|
||||
if (light_fragprog)
|
||||
{
|
||||
|
|
|
@ -305,8 +305,8 @@ public:
|
|||
FShader *BindEffect(int effect, EPassType passType);
|
||||
FShader *Get(unsigned int eff, bool alphateston, EPassType passType);
|
||||
|
||||
private:
|
||||
void SetActiveShader(FShader *sh);
|
||||
private:
|
||||
|
||||
FShader *mActiveShader = nullptr;
|
||||
TArray<FShaderCollection*> mPassShaders;
|
||||
|
|
|
@ -305,7 +305,7 @@ void PolyFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
}
|
||||
}
|
||||
|
||||
IHardwareTexture *PolyFrameBuffer::CreateHardwareTexture(int)
|
||||
IHardwareTexture *PolyFrameBuffer::CreateHardwareTexture(int numchannels)
|
||||
{
|
||||
return new PolyHardwareTexture();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
void AmbientOccludeScene(float m5) override;
|
||||
//void SetSceneRenderTarget(bool useSSAO) override;
|
||||
|
||||
IHardwareTexture *CreateHardwareTexture(int) override;
|
||||
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
|
||||
IVertexBuffer *CreateVertexBuffer() override;
|
||||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo, bool needsresize) override;
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
FVector3 u = normalize3(eyeCoordPos);
|
||||
FVector3 n = normalize3(mul(Viewpoint->mNormalViewMatrix, FVector4(parmTexCoord.X, 0.0f, parmTexCoord.Y, 0.0f)));
|
||||
FVector3 r = reflect(u, n);
|
||||
float m = 2.0f * sqrt(r.X*r.X + r.Y*r.Y + (r.Z + 1.0f)*(r.Z + 1.0f));
|
||||
float m = 2.0f * sqrtf(r.X*r.X + r.Y*r.Y + (r.Z + 1.0f)*(r.Z + 1.0f));
|
||||
vTexCoord.X = r.X / m + 0.5f;
|
||||
vTexCoord.Y = r.Y / m + 0.5f;
|
||||
}
|
||||
|
@ -138,13 +138,13 @@ public:
|
|||
private:
|
||||
static FVector3 normalize(const FVector3 &a)
|
||||
{
|
||||
float rcplen = 1.0f / sqrt(a.X * a.X + a.Y * a.Y + a.Z * a.Z);
|
||||
float rcplen = 1.0f / sqrtf(a.X * a.X + a.Y * a.Y + a.Z * a.Z);
|
||||
return FVector3(a.X * rcplen, a.Y * rcplen, a.Z * rcplen);
|
||||
}
|
||||
|
||||
static FVector3 normalize3(const FVector4 &a)
|
||||
{
|
||||
float rcplen = 1.0f / sqrt(a.X * a.X + a.Y * a.Y + a.Z * a.Z);
|
||||
float rcplen = 1.0f / sqrtf(a.X * a.X + a.Y * a.Y + a.Z * a.Z);
|
||||
return FVector3(a.X * rcplen, a.Y * rcplen, a.Z * rcplen);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ EXTERN_CVAR(Int, screenblocks)
|
|||
|
||||
DFrameBuffer::DFrameBuffer (int width, int height)
|
||||
{
|
||||
twod = &m2DDrawer;
|
||||
SetSize(width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "i_interface.h"
|
||||
#include "v_draw.h"
|
||||
#include "templates.h"
|
||||
#include "palette.h"
|
||||
|
||||
EXTERN_CVAR(Int, menu_resolution_custom_width)
|
||||
EXTERN_CVAR(Int, menu_resolution_custom_height)
|
||||
|
@ -168,7 +167,7 @@ CUSTOM_CVAR (Bool, vid_vsync, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
}
|
||||
|
||||
// [RH] Set true when vid_setmode command has been executed
|
||||
bool setmodeneeded = false;
|
||||
bool setmodeneeded = false;
|
||||
bool setsizeneeded = false;
|
||||
|
||||
//==========================================================================
|
||||
|
@ -290,6 +289,9 @@ void V_UpdateModeSize (int width, int height)
|
|||
void V_OutputResized (int width, int height)
|
||||
{
|
||||
V_UpdateModeSize(width, height);
|
||||
// set new resolution in 2D drawer
|
||||
twod->Begin(screen->GetWidth(), screen->GetHeight());
|
||||
twod->End();
|
||||
setsizeneeded = true;
|
||||
C_NewModeAdjust();
|
||||
if (sysCallbacks && sysCallbacks->OnScreenSizeChanged)
|
||||
|
@ -358,8 +360,6 @@ void V_InitScreen()
|
|||
|
||||
void V_Init2()
|
||||
{
|
||||
lookups.postLoadLookups();
|
||||
|
||||
float gamma = static_cast<DDummyFrameBuffer *>(screen)->Gamma;
|
||||
|
||||
{
|
||||
|
@ -396,7 +396,10 @@ CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|||
sysCallbacks->OnScreenSizeChanged();
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, GetAspectRatio)
|
||||
{
|
||||
ACTION_RETURN_FLOAT(ActiveRatio(screen->GetWidth(), screen->GetHeight(), nullptr));
|
||||
}
|
||||
|
||||
CCMD(vid_setsize)
|
||||
{
|
||||
|
|
|
@ -120,14 +120,11 @@ protected:
|
|||
};
|
||||
|
||||
class IHardwareTexture;
|
||||
class FGameTexture;
|
||||
class FTexture;
|
||||
|
||||
|
||||
class DFrameBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
F2DDrawer m2DDrawer;
|
||||
private:
|
||||
int Width = 0;
|
||||
int Height = 0;
|
||||
|
@ -202,7 +199,6 @@ public:
|
|||
virtual void SetTextureFilterMode() {}
|
||||
virtual IHardwareTexture *CreateHardwareTexture(int numchannels) { return nullptr; }
|
||||
virtual void PrecacheMaterial(FMaterial *mat, int translation) {}
|
||||
virtual FModelRenderer *CreateModelRenderer(int mli) { return nullptr; }
|
||||
virtual FMaterial* CreateMaterial(FGameTexture* tex, int scaleflags);
|
||||
virtual void BeginFrame() {}
|
||||
virtual void SetWindowSize(int w, int h) {}
|
||||
|
|
|
@ -284,8 +284,10 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
{
|
||||
FString code = GetTargetGlslVersion();
|
||||
code << defines;
|
||||
code << "\n$placeholder$"; // here the code can later add more needed #defines.
|
||||
code << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n";
|
||||
code << shaderBindings;
|
||||
FString placeholder = "\n";
|
||||
|
||||
if (!device->UsedDeviceFeatures.shaderClipDistance) code << "#define NO_CLIPDISTANCE_SUPPORT\n";
|
||||
if (!alphatest) code << "#define NO_ALPHATEST\n";
|
||||
|
@ -342,7 +344,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
if (pp_code.IndexOf("ProcessMaterial") >= 0 && pp_code.IndexOf("SetupMaterial") < 0)
|
||||
{
|
||||
// This reactivates the old logic and disables all features that cannot be supported with that method.
|
||||
code.Insert(0, "#define LEGACY_USER_SHADER\n");
|
||||
placeholder << "#define LEGACY_USER_SHADER\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -351,6 +353,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
|
|||
code << (material_lump + 1) << "\n";
|
||||
}
|
||||
}
|
||||
code.Substitute("$placeholder$", placeholder);
|
||||
|
||||
if (light_lump)
|
||||
{
|
||||
|
|
|
@ -379,7 +379,7 @@ void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
}
|
||||
}
|
||||
|
||||
IHardwareTexture *VulkanFrameBuffer::CreateHardwareTexture()
|
||||
IHardwareTexture *VulkanFrameBuffer::CreateHardwareTexture(int numchannels)
|
||||
{
|
||||
return new VkHardwareTexture();
|
||||
}
|
||||
|
@ -419,11 +419,6 @@ IDataBuffer *VulkanFrameBuffer::CreateDataBuffer(int bindingpoint, bool ssbo, bo
|
|||
}
|
||||
|
||||
void VulkanFrameBuffer::SetTextureFilterMode()
|
||||
{
|
||||
TextureFilterChanged();
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::TextureFilterChanged()
|
||||
{
|
||||
if (mSamplerManager)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,6 @@ public:
|
|||
const char* DeviceName() const override;
|
||||
int Backend() override { return 1; }
|
||||
void SetTextureFilterMode() override;
|
||||
void TextureFilterChanged() override;
|
||||
void StartPrecaching() override;
|
||||
void BeginFrame() override;
|
||||
void BlurScene(float amount) override;
|
||||
|
@ -89,7 +88,7 @@ public:
|
|||
void ImageTransitionScene(bool unknown) override;
|
||||
void SetActiveRenderTarget() override;
|
||||
|
||||
IHardwareTexture *CreateHardwareTexture() override;
|
||||
IHardwareTexture *CreateHardwareTexture(int numchannels) override;
|
||||
FMaterial* CreateMaterial(FGameTexture* tex, int scaleflags) override;
|
||||
IVertexBuffer *CreateVertexBuffer() override;
|
||||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
|
|
|
@ -369,7 +369,8 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
|
|||
int translation = state.mTranslation;
|
||||
|
||||
auto remap = translation <= 0 ? nullptr : GPalette.TranslationToTable(translation);
|
||||
if (remap) translation = remap->Index;
|
||||
if (remap)
|
||||
translation = remap->Index;
|
||||
|
||||
clampmode = base->GetClampMode(clampmode);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ FBitmap AnimTexture::GetBgraBitmap(const PalEntry* remap, int* trans)
|
|||
{
|
||||
int p = i * 4;
|
||||
int index = spix[i];
|
||||
dpix[p + 0] = Palette[index*3+2];
|
||||
dpix[p + 0] = Palette[index * 3 + 2];
|
||||
dpix[p + 1] = Palette[index * 3 + 1];
|
||||
dpix[p + 2] = Palette[index * 3];
|
||||
dpix[p + 3] = 255;
|
||||
|
|
Loading…
Reference in a new issue