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"
This commit is part of merge request !54. Comments created here will be created in the context of that merge request.
...@@ -230,8 +230,6 @@ namespace vkcv ...@@ -230,8 +230,6 @@ namespace vkcv
void renderMesh( void renderMesh(
const PassHandle renderpassHandle, const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle, const PipelineHandle pipelineHandle,
const uint32_t width,
const uint32_t height,
const size_t pushConstantSize, const size_t pushConstantSize,
const void* pushConstantData, const void* pushConstantData,
const std::vector<VertexBufferBinding> &vertexBufferBindings, const std::vector<VertexBufferBinding> &vertexBufferBindings,
......
...@@ -162,8 +162,6 @@ int main(int argc, const char** argv) { ...@@ -162,8 +162,6 @@ int main(int argc, const char** argv) {
core.renderMesh( core.renderMesh(
trianglePass, trianglePass,
trianglePipeline, trianglePipeline,
windowWidth,
windowHeight,
sizeof(mvp), sizeof(mvp),
&mvp, &mvp,
vertexBufferBindings, vertexBufferBindings,
......
...@@ -176,8 +176,6 @@ namespace vkcv ...@@ -176,8 +176,6 @@ namespace vkcv
void Core::renderMesh( void Core::renderMesh(
const PassHandle renderpassHandle, const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle, const PipelineHandle pipelineHandle,
const uint32_t width,
const uint32_t height,
const size_t pushConstantSize, const size_t pushConstantSize,
const void *pushConstantData, const void *pushConstantData,
const std::vector<VertexBufferBinding>& vertexBufferBindings, const std::vector<VertexBufferBinding>& vertexBufferBindings,
...@@ -191,6 +189,25 @@ namespace vkcv ...@@ -191,6 +189,25 @@ namespace vkcv
return; 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 vk::RenderPass renderpass = m_PassManager->getVkPass(renderpassHandle);
const PassConfig passConfig = m_PassManager->getPassConfig(renderpassHandle); const PassConfig passConfig = m_PassManager->getPassConfig(renderpassHandle);
......
...@@ -178,6 +178,7 @@ namespace vkcv { ...@@ -178,6 +178,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanImage invalid handle" << std::endl;
return nullptr; return nullptr;
} }
...@@ -190,6 +191,7 @@ namespace vkcv { ...@@ -190,6 +191,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanDeviceMemory invalid handle" << std::endl;
return nullptr; return nullptr;
} }
...@@ -202,6 +204,7 @@ namespace vkcv { ...@@ -202,6 +204,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getVulkanImageView invalid handle" << std::endl;
return nullptr; return nullptr;
} }
...@@ -214,6 +217,7 @@ namespace vkcv { ...@@ -214,6 +217,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::switchImageLayout invalid handle" << std::endl;
return; return;
} }
...@@ -295,6 +299,7 @@ namespace vkcv { ...@@ -295,6 +299,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::fillImage invalid handle" << std::endl;
return; return;
} }
...@@ -371,6 +376,7 @@ namespace vkcv { ...@@ -371,6 +376,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageWidth invalid handle" << std::endl;
return 0; return 0;
} }
...@@ -383,6 +389,7 @@ namespace vkcv { ...@@ -383,6 +389,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageHeight invalid handle" << std::endl;
return 0; return 0;
} }
...@@ -395,6 +402,7 @@ namespace vkcv { ...@@ -395,6 +402,7 @@ namespace vkcv {
const uint64_t id = handle.getId(); const uint64_t id = handle.getId();
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::getImageDepth invalid handle" << std::endl;
return 0; return 0;
} }
...@@ -406,6 +414,7 @@ namespace vkcv { ...@@ -406,6 +414,7 @@ namespace vkcv {
void ImageManager::destroyImageById(uint64_t id) void ImageManager::destroyImageById(uint64_t id)
{ {
if (id >= m_images.size()) { if (id >= m_images.size()) {
std::cerr << "Error: ImageManager::destroyImageById invalid handle" << std::endl;
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment