mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
webxr: Use the same texture format as the original GL context's framebuffer when creating an XR GL layer.
This commit is contained in:
parent
778b48fa47
commit
5bd1e86d42
6 changed files with 43 additions and 17 deletions
|
@ -45,8 +45,8 @@ use canvas_traits::canvas::{
|
|||
CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
|
||||
};
|
||||
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
|
||||
use canvas_traits::webgl::GLLimits;
|
||||
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, GlType, TexDataType, TexFormat};
|
||||
use canvas_traits::webgl::{GLFormats, GLLimits};
|
||||
use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
|
||||
use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
|
||||
use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
|
||||
|
@ -437,7 +437,7 @@ unsafe_no_jsmanaged_fields!(StorageType);
|
|||
unsafe_no_jsmanaged_fields!(CanvasGradientStop, LinearGradientStyle, RadialGradientStyle);
|
||||
unsafe_no_jsmanaged_fields!(LineCapStyle, LineJoinStyle, CompositionOrBlending);
|
||||
unsafe_no_jsmanaged_fields!(RepetitionStyle);
|
||||
unsafe_no_jsmanaged_fields!(WebGLError, GLLimits, GlType);
|
||||
unsafe_no_jsmanaged_fields!(WebGLError, GLFormats, GLLimits, GlType);
|
||||
unsafe_no_jsmanaged_fields!(TimeProfilerChan);
|
||||
unsafe_no_jsmanaged_fields!(MemProfilerChan);
|
||||
unsafe_no_jsmanaged_fields!(PseudoElement);
|
||||
|
|
|
@ -53,8 +53,8 @@ use crate::script_runtime::JSContext as SafeJSContext;
|
|||
use backtrace::Backtrace;
|
||||
use canvas_traits::webgl::WebGLError::*;
|
||||
use canvas_traits::webgl::{
|
||||
webgl_channel, AlphaTreatment, DOMToTextureCommand, GLContextAttributes, GLLimits, GlType,
|
||||
Parameter, TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand,
|
||||
webgl_channel, AlphaTreatment, DOMToTextureCommand, GLContextAttributes, GLFormats, GLLimits,
|
||||
GlType, Parameter, TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand,
|
||||
WebGLCommandBacktrace, WebGLContextId, WebGLContextShareMode, WebGLError,
|
||||
WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, WebGLResult,
|
||||
WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion, WebVRCommand, YAxisTreatment,
|
||||
|
@ -170,6 +170,7 @@ pub struct WebGLRenderingContext {
|
|||
current_vao: MutNullableDom<WebGLVertexArrayObjectOES>,
|
||||
textures: Textures,
|
||||
api_type: GlType,
|
||||
framebuffer_format: GLFormats,
|
||||
}
|
||||
|
||||
impl WebGLRenderingContext {
|
||||
|
@ -229,6 +230,7 @@ impl WebGLRenderingContext {
|
|||
current_vao: Default::default(),
|
||||
textures: Textures::new(max_combined_texture_image_units),
|
||||
api_type: ctx_data.api_type,
|
||||
framebuffer_format: ctx_data.framebuffer_format,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1109,6 +1111,10 @@ impl WebGLRenderingContext {
|
|||
pub fn extension_manager(&self) -> &WebGLExtensions {
|
||||
&self.extension_manager
|
||||
}
|
||||
|
||||
pub fn formats(&self) -> &GLFormats {
|
||||
&self.framebuffer_format
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "webgl_backtrace"))]
|
||||
|
|
|
@ -110,16 +110,18 @@ impl XRWebGLLayer {
|
|||
let mut pixels = CustomAutoRooter::new(None);
|
||||
let mut clear_bits = constants::COLOR_BUFFER_BIT;
|
||||
|
||||
let formats = context.formats();
|
||||
|
||||
context.BindTexture(constants::TEXTURE_2D, Some(&texture));
|
||||
let sc = context.TexImage2D(
|
||||
constants::TEXTURE_2D,
|
||||
0,
|
||||
constants::RGBA,
|
||||
formats.texture_format,
|
||||
resolution.width,
|
||||
resolution.height,
|
||||
0,
|
||||
constants::RGBA,
|
||||
constants::UNSIGNED_BYTE,
|
||||
formats.texture_format,
|
||||
formats.texture_type,
|
||||
pixels.root(*cx),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue