Skip to content

Commit

Permalink
gles: use already existing debug__fn private capabilty instead of che…
Browse files Browse the repository at this point in the history
…cking extensions (#4974)
  • Loading branch information
valaphee authored Jan 4, 2024
1 parent ad23b45 commit 7c21e60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
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

0 comments on commit 7c21e60

Please sign in to comment.