GL: Don't toggle primitive restart on WebGL. Fixes #3967. (#3969)

This commit is contained in:
Branimir Karadžić
2026-09-07 13:58:25 -07:00
committed by GitHub
parent 6fb33c492b
commit 9b636df330
3 changed files with 18 additions and 7 deletions

View File

@@ -3,6 +3,9 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef ARGS_H_HEADER_GUARD
#define ARGS_H_HEADER_GUARD
#include <bgfx/bgfx.h>
#include <bx/commandline.h>
@@ -104,3 +107,5 @@ struct Args
bgfx::RendererType::Enum m_type;
uint16_t m_pciId;
};
#endif // ARGS_H_HEADER_GUARD

View File

@@ -8485,10 +8485,11 @@ namespace bgfx { namespace gl
}
PrimInfo prim = s_primInfo[primIndex];
const bool primitiveRestartSupported = false
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|| s_extension[Extension::ARB_ES3_compatibility].m_supported
;
const bool primitiveRestartSupported = true
&& !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)
&& (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|| s_extension[Extension::ARB_ES3_compatibility].m_supported
);
GL_CHECK(glPolygonMode(GL_FRONT_AND_BACK
, _render->m_debug&BGFX_DEBUG_WIREFRAME

View File

@@ -4487,6 +4487,11 @@ WGPU_IMPORT
return m_moduleBgra8;
}
static uint8_t getNumBindGroupEntries(const ShaderBinding& _shaderBinding)
{
return ShaderBinding::Type::Sampler == _shaderBinding.type ? 2 : 1;
}
void ProgramWGPU::create(const ShaderWGPU* _vsh, const ShaderWGPU* _fsh)
{
BX_ASSERT(_vsh->m_module, "Vertex shader doesn't exist.");
@@ -4525,7 +4530,7 @@ WGPU_IMPORT
{
shaderBind = m_vsh->m_shaderBinding[stage];
shaderBind.shaderStage = WGPUShaderStage_Compute;
numBindings++;
numBindings += getNumBindGroupEntries(shaderBind);
}
}
}
@@ -4540,13 +4545,13 @@ WGPU_IMPORT
{
shaderBind = m_vsh->m_shaderBinding[stage];
shaderBind.shaderStage = WGPUShaderStage_Vertex;
numBindings++;
numBindings += getNumBindGroupEntries(shaderBind);
}
else if (NULL != m_fsh && isValid(m_fsh->m_shaderBinding[stage].uniformHandle) )
{
shaderBind = m_fsh->m_shaderBinding[stage];
shaderBind.shaderStage = WGPUShaderStage_Fragment;
numBindings += 2;
numBindings += getNumBindGroupEntries(shaderBind);
}
}
}