OpenGL ES: Crash as early as possible if things are bad

There's a huge variety of crash report in the Play Console of various
opengl failures. Try to concentrate them to early points in
initialization
This commit is contained in:
Henrik Rydgård committed 2022-11-08 10:43:38 +01:00
1 parent 094666ef4b
commit dd0409d68c
4 files changed
+33 -7

No files matched your search

+12 -2
View File
@@ -934,6 +934,16 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
bool CreateGlobalPipelines() {
using namespace Draw;
ShaderModule *vs_color_2d = g_draw->GetVshaderPreset(VS_COLOR_2D);
ShaderModule *fs_color_2d = g_draw->GetFshaderPreset(FS_COLOR_2D);
ShaderModule *vs_texture_color_2d = g_draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D);
ShaderModule *fs_texture_color_2d = g_draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D);
if (!vs_color_2d || !fs_color_2d || !vs_texture_color_2d || !fs_texture_color_2d) {
ERROR_LOG(G3D, "Failed to get shader preset");
return false;
}
InputLayout *inputLayout = ui_draw2d.CreateInputLayout(g_draw);
BlendState *blendNormal = g_draw->CreateBlendState({ true, 0xF, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA });
DepthStencilState *depth = g_draw->CreateDepthStencilState({ false, false, Comparison::LESS });
@@ -941,12 +951,12 @@ bool CreateGlobalPipelines() {
PipelineDesc colorDesc{
Primitive::TRIANGLE_LIST,
{ g_draw->GetVshaderPreset(VS_COLOR_2D), g_draw->GetFshaderPreset(FS_COLOR_2D) },
{ vs_color_2d, fs_color_2d },
inputLayout, depth, blendNormal, rasterNoCull, &vsColBufDesc,
};
PipelineDesc texColorDesc{
Primitive::TRIANGLE_LIST,
{ g_draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), g_draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D) },
{ vs_texture_color_2d, fs_texture_color_2d },
inputLayout, depth, blendNormal, rasterNoCull, &vsTexColBufDesc,
};