Skip to content
Snippets Groups Projects
Commit e1a19e9d authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#66] Remove unnecessary width/height from mesh drawcall

parent 020bdcdd
No related branches found
No related tags found
1 merge request!54Resolve "Cmd/Sync-Rework"
......@@ -230,8 +230,6 @@ namespace vkcv
void renderMesh(
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const uint32_t width,
const uint32_t height,
const size_t pushConstantSize,
const void* pushConstantData,
const std::vector<VertexBufferBinding> &vertexBufferBindings,
......
......@@ -162,8 +162,6 @@ int main(int argc, const char** argv) {
core.renderMesh(
trianglePass,
trianglePipeline,
windowWidth,
windowHeight,
sizeof(mvp),
&mvp,
vertexBufferBindings,
......
......@@ -176,8 +176,6 @@ namespace vkcv
void Core::renderMesh(
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const uint32_t width,
const uint32_t height,
const size_t pushConstantSize,
const void *pushConstantData,
const std::vector<VertexBufferBinding>& vertexBufferBindings,
......@@ -191,6 +189,25 @@ namespace vkcv
return;
}
uint32_t width;
uint32_t height;
if (renderTargets.size() > 0) {
const vkcv::ImageHandle firstImage = renderTargets[0];
if (firstImage.isSwapchainImage()) {
width = m_window.getWidth();
height = m_window.getHeight();
}
else {
width = m_ImageManager->getImageWidth(firstImage);
height = m_ImageManager->getImageHeight(firstImage);
}
}
else {
width = 1;
height = 1;
}
// TODO: validate that width/height match for all attachments
const vk::RenderPass renderpass = m_PassManager->getVkPass(renderpassHandle);
const PassConfig passConfig = m_PassManager->getPassConfig(renderpassHandle);
......
......@@ -178,6 +178,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanImage invalid handle" << std::endl;
return nullptr;
}
......@@ -190,6 +191,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanDeviceMemory invalid handle" << std::endl;
return nullptr;
}
......@@ -202,6 +204,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanImageView invalid handle" << std::endl;
return nullptr;
}
......@@ -214,6 +217,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::switchImageLayout invalid handle" << std::endl;
return;
}
......@@ -295,6 +299,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::fillImage invalid handle" << std::endl;
return;
}
......@@ -371,6 +376,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageWidth invalid handle" << std::endl;
return 0;
}
......@@ -383,6 +389,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageHeight invalid handle" << std::endl;
return 0;
}
......@@ -395,6 +402,7 @@ namespace vkcv {
const uint64_t id = handle.getId();
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageDepth invalid handle" << std::endl;
return 0;
}
......@@ -406,6 +414,7 @@ namespace vkcv {
void ImageManager::destroyImageById(uint64_t id)
{
if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::destroyImageById invalid handle" << std::endl;
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment