diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c index 98c44300b1..6715cd23d9 100644 --- a/src/gpu/SDL_gpu.c +++ b/src/gpu/SDL_gpu.c @@ -375,6 +375,7 @@ SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline( } else { blit_pipeline_create_info.fragment_shader = blit_from_2d_shader; } + blit_pipeline_create_info.rasterizer_state.enable_depth_clip = device->default_enable_depth_clip; blit_pipeline_create_info.multisample_state.sample_count = SDL_GPU_SAMPLECOUNT_1; blit_pipeline_create_info.multisample_state.enable_mask = false; @@ -719,9 +720,18 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props) if (result != NULL) { result->backend = selectedBackend->name; result->debug_mode = debug_mode; - result->validate_feature_depth_clamp_disabled = !SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN, true); - result->validate_feature_indirect_draw_first_instance_disabled = !SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN, true); - result->validate_feature_anisotropy_disabled = !SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN, true); + if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN, true)) { + result->default_enable_depth_clip = false; + } else { + result->default_enable_depth_clip = true; + result->validate_feature_depth_clamp_disabled = true; + } + if (!SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN, true)) { + result->validate_feature_indirect_draw_first_instance_disabled = true; + } + if (!SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN, true)) { + result->validate_feature_anisotropy_disabled = true; + } } } return result; diff --git a/src/gpu/SDL_sysgpu.h b/src/gpu/SDL_sysgpu.h index 6eb65b00e4..f967a8a24f 100644 --- a/src/gpu/SDL_sysgpu.h +++ b/src/gpu/SDL_sysgpu.h @@ -1096,6 +1096,7 @@ struct SDL_GPUDevice // Store this for SDL_gpu.c's debug layer bool debug_mode; + bool default_enable_depth_clip; bool validate_feature_depth_clamp_disabled; bool validate_feature_indirect_draw_first_instance_disabled; bool validate_feature_anisotropy_disabled;