Validate renderer blit descriptors first
This commit is contained in:
@@ -624,6 +624,11 @@ pp::foundation::Result<std::uint64_t> readback_byte_size(TextureDesc desc, Readb
|
||||
|
||||
pp::foundation::Result<std::uint64_t> frame_capture_byte_size(TextureDesc desc) noexcept
|
||||
{
|
||||
const auto desc_status = validate_texture_desc(desc);
|
||||
if (!desc_status.ok()) {
|
||||
return pp::foundation::Result<std::uint64_t>::failure(desc_status);
|
||||
}
|
||||
|
||||
if (!has_texture_usage(desc.usage, TextureUsage::render_target)) {
|
||||
return pp::foundation::Result<std::uint64_t>::failure(
|
||||
pp::foundation::Status::invalid_argument("frame capture source must be a render target"));
|
||||
@@ -778,6 +783,16 @@ pp::foundation::Status validate_blit_filter(BlitFilter filter) noexcept
|
||||
|
||||
pp::foundation::Status validate_blit_descs(TextureDesc source, TextureDesc destination) noexcept
|
||||
{
|
||||
const auto source_status = validate_texture_desc(source);
|
||||
if (!source_status.ok()) {
|
||||
return source_status;
|
||||
}
|
||||
|
||||
const auto destination_status = validate_texture_desc(destination);
|
||||
if (!destination_status.ok()) {
|
||||
return destination_status;
|
||||
}
|
||||
|
||||
if (!has_texture_usage(source.usage, TextureUsage::render_target)
|
||||
|| !has_texture_usage(destination.usage, TextureUsage::render_target)) {
|
||||
return pp::foundation::Status::invalid_argument("blit endpoints must be render targets");
|
||||
@@ -795,14 +810,14 @@ pp::foundation::Status validate_blit_descs(TextureDesc source, TextureDesc desti
|
||||
return pp::foundation::Status::invalid_argument("blit endpoints must use matching texture formats");
|
||||
}
|
||||
|
||||
const auto source_status = texture_byte_size(source);
|
||||
if (!source_status.ok()) {
|
||||
return source_status.status();
|
||||
const auto source_bytes = texture_byte_size(source);
|
||||
if (!source_bytes.ok()) {
|
||||
return source_bytes.status();
|
||||
}
|
||||
|
||||
const auto destination_status = texture_byte_size(destination);
|
||||
if (!destination_status.ok()) {
|
||||
return destination_status.status();
|
||||
const auto destination_bytes = texture_byte_size(destination);
|
||||
if (!destination_bytes.ok()) {
|
||||
return destination_bytes.status();
|
||||
}
|
||||
|
||||
return pp::foundation::Status::success();
|
||||
|
||||
Reference in New Issue
Block a user