system still crashes
This commit is contained in:
@@ -134,6 +134,7 @@ void CachedDepthPass::render() {
|
||||
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
graphics->waitDeviceIdle();
|
||||
timestamps->write(Gfx::SE_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, "CachedEnd");
|
||||
query->endQuery();
|
||||
}
|
||||
|
||||
@@ -270,7 +270,6 @@ void LightCullingPass::setupFrustums() {
|
||||
frustumShader = graphics->createComputeShader({0});
|
||||
// Have to compile shader before finalizing layout as parameters get mapped later
|
||||
frustumLayout->create();
|
||||
dispatchParamsLayout->create();
|
||||
|
||||
Gfx::ComputePipelineCreateInfo pipelineInfo;
|
||||
pipelineInfo.computeShader = frustumShader;
|
||||
@@ -301,6 +300,7 @@ void LightCullingPass::setupFrustums() {
|
||||
frustumBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_SHADER_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
|
||||
graphics->waitDeviceIdle();
|
||||
Gfx::PDescriptorSet dispatchParamsSet = dispatchParamsLayout->allocateDescriptorSet();
|
||||
dispatchParamsSet->updateBuffer(0, 0, frustumDispatchParamsBuffer);
|
||||
dispatchParamsSet->updateBuffer(1, 0, frustumBuffer);
|
||||
@@ -315,4 +315,7 @@ void LightCullingPass::setupFrustums() {
|
||||
graphics->executeCommands(std::move(commands));
|
||||
frustumBuffer->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
graphics->waitDeviceIdle();
|
||||
Frustum* frustums = (Frustum*)frustumBuffer->map();
|
||||
std::cout << frustums << std::endl;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ RenderPass::RenderPass(Gfx::PGraphics graphics) : graphics(graphics) {
|
||||
viewParamsLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.binding = 0,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
.uniformLength = 576,//sizeof(ViewParameter),
|
||||
.uniformLength = sizeof(ViewParameter),
|
||||
});
|
||||
UniformBufferCreateInfo uniformInitializer = {
|
||||
.sourceData =
|
||||
@@ -28,28 +28,6 @@ void RenderPass::beginFrame(const Component::Camera& cam) {
|
||||
Matrix4 cameraMatrix = cam.getViewMatrix();
|
||||
Matrix4 projectionMatrix = viewport->getProjectionMatrix();
|
||||
viewParams = {
|
||||
.viewFrustum =
|
||||
{
|
||||
.planes =
|
||||
{
|
||||
Plane{
|
||||
.n = Vector(-0.62628, 0, 0.7796),
|
||||
.d = 3.898,
|
||||
},
|
||||
Plane{
|
||||
.n = Vector(0.62628, 0, 0.7796),
|
||||
.d = 3.898,
|
||||
},
|
||||
Plane{
|
||||
.n = Vector(0, 0.81915, 0.57358),
|
||||
.d = 2.86788,
|
||||
},
|
||||
Plane{
|
||||
.n = Vector(0, -0.81915, 0.57358),
|
||||
.d = 2.86788,
|
||||
},
|
||||
},
|
||||
},
|
||||
.viewMatrix = cameraMatrix,
|
||||
.inverseViewMatrix = glm::inverse(cameraMatrix),
|
||||
.projectionMatrix = projectionMatrix,
|
||||
@@ -82,7 +60,7 @@ void RenderPass::beginFrame(const Component::Camera& cam) {
|
||||
corners[i] = world / world.w;
|
||||
}
|
||||
|
||||
extract_planes_from_view_projection_matrix(viewParams.viewProjectionMatrix, viewParams.viewFrustum);
|
||||
//extract_planes_from_view_projection_matrix(viewParams.viewProjectionMatrix, viewParams.viewFrustum);
|
||||
|
||||
viewParamsBuffer->rotateBuffer(sizeof(ViewParameter));
|
||||
viewParamsBuffer->updateContents(0, sizeof(ViewParameter), &viewParams);
|
||||
|
||||
@@ -50,7 +50,6 @@ class RenderPass {
|
||||
void extract_planes_from_view_projection_matrix(const Matrix4 viewProj, Frustum& frustum);
|
||||
|
||||
struct ViewParameter {
|
||||
Frustum viewFrustum;
|
||||
Matrix4 viewMatrix;
|
||||
Matrix4 inverseViewMatrix;
|
||||
Matrix4 projectionMatrix;
|
||||
@@ -63,6 +62,8 @@ class RenderPass {
|
||||
Vector2 invScreenDimensions;
|
||||
uint32 frameIndex;
|
||||
float time;
|
||||
uint32 pad0;
|
||||
uint32 pad1;
|
||||
} viewParams;
|
||||
PRenderGraphResources resources;
|
||||
Gfx::ODescriptorLayout viewParamsLayout;
|
||||
|
||||
Reference in New Issue
Block a user