Skip to content

Commit

Permalink
GPU: Null check shader inputs in CreateGPUGraphicsPipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Nov 12, 2024
1 parent 32cc92d commit 5a74aad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gpu/SDL_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,14 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline(
}

if (device->debug_mode) {
if (graphicsPipelineCreateInfo->vertex_shader == NULL) {
SDL_assert_release(!"Vertex shader cannot be NULL!");
return NULL;
}
if (graphicsPipelineCreateInfo->fragment_shader == NULL) {
SDL_assert_release(!"Fragment shader cannot be NULL!");
return NULL;
}
if (graphicsPipelineCreateInfo->target_info.num_color_targets > 0 && graphicsPipelineCreateInfo->target_info.color_target_descriptions == NULL) {
SDL_assert_release(!"Color target descriptions array pointer cannot be NULL if num_color_targets is greater than zero!");
return NULL;
Expand Down

0 comments on commit 5a74aad

Please sign in to comment.