2019-02-21 21:49:00 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vulkan/system/vk_buffers.h"
|
|
|
|
#include "vulkan/shaders/vk_shader.h"
|
|
|
|
|
|
|
|
#include "name.h"
|
|
|
|
|
|
|
|
#include "hwrenderer/scene/hw_drawstructs.h"
|
|
|
|
#include "hwrenderer/scene/hw_renderstate.h"
|
|
|
|
#include "hwrenderer/textures/hw_material.h"
|
|
|
|
|
2019-02-28 23:42:51 +00:00
|
|
|
class VkRenderPassSetup;
|
|
|
|
|
2019-02-21 21:49:00 +00:00
|
|
|
class VkRenderState : public FRenderState
|
|
|
|
{
|
|
|
|
public:
|
2019-02-26 10:27:29 +00:00
|
|
|
VkRenderState();
|
|
|
|
|
2019-02-21 21:49:00 +00:00
|
|
|
// Draw commands
|
|
|
|
void ClearScreen() override;
|
|
|
|
void Draw(int dt, int index, int count, bool apply = true) override;
|
|
|
|
void DrawIndexed(int dt, int index, int count, bool apply = true) override;
|
|
|
|
|
|
|
|
// Immediate render state change commands. These only change infrequently and should not clutter the render state.
|
|
|
|
bool SetDepthClamp(bool on) override;
|
|
|
|
void SetDepthMask(bool on) override;
|
|
|
|
void SetDepthFunc(int func) override;
|
|
|
|
void SetDepthRange(float min, float max) override;
|
|
|
|
void SetColorMask(bool r, bool g, bool b, bool a) override;
|
|
|
|
void EnableDrawBufferAttachments(bool on) override;
|
|
|
|
void SetStencil(int offs, int op, int flags = -1) override;
|
|
|
|
void SetCulling(int mode) override;
|
|
|
|
void EnableClipDistance(int num, bool state) override;
|
|
|
|
void Clear(int targets) override;
|
|
|
|
void EnableStencil(bool on) override;
|
|
|
|
void SetScissor(int x, int y, int w, int h) override;
|
|
|
|
void SetViewport(int x, int y, int w, int h) override;
|
|
|
|
void EnableDepthTest(bool on) override;
|
|
|
|
void EnableMultisampling(bool on) override;
|
|
|
|
void EnableLineSmooth(bool on) override;
|
|
|
|
|
2019-02-26 10:27:29 +00:00
|
|
|
void Bind(int bindingpoint, uint32_t offset);
|
|
|
|
void EndRenderPass();
|
|
|
|
|
2019-02-21 21:49:00 +00:00
|
|
|
private:
|
|
|
|
void Apply(int dt);
|
2019-03-02 22:39:44 +00:00
|
|
|
void ApplyRenderPass(int dt);
|
|
|
|
void ApplyScissor();
|
|
|
|
void ApplyViewport();
|
|
|
|
void ApplyStreamData();
|
|
|
|
void ApplyMatrices();
|
|
|
|
void ApplyPushConstants();
|
|
|
|
void ApplyDynamicSet();
|
|
|
|
void ApplyVertexBuffers();
|
|
|
|
void ApplyMaterial();
|
2019-02-21 21:49:00 +00:00
|
|
|
|
|
|
|
bool mLastDepthClamp = true;
|
|
|
|
VulkanCommandBuffer *mCommandBuffer = nullptr;
|
2019-02-28 23:42:51 +00:00
|
|
|
VkRenderPassSetup *mRenderPassSetup = nullptr;
|
2019-03-02 22:39:44 +00:00
|
|
|
bool mDynamicSetChanged = true;
|
2019-02-26 10:27:29 +00:00
|
|
|
|
2019-02-28 14:45:59 +00:00
|
|
|
int mScissorX = 0, mScissorY = 0, mScissorWidth = -1, mScissorHeight = -1;
|
|
|
|
int mViewportX = 0, mViewportY = 0, mViewportWidth = -1, mViewportHeight = -1;
|
|
|
|
float mViewportDepthMin = 0.0f, mViewportDepthMax = 1.0f;
|
|
|
|
bool mScissorChanged = true;
|
|
|
|
bool mViewportChanged = true;
|
|
|
|
|
2019-03-01 20:34:08 +00:00
|
|
|
bool mDepthTest = false;
|
|
|
|
bool mDepthWrite = false;
|
|
|
|
|
2019-02-26 19:19:54 +00:00
|
|
|
MatricesUBO mMatrices = {};
|
2019-03-02 22:20:29 +00:00
|
|
|
StreamData mStreamData = {};
|
2019-02-26 19:19:54 +00:00
|
|
|
PushConstants mPushConstants = {};
|
|
|
|
|
2019-03-02 22:39:44 +00:00
|
|
|
uint32_t mLastViewpointOffset = 0xffffffff;
|
|
|
|
uint32_t mLastLightBufferOffset = 0xffffffff;
|
2019-02-26 15:50:54 +00:00
|
|
|
uint32_t mViewpointOffset = 0;
|
|
|
|
uint32_t mLightBufferOffset = 0;
|
|
|
|
uint32_t mMatricesOffset = 0;
|
2019-03-02 22:20:29 +00:00
|
|
|
uint32_t mDataIndex = -1;
|
|
|
|
uint32_t mStreamDataOffset = 0;
|
2019-03-02 22:47:56 +00:00
|
|
|
|
|
|
|
VSMatrix mIdentityMatrix;
|
2019-03-02 22:56:06 +00:00
|
|
|
|
|
|
|
IVertexBuffer *mLastVertexBuffer = nullptr;
|
|
|
|
IIndexBuffer *mLastIndexBuffer = nullptr;
|
2019-03-02 23:06:17 +00:00
|
|
|
|
|
|
|
bool mLastGlowEnabled = true;
|
|
|
|
bool mLastGradientEnabled = true;
|
|
|
|
bool mLastSplitEnabled = true;
|
|
|
|
bool mLastModelMatrixEnabled = true;
|
|
|
|
bool mLastTextureMatrixEnabled = true;
|
2019-02-21 21:49:00 +00:00
|
|
|
};
|