mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 22:19:10 +00:00
GPU: Check texture format support in pipeline creation
This commit is contained in:
parent
31dd4fe81f
commit
4294c06836
1 changed files with 8 additions and 0 deletions
|
@ -801,6 +801,10 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline(
|
|||
SDL_assert_release(!"Color target formats cannot be a depth format!");
|
||||
return NULL;
|
||||
}
|
||||
if (!SDL_GPUTextureSupportsFormat(device, graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].format, SDL_GPU_TEXTURETYPE_2D, SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) {
|
||||
SDL_assert_release(!"Format is not supported for color targets on this device!");
|
||||
return NULL;
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state.enable_blend) {
|
||||
const SDL_GPUColorTargetBlendState *blend_state = &graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state;
|
||||
CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->src_color_blendfactor, NULL)
|
||||
|
@ -817,6 +821,10 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline(
|
|||
SDL_assert_release(!"Depth-stencil target format must be a depth format!");
|
||||
return NULL;
|
||||
}
|
||||
if (!SDL_GPUTextureSupportsFormat(device, graphicsPipelineCreateInfo->target_info.depth_stencil_format, SDL_GPU_TEXTURETYPE_2D, SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) {
|
||||
SDL_assert_release(!"Format is not supported for depth targets on this device!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_buffer_descriptions == NULL) {
|
||||
SDL_assert_release(!"Vertex buffer descriptions array pointer cannot be NULL!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue