mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- minor adjustments
This commit is contained in:
parent
c2df818012
commit
40ee32a0ce
8 changed files with 30 additions and 17 deletions
|
@ -293,6 +293,7 @@ class FTexture
|
|||
friend class FWarpTexture;
|
||||
friend class FMaterial;
|
||||
friend class OpenGLRenderer::FGLRenderState; // For now this needs access to some fields in ApplyMaterial. This should be rerouted through the Material class
|
||||
friend class VkRenderState;
|
||||
friend struct FTexCoordInfo;
|
||||
friend class OpenGLRenderer::FHardwareTexture;
|
||||
friend class VkHardwareTexture;
|
||||
|
|
|
@ -583,12 +583,4 @@ bool FGLRenderState::SetDepthClamp(bool on)
|
|||
return res;
|
||||
}
|
||||
|
||||
void FGLRenderState::CheckTimer(uint64_t ShaderStartTime)
|
||||
{
|
||||
// if firstFrame is not yet initialized, initialize it to current time
|
||||
// if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision
|
||||
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1 << 24) || ShaderStartTime >= firstFrame)
|
||||
firstFrame = screen->FrameTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ struct GLSectorPlane;
|
|||
|
||||
class FGLRenderState : public FRenderState
|
||||
{
|
||||
uint64_t firstFrame = 0;
|
||||
|
||||
uint8_t mLastDepthClamp : 1;
|
||||
|
||||
float mGlossiness, mSpecularLevel;
|
||||
|
@ -95,7 +93,6 @@ public:
|
|||
void Apply();
|
||||
void ApplyBuffers();
|
||||
void ApplyBlendMode();
|
||||
void CheckTimer(uint64_t ShaderStartTime);
|
||||
|
||||
void ResetVertexBuffer()
|
||||
{
|
||||
|
|
|
@ -156,3 +156,12 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FRenderState::CheckTimer(uint64_t ShaderStartTime)
|
||||
{
|
||||
// if firstFrame is not yet initialized, initialize it to current time
|
||||
// if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision
|
||||
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1 << 24) || ShaderStartTime >= firstFrame)
|
||||
firstFrame = screen->FrameTime;
|
||||
}
|
||||
|
|
|
@ -172,6 +172,8 @@ protected:
|
|||
|
||||
EPassType mPassType = NORMAL_PASS;
|
||||
|
||||
uint64_t firstFrame = 0;
|
||||
|
||||
public:
|
||||
VSMatrix mModelMatrix;
|
||||
VSMatrix mTextureMatrix;
|
||||
|
@ -531,6 +533,8 @@ public:
|
|||
return mPassType;
|
||||
}
|
||||
|
||||
void CheckTimer(uint64_t ShaderStartTime);
|
||||
|
||||
// API-dependent render interface
|
||||
|
||||
// Draw commands
|
||||
|
|
|
@ -324,7 +324,7 @@ void VkRenderState::ApplyStreamData()
|
|||
mStreamData.uVertexColor = mColor.vec;
|
||||
mStreamData.uVertexNormal = mNormal.vec;
|
||||
|
||||
mStreamData.timer = 0.0f; // static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.);
|
||||
mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.);
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ void VkRenderState::ApplyPushConstants()
|
|||
}
|
||||
|
||||
int tempTM = TM_NORMAL;
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->tex->isHardwareCanvas())
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->tex && mMaterial.mMaterial->tex->isHardwareCanvas())
|
||||
tempTM = TM_OPAQUE;
|
||||
|
||||
mPushConstants.uFogEnabled = fogset;
|
||||
|
@ -409,8 +409,8 @@ void VkRenderState::ApplyPushConstants()
|
|||
mPushConstants.uAlphaThreshold = mAlphaThreshold;
|
||||
mPushConstants.uClipSplit = { mClipSplit[0], mClipSplit[1] };
|
||||
|
||||
//if (mMaterial.mMaterial)
|
||||
// mPushConstants.uSpecularMaterial = { mMaterial.mMaterial->tex->Glossiness, mMaterial.mMaterial->tex->SpecularLevel };
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->tex)
|
||||
mPushConstants.uSpecularMaterial = { mMaterial.mMaterial->tex->Glossiness, mMaterial.mMaterial->tex->SpecularLevel };
|
||||
|
||||
mPushConstants.uLightIndex = screen->mLights->BindUBO(mLightIndex);
|
||||
mPushConstants.uDataIndex = mDataIndex;
|
||||
|
@ -502,6 +502,9 @@ void VkRenderState::ApplyMaterial()
|
|||
mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->PipelineLayout.get(), 1, base->GetDescriptorSet(mMaterial));
|
||||
}
|
||||
|
||||
if (mMaterial.mMaterial && mMaterial.mMaterial->tex)
|
||||
mShaderTimer = mMaterial.mMaterial->tex->shaderspeed;
|
||||
|
||||
mMaterial.mChanged = false;
|
||||
}
|
||||
}
|
||||
|
@ -537,6 +540,11 @@ void VkRenderState::Bind(int bindingpoint, uint32_t offset)
|
|||
}
|
||||
}
|
||||
|
||||
void VkRenderState::BeginFrame()
|
||||
{
|
||||
mMaterial.Reset();
|
||||
}
|
||||
|
||||
void VkRenderState::EndRenderPass()
|
||||
{
|
||||
if (mCommandBuffer)
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
void EnableLineSmooth(bool on) override;
|
||||
void EnableDrawBuffers(int count) override;
|
||||
|
||||
void BeginFrame();
|
||||
void SetRenderTarget(VulkanImageView *view, int width, int height, VkSampleCountFlagBits samples);
|
||||
void Bind(int bindingpoint, uint32_t offset);
|
||||
void EndRenderPass();
|
||||
|
@ -86,6 +87,8 @@ protected:
|
|||
int mColorMask = 15;
|
||||
int mCullMode = 0;
|
||||
|
||||
float mShaderTimer = 0.0f;
|
||||
|
||||
MatricesUBO mMatrices = {};
|
||||
StreamData mStreamData = {};
|
||||
PushConstants mPushConstants = {};
|
||||
|
|
|
@ -366,9 +366,7 @@ sector_t *VulkanFrameBuffer::RenderView(player_t *player)
|
|||
NoInterpolateView = false;
|
||||
|
||||
// Shader start time does not need to be handled per level. Just use the one from the camera to render from.
|
||||
#if 0
|
||||
GetRenderState()->CheckTimer(player->camera->Level->ShaderStartTime);
|
||||
#endif
|
||||
// prepare all camera textures that have been used in the last frame.
|
||||
// This must be done for all levels, not just the primary one!
|
||||
for (auto Level : AllLevels())
|
||||
|
@ -763,6 +761,7 @@ void VulkanFrameBuffer::BeginFrame()
|
|||
mScreenBuffers->BeginFrame(screen->mScreenViewport.width, screen->mScreenViewport.height, screen->mSceneViewport.width, screen->mSceneViewport.height);
|
||||
mSaveBuffers->BeginFrame(SAVEPICWIDTH, SAVEPICHEIGHT, SAVEPICWIDTH, SAVEPICHEIGHT);
|
||||
mPostprocess->BeginFrame();
|
||||
mRenderState->BeginFrame();
|
||||
mRenderPassManager->UpdateDynamicSet();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue