supply TimeVector to shaders

This commit is contained in:
Adam Jensen 2024-07-07 02:26:30 +01:00
parent 021985a75f
commit aeb1dee4c8
4 changed files with 16 additions and 4 deletions

View File

@ -30,6 +30,8 @@ public:
LinearAllocator linear4; // 4
LinearAllocator *linear30; // 30
LinearAllocator *linear34; // 34
float m_frameTimeDelta; // 44
uint32_t m_currentTime; // 48
uint32_t m_sceneCreationCount; // 54
uint32_t m_frameIndex; // 58
public:
@ -52,7 +54,7 @@ public:
virtual ~CommonRenderDevice() = default;
virtual void refCountDec() = 0;
virtual void method_08() = 0;
virtual void resetRenderLists() = 0;
virtual void resetRenderLists(float timeDelta) = 0;
virtual void drawRenderLists() = 0; // 10
virtual void method_14();
virtual void method_18();

View File

@ -292,13 +292,16 @@ void PCDX11RenderDevice::method_08() {
// TODO
}
void PCDX11RenderDevice::resetRenderLists() {
void PCDX11RenderDevice::resetRenderLists(float timeDelta) {
// TODO
m_frameIndex++;
renderList_current = nullptr;
renderList_last = nullptr;
renderList_first = nullptr;
// TODO
m_frameTimeDelta = timeDelta;
m_currentTime += 1000 * timeDelta;
// TODO
}
void PCDX11RenderDevice::drawRenderLists() {
@ -859,6 +862,13 @@ void PCDX11RenderDevice::drawRenderListsInternal(void *arg) {
auto stateManager = deviceManager->getStateManager();
stateManager->reset();
stateManager->setCommonConstantBuffers();
float timeVector[4] = {
(m_currentTime % 1000000) * 0.001f,
m_frameTimeDelta,
0.f,
0.f
};
stateManager->accessCommonCB(1).assignRow(24, timeVector, 1); // SceneBuffer::TimeVector
static_cast<PCDX11LightManager*>(lightManager)->setAttenuationSampler();
while (renderList_processing) {

View File

@ -117,7 +117,7 @@ public:
// incomplete
void refCountDec() override;
void method_08() override;
void resetRenderLists() override;
void resetRenderLists(float timeDelta) override;
void drawRenderLists() override;
bool beginRenderList(float*) override;
bool endRenderList() override;

View File

@ -897,7 +897,7 @@ int spinnyCube(HWND window,
tempRenderTarget = static_cast<cdc::PCDX11RenderTarget*>(renderDevice->dx11_createRenderTarget(
100, 100, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, 0x18, cdc::kTextureClass2D));
renderDevice->resetRenderLists();
renderDevice->resetRenderLists(1.f/60);
renderDevice->beginRenderList(nullptr);
auto *scene = renderDevice->createSubScene( // CommonScene::CommonScene creates the projectMatrix
&renderViewport,