Remove implicit cast operators on ResultValue<T>

As it turned out to not provide a complete solution to the C++-API-change issue on logical-change of the C-API, we simply remove those implicit cast operators. That is, accessing the result and the value need to be explicit.
This commit is contained in:
asuessenbach
2020-07-20 13:48:03 +02:00
committed by Markus Tavenrath
parent 4cdc51ba0f
commit fba2516d9c
9 changed files with 206 additions and 134 deletions

View File

@@ -161,7 +161,16 @@ int main( int /*argc*/, char ** /*argv*/ )
renderPass.get() // renderPass
);
vk::UniquePipeline pipeline = device->createGraphicsPipelineUnique( nullptr, graphicsPipelineCreateInfo );
vk::ResultValue<vk::UniquePipeline> pipeline =
device->createGraphicsPipelineUnique( nullptr, graphicsPipelineCreateInfo );
switch ( pipeline.result )
{
case vk::Result::eSuccess: break;
case vk::Result::ePipelineCompileRequiredEXT:
// something meaningfull here
break;
default: assert( false ); // should never happen
}
/* VULKAN_KEY_END */
}

View File

@@ -204,8 +204,17 @@ int main( int /*argc*/, char ** /*argv*/ )
pipelineLayout.get(),
renderPass.get() );
vk::UniquePipeline basePipeline =
vk::UniquePipeline basePipeline;
vk::ResultValue<vk::UniquePipeline> rvPipeline =
device->createGraphicsPipelineUnique( pipelineCache.get(), graphicsPipelineCreateInfo );
switch ( rvPipeline.result )
{
case vk::Result::eSuccess: basePipeline = std::move( rvPipeline.value ); break;
case vk::Result::ePipelineCompileRequiredEXT:
// something meaningfull here
break;
default: assert( false ); // should never happen
}
// Now create the derivative pipeline, using a different fragment shader
// This shader will shade the cube faces with interpolated colors
@@ -236,8 +245,16 @@ void main()
graphicsPipelineCreateInfo.basePipelineIndex = -1;
// And create the derived pipeline
vk::UniquePipeline derivedPipeline =
device->createGraphicsPipelineUnique( pipelineCache.get(), graphicsPipelineCreateInfo );
vk::UniquePipeline derivedPipeline;
rvPipeline = device->createGraphicsPipelineUnique( *pipelineCache, graphicsPipelineCreateInfo );
switch ( rvPipeline.result )
{
case vk::Result::eSuccess: derivedPipeline = std::move( rvPipeline.value ); break;
case vk::Result::ePipelineCompileRequiredEXT:
// something meaningfull here
break;
default: assert( false ); // should never happen
}
/* VULKAN_KEY_END */

View File

@@ -1097,8 +1097,17 @@ int main( int /*argc*/, char ** /*argv*/ )
uint32_t maxRecursionDepth = 2;
vk::RayTracingPipelineCreateInfoNV rayTracingPipelineCreateInfo(
{}, shaderStages, shaderGroups, maxRecursionDepth, *rayTracingPipelineLayout );
vk::UniquePipeline rayTracingPipeline =
vk::UniquePipeline rayTracingPipeline;
vk::ResultValue<vk::UniquePipeline> rvPipeline =
device->createRayTracingPipelineNVUnique( nullptr, rayTracingPipelineCreateInfo );
switch ( rvPipeline.result )
{
case vk::Result::eSuccess: rayTracingPipeline = std::move( rvPipeline.value ); break;
case vk::Result::ePipelineCompileRequiredEXT:
// something meaningfull here
break;
default: assert( false ); // should never happen
}
uint32_t shaderGroupHandleSize =
physicalDevice.getProperties2<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceRayTracingPropertiesNV>()