Adding basic memory resource
This commit is contained in:
@@ -200,8 +200,7 @@ void BasePass::render() {
|
||||
.attachmentCount = 1,
|
||||
},
|
||||
};
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
command->bindPipeline(graphics->createGraphicsPipeline(std::move(pipelineInfo)));
|
||||
} else {
|
||||
Gfx::LegacyPipelineCreateInfo pipelineInfo = {
|
||||
.vertexShader = collection->vertexShader,
|
||||
@@ -221,8 +220,7 @@ void BasePass::render() {
|
||||
.attachmentCount = 1,
|
||||
},
|
||||
};
|
||||
Gfx::PGraphicsPipeline pipeline = graphics->createGraphicsPipeline(std::move(pipelineInfo));
|
||||
command->bindPipeline(pipeline);
|
||||
command->bindPipeline(graphics->createGraphicsPipeline(std::move(pipelineInfo)));
|
||||
}
|
||||
command->bindDescriptor({viewParamsSet, vertexData->getVertexDataSet(), vertexData->getInstanceDataSet(),
|
||||
scene->getLightEnvironment()->getDescriptorSet(), Material::getDescriptorSet(), opaqueCulling});
|
||||
@@ -231,7 +229,7 @@ void BasePass::render() {
|
||||
Gfx::SE_SHADER_STAGE_FRAGMENT_BIT,
|
||||
0, sizeof(VertexData::DrawCallOffsets), &drawCall.offsets);
|
||||
if (graphics->supportMeshShading()) {
|
||||
command->drawMesh(drawCall.instanceMeshData.size(), 1, 1);
|
||||
command->drawMesh((uint32)drawCall.instanceMeshData.size(), 1, 1);
|
||||
} else {
|
||||
command->bindIndexBuffer(vertexData->getIndexBuffer());
|
||||
for (const auto& meshData : drawCall.instanceMeshData) {
|
||||
@@ -252,7 +250,7 @@ void BasePass::render() {
|
||||
{
|
||||
Gfx::ORenderCommand skyboxCommand = graphics->createRenderCommand("SkyboxRender");
|
||||
skyboxCommand->setViewport(viewport);
|
||||
skyboxCommand->bindPipeline(pipeline);
|
||||
skyboxCommand->bindPipeline(skyboxPipeline);
|
||||
skyboxCommand->bindDescriptor({viewParamsSet, skyboxDataSet, textureSet});
|
||||
skyboxCommand->draw(36, 1, 0, 0);
|
||||
graphics->executeCommands(std::move(skyboxCommand));
|
||||
@@ -623,6 +621,6 @@ void BasePass::createRenderPass() {
|
||||
.attachmentCount = 1,
|
||||
},
|
||||
};
|
||||
pipeline = graphics->createGraphicsPipeline(std::move(gfxInfo));
|
||||
skyboxPipeline = graphics->createGraphicsPipeline(std::move(gfxInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "MinimalEngine.h"
|
||||
#include "RenderPass.h"
|
||||
#include "WaterRenderer.h"
|
||||
#include "TerrainRenderer.h"
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_REF(CameraActor)
|
||||
@@ -56,7 +55,7 @@ class BasePass : public RenderPass {
|
||||
Gfx::PShaderBuffer cullingBuffer;
|
||||
|
||||
//OWaterRenderer waterRenderer;
|
||||
OTerrainRenderer terrainRenderer;
|
||||
//OTerrainRenderer terrainRenderer;
|
||||
|
||||
// Debug rendering
|
||||
Gfx::OVertexInput debugVertexInput;
|
||||
@@ -74,7 +73,7 @@ class BasePass : public RenderPass {
|
||||
Gfx::OVertexShader vertexShader;
|
||||
Gfx::OFragmentShader fragmentShader;
|
||||
Gfx::OPipelineLayout pipelineLayout;
|
||||
Gfx::PGraphicsPipeline pipeline;
|
||||
Gfx::PGraphicsPipeline skyboxPipeline;
|
||||
Gfx::OSampler skyboxSampler;
|
||||
struct SkyboxData {
|
||||
Matrix4 transformMatrix;
|
||||
|
||||
@@ -15,8 +15,8 @@ target_sources(Engine
|
||||
RenderGraphResources.cpp
|
||||
RenderPass.h
|
||||
RenderPass.cpp
|
||||
TerrainRenderer.h
|
||||
TerrainRenderer.cpp
|
||||
#TerrainRenderer.h
|
||||
#TerrainRenderer.cpp
|
||||
ToneMappingPass.h
|
||||
ToneMappingPass.cpp
|
||||
UIPass.h
|
||||
@@ -38,6 +38,6 @@ target_sources(Engine
|
||||
RenderGraph.h
|
||||
RenderGraphResources.h
|
||||
RenderPass.h
|
||||
TerrainRenderer.h
|
||||
#TerrainRenderer.h
|
||||
UIPass.h
|
||||
VisibilityPass.h)
|
||||
@@ -111,7 +111,7 @@ void CachedDepthPass::render() {
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets),
|
||||
&offsets);
|
||||
if (graphics->supportMeshShading()) {
|
||||
command->drawMesh(vertexData->getNumInstances(), 1, 1);
|
||||
command->drawMesh((uint32)vertexData->getNumInstances(), 1, 1);
|
||||
} else {
|
||||
const auto& materials = vertexData->getMaterialData();
|
||||
for (const auto& materialData : materials) {
|
||||
|
||||
@@ -185,7 +185,7 @@ void DepthCullingPass::render() {
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets),
|
||||
&offsets);
|
||||
if (graphics->supportMeshShading()) {
|
||||
command->drawMesh(vertexData->getNumInstances(), 1, 1);
|
||||
command->drawMesh((uint32)vertexData->getNumInstances(), 1, 1);
|
||||
} else {
|
||||
const auto& materials = vertexData->getMaterialData();
|
||||
for (const auto& materialData : materials) {
|
||||
|
||||
@@ -278,7 +278,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);
|
||||
|
||||
Gfx::PDescriptorSet dispatchParamsSet = dispatchParamsLayout->allocateDescriptorSet();
|
||||
dispatchParamsSet = dispatchParamsLayout->allocateDescriptorSet();
|
||||
dispatchParamsSet->updateConstants("numThreadGroups", 0, &numThreadGroups);
|
||||
dispatchParamsSet->updateConstants("numThreads", 0, &numThreads);
|
||||
dispatchParamsSet->updateBuffer(FRUSTUMBUFFER_NAME, 0, frustumBuffer);
|
||||
@@ -292,8 +292,5 @@ void LightCullingPass::setupFrustums() {
|
||||
commands.add(std::move(command));
|
||||
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);
|
||||
Frustum* frustums = (Frustum*)frustumBuffer->map();
|
||||
graphics->waitDeviceIdle();
|
||||
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
plainMesh.gpuCBT.bufferCount = 2;
|
||||
for (uint32 i = 0; i < 2; ++i) {
|
||||
uint32 bufferSize = cbt.bufferSize(i);
|
||||
uint32 elementSize = cbt.elementSize(i);
|
||||
//uint32 elementSize = cbt.elementSize(i);
|
||||
plainMesh.gpuCBT.bufferArray[i] = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.sourceData =
|
||||
{
|
||||
@@ -189,7 +189,7 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
baseMesh.vertexBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT | Gfx::SE_ACCESS_SHADER_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
uint32 indexBufferSize = cpuMesh.totalNumElements * sizeof(UVector);
|
||||
//uint32 indexBufferSize = cpuMesh.totalNumElements * sizeof(UVector);
|
||||
Array<uint32> indices;
|
||||
for (uint32 i = 0; i < cpuMesh.totalNumElements * 3; ++i)
|
||||
indices.add(i);
|
||||
|
||||
@@ -62,9 +62,9 @@ void UIPass::beginFrame(const Component::Camera& cam) {
|
||||
float x = render.position.x;
|
||||
float y = render.position.y;
|
||||
//todo: convert using actual tree depth
|
||||
uint32 textureIndex = -1ul;
|
||||
uint32 textureIndex = std::numeric_limits<uint32>::max();
|
||||
if (render.backgroundTexture != nullptr) {
|
||||
textureIndex = usedTextures.size();
|
||||
textureIndex = (uint32)usedTextures.size();
|
||||
usedTextures.add(render.backgroundTexture);
|
||||
}
|
||||
elements.add(RenderElementStyle{
|
||||
@@ -112,7 +112,7 @@ void UIPass::render() {
|
||||
command->setViewport(viewport);
|
||||
command->bindPipeline(uiPipeline);
|
||||
command->bindDescriptor({viewParamsSet, uiDescriptorSet});
|
||||
command->draw(4, elements.size(), 0, 0);
|
||||
command->draw(4, (uint32)elements.size(), 0, 0);
|
||||
commands.add(std::move(command));
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
|
||||
@@ -42,7 +42,7 @@ class UIPass : public RenderPass {
|
||||
Vector color;
|
||||
float opacity = 1;
|
||||
float z = 0;
|
||||
uint32 textureIndex = -1ul;
|
||||
uint32 textureIndex = std::numeric_limits<uint32>::max();
|
||||
uint32 pad0;
|
||||
uint32 pad1;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user