Skip to content

Commit 7f7b510

Browse files
committed
supports_f64_precision accept &self to work properly on native GLES
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent 1659aee commit 7f7b510

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ pub trait HasContext: __private::Sealed {
536536

537537
unsafe fn clear_color(&self, red: f32, green: f32, blue: f32, alpha: f32);
538538

539-
unsafe fn supports_f64_precision() -> bool;
539+
unsafe fn supports_f64_precision(&self) -> bool;
540540

541541
unsafe fn clear_depth_f64(&self, depth: f64);
542542

src/native.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,9 +1236,8 @@ impl HasContext for Context {
12361236
gl.ClearColor(red, green, blue, alpha);
12371237
}
12381238

1239-
unsafe fn supports_f64_precision() -> bool {
1240-
// TODO: Handle OpenGL ES
1241-
true
1239+
unsafe fn supports_f64_precision(&self) -> bool {
1240+
!self.version.is_embedded
12421241
}
12431242

12441243
unsafe fn clear_depth_f64(&self, depth: f64) {
@@ -1252,7 +1251,7 @@ impl HasContext for Context {
12521251
}
12531252

12541253
unsafe fn clear_depth(&self, depth: f64) {
1255-
if !self.version.is_embedded {
1254+
if self.supports_f64_precision() {
12561255
self.clear_depth_f64(depth);
12571256
} else {
12581257
self.clear_depth_f32(depth as f32);
@@ -3275,7 +3274,7 @@ impl HasContext for Context {
32753274
}
32763275

32773276
unsafe fn depth_range(&self, near: f64, far: f64) {
3278-
if !self.version.is_embedded {
3277+
if self.supports_f64_precision() {
32793278
self.depth_range_f64(near, far);
32803279
} else {
32813280
self.depth_range_f32(near as f32, far as f32);

src/web_sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ impl HasContext for Context {
25462546
}
25472547
}
25482548

2549-
unsafe fn supports_f64_precision() -> bool {
2549+
unsafe fn supports_f64_precision(&self) -> bool {
25502550
false
25512551
}
25522552

0 commit comments

Comments
 (0)