Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gles: use already existing debug__fn private capabilty instead of checking extensions #4974

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ impl super::Adapter {

let full_ver = Self::parse_full_version(&version).ok();
let es_ver = full_ver.map_or_else(|| Self::parse_version(&version).ok(), |_| None);
let web_gl = cfg!(target_arch = "wasm32");

if let Some(full_ver) = full_ver {
let core_profile = (full_ver >= (3, 2)).then_some(unsafe {
Expand Down Expand Up @@ -608,10 +607,7 @@ impl super::Adapter {
super::PrivateCapabilities::TEXTURE_STORAGE,
supported((3, 0), (4, 2)),
);
private_caps.set(
super::PrivateCapabilities::DEBUG_FNS,
supported((3, 2), (4, 3)) && !web_gl,
);
private_caps.set(super::PrivateCapabilities::DEBUG_FNS, gl.supports_debug());
private_caps.set(
super::PrivateCapabilities::INVALIDATE_FRAMEBUFFER,
supported((3, 0), (4, 3)),
Expand Down
26 changes: 21 additions & 5 deletions wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ impl super::Device {
let program = unsafe { gl.create_program() }.unwrap();
#[cfg(not(target_arch = "wasm32"))]
if let Some(label) = label {
if gl.supports_debug() {
if private_caps.contains(PrivateCapabilities::DEBUG_FNS) {
let name = unsafe { mem::transmute(program) };
unsafe { gl.object_label(glow::PROGRAM, name, Some(label)) };
}
Expand Down Expand Up @@ -593,7 +593,11 @@ impl crate::Device<super::Api> for super::Device {

#[cfg(not(target_arch = "wasm32"))]
if let Some(label) = desc.label {
if gl.supports_debug() {
if self
.shared
.private_caps
.contains(PrivateCapabilities::DEBUG_FNS)
{
let name = unsafe { mem::transmute(raw) };
unsafe { gl.object_label(glow::BUFFER, name, Some(label)) };
}
Expand Down Expand Up @@ -732,7 +736,11 @@ impl crate::Device<super::Api> for super::Device {

#[cfg(not(target_arch = "wasm32"))]
if let Some(label) = desc.label {
if gl.supports_debug() {
if self
.shared
.private_caps
.contains(PrivateCapabilities::DEBUG_FNS)
{
let name = unsafe { mem::transmute(raw) };
unsafe { gl.object_label(glow::RENDERBUFFER, name, Some(label)) };
}
Expand Down Expand Up @@ -896,7 +904,11 @@ impl crate::Device<super::Api> for super::Device {

#[cfg(not(target_arch = "wasm32"))]
if let Some(label) = desc.label {
if gl.supports_debug() {
if self
.shared
.private_caps
.contains(PrivateCapabilities::DEBUG_FNS)
{
let name = unsafe { mem::transmute(raw) };
unsafe { gl.object_label(glow::TEXTURE, name, Some(label)) };
}
Expand Down Expand Up @@ -1035,7 +1047,11 @@ impl crate::Device<super::Api> for super::Device {

#[cfg(not(target_arch = "wasm32"))]
if let Some(label) = desc.label {
if gl.supports_debug() {
if self
.shared
.private_caps
.contains(PrivateCapabilities::DEBUG_FNS)
{
let name = unsafe { mem::transmute(raw) };
unsafe { gl.object_label(glow::SAMPLER, name, Some(label)) };
}
Expand Down
Loading