mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
f220d6d3a5
commit
c94d909a86
585 changed files with 5411 additions and 5013 deletions
|
@ -28,23 +28,23 @@ use crate::script_runtime::CanGc;
|
|||
|
||||
#[dom_struct]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct GPU {
|
||||
pub(crate) struct GPU {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
||||
impl GPU {
|
||||
pub fn new_inherited() -> GPU {
|
||||
pub(crate) fn new_inherited() -> GPU {
|
||||
GPU {
|
||||
reflector_: Reflector::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<GPU> {
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<GPU> {
|
||||
reflect_dom_object(Box::new(GPU::new_inherited()), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AsyncWGPUListener {
|
||||
pub(crate) trait AsyncWGPUListener {
|
||||
fn handle_response(&self, response: WebGPUResponse, promise: &Rc<Promise>, can_gc: CanGc);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ impl<T: AsyncWGPUListener + DomObject> WGPUResponse<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn response_async<T: AsyncWGPUListener + DomObject + 'static>(
|
||||
pub(crate) fn response_async<T: AsyncWGPUListener + DomObject + 'static>(
|
||||
promise: &Rc<Promise>,
|
||||
receiver: &T,
|
||||
) -> IpcSender<WebGPUResponse> {
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::realms::InRealm;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUAdapter {
|
||||
pub(crate) struct GPUAdapter {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -67,7 +67,7 @@ impl GPUAdapter {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
name: DOMString,
|
||||
|
|
|
@ -8,12 +8,12 @@ use webgpu::wgt::AdapterInfo;
|
|||
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUAdapterInfoMethods;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::test::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUAdapterInfo {
|
||||
pub(crate) struct GPUAdapterInfo {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in wgpu-types"]
|
||||
#[no_trace]
|
||||
|
@ -28,7 +28,7 @@ impl GPUAdapterInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, info: AdapterInfo) -> DomRoot<Self> {
|
||||
pub(crate) fn new(global: &GlobalScope, info: AdapterInfo) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(info)), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUBindGroup {
|
||||
pub(crate) struct GPUBindGroup {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -53,7 +53,7 @@ impl GPUBindGroup {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
bind_group: WebGPUBindGroup,
|
||||
|
@ -72,12 +72,12 @@ impl GPUBindGroup {
|
|||
}
|
||||
|
||||
impl GPUBindGroup {
|
||||
pub fn id(&self) -> &WebGPUBindGroup {
|
||||
pub(crate) fn id(&self) -> &WebGPUBindGroup {
|
||||
&self.bind_group
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgroup>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUBindGroupDescriptor,
|
||||
) -> DomRoot<GPUBindGroup> {
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUBindGroupLayout {
|
||||
pub(crate) struct GPUBindGroupLayout {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -47,7 +47,7 @@ impl GPUBindGroupLayout {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
bind_group_layout: WebGPUBindGroupLayout,
|
||||
|
@ -66,12 +66,12 @@ impl GPUBindGroupLayout {
|
|||
}
|
||||
|
||||
impl GPUBindGroupLayout {
|
||||
pub fn id(&self) -> WebGPUBindGroupLayout {
|
||||
pub(crate) fn id(&self) -> WebGPUBindGroupLayout {
|
||||
self.bind_group_layout
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#GPUDevice-createBindGroupLayout>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUBindGroupLayoutDescriptor,
|
||||
) -> Fallible<DomRoot<GPUBindGroupLayout>> {
|
||||
|
|
|
@ -31,11 +31,11 @@ use crate::realms::InRealm;
|
|||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub struct ActiveBufferMapping {
|
||||
pub(crate) struct ActiveBufferMapping {
|
||||
// TODO(sagudev): Use IpcSharedMemory when https://github.com/servo/ipc-channel/pull/356 lands
|
||||
/// <https://gpuweb.github.io/gpuweb/#active-buffer-mapping-data>
|
||||
/// <https://gpuweb.github.io/gpuweb/#active-buffer-mapping-views>
|
||||
pub data: DataBlock,
|
||||
pub(crate) data: DataBlock,
|
||||
/// <https://gpuweb.github.io/gpuweb/#active-buffer-mapping-mode>
|
||||
mode: GPUMapModeFlags,
|
||||
/// <https://gpuweb.github.io/gpuweb/#active-buffer-mapping-range>
|
||||
|
@ -44,7 +44,7 @@ pub struct ActiveBufferMapping {
|
|||
|
||||
impl ActiveBufferMapping {
|
||||
/// <https://gpuweb.github.io/gpuweb/#abstract-opdef-initialize-an-active-buffer-mapping>
|
||||
pub fn new(mode: GPUMapModeFlags, range: Range<u64>) -> Fallible<Self> {
|
||||
pub(crate) fn new(mode: GPUMapModeFlags, range: Range<u64>) -> Fallible<Self> {
|
||||
// Step 1
|
||||
let size = range.end - range.start;
|
||||
// Step 2
|
||||
|
@ -63,7 +63,7 @@ impl ActiveBufferMapping {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUBuffer {
|
||||
pub(crate) struct GPUBuffer {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -107,7 +107,7 @@ impl GPUBuffer {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
buffer: WebGPUBuffer,
|
||||
|
@ -128,12 +128,12 @@ impl GPUBuffer {
|
|||
}
|
||||
|
||||
impl GPUBuffer {
|
||||
pub fn id(&self) -> WebGPUBuffer {
|
||||
pub(crate) fn id(&self) -> WebGPUBuffer {
|
||||
self.buffer
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbuffer>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUBufferDescriptor,
|
||||
) -> Fallible<DomRoot<GPUBuffer>> {
|
||||
|
|
|
@ -7,6 +7,6 @@ use dom_struct::dom_struct;
|
|||
use crate::dom::bindings::reflector::Reflector;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUBufferUsage {
|
||||
pub(crate) struct GPUBufferUsage {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ struct DrawingBuffer {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUCanvasContext {
|
||||
pub(crate) struct GPUCanvasContext {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -140,7 +140,11 @@ impl GPUCanvasContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, canvas: &HTMLCanvasElement, channel: WebGPU) -> DomRoot<Self> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
canvas: &HTMLCanvasElement,
|
||||
channel: WebGPU,
|
||||
) -> DomRoot<Self> {
|
||||
let document = canvas.owner_document();
|
||||
let this = reflect_dom_object(
|
||||
Box::new(GPUCanvasContext::new_inherited(
|
||||
|
|
|
@ -7,6 +7,6 @@ use dom_struct::dom_struct;
|
|||
use crate::dom::bindings::reflector::Reflector;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUColorWrite {
|
||||
pub(crate) struct GPUColorWrite {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUCommandBuffer {
|
||||
pub(crate) struct GPUCommandBuffer {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -38,7 +38,7 @@ impl GPUCommandBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
command_buffer: WebGPUCommandBuffer,
|
||||
|
@ -72,7 +72,7 @@ impl Drop for GPUCommandBuffer {
|
|||
}
|
||||
|
||||
impl GPUCommandBuffer {
|
||||
pub fn id(&self) -> WebGPUCommandBuffer {
|
||||
pub(crate) fn id(&self) -> WebGPUCommandBuffer {
|
||||
self.command_buffer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ use crate::dom::webgpu::gpurenderpassencoder::GPURenderPassEncoder;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUCommandEncoder {
|
||||
pub(crate) struct GPUCommandEncoder {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -42,7 +42,7 @@ pub struct GPUCommandEncoder {
|
|||
}
|
||||
|
||||
impl GPUCommandEncoder {
|
||||
pub fn new_inherited(
|
||||
pub(crate) fn new_inherited(
|
||||
channel: WebGPU,
|
||||
device: &GPUDevice,
|
||||
encoder: WebGPUCommandEncoder,
|
||||
|
@ -57,7 +57,7 @@ impl GPUCommandEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
device: &GPUDevice,
|
||||
|
@ -75,16 +75,16 @@ impl GPUCommandEncoder {
|
|||
}
|
||||
|
||||
impl GPUCommandEncoder {
|
||||
pub fn id(&self) -> WebGPUCommandEncoder {
|
||||
pub(crate) fn id(&self) -> WebGPUCommandEncoder {
|
||||
self.encoder
|
||||
}
|
||||
|
||||
pub fn device_id(&self) -> WebGPUDevice {
|
||||
pub(crate) fn device_id(&self) -> WebGPUDevice {
|
||||
self.device.id()
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUCommandEncoderDescriptor,
|
||||
) -> DomRoot<GPUCommandEncoder> {
|
||||
|
|
|
@ -15,14 +15,14 @@ use crate::dom::types::GPUCompilationMessage;
|
|||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUCompilationInfo {
|
||||
pub(crate) struct GPUCompilationInfo {
|
||||
reflector_: Reflector,
|
||||
// currently we only get one message from wgpu
|
||||
msg: Vec<DomRoot<GPUCompilationMessage>>,
|
||||
}
|
||||
|
||||
impl GPUCompilationInfo {
|
||||
pub fn new_inherited(msg: Vec<DomRoot<GPUCompilationMessage>>) -> Self {
|
||||
pub(crate) fn new_inherited(msg: Vec<DomRoot<GPUCompilationMessage>>) -> Self {
|
||||
Self {
|
||||
reflector_: Reflector::new(),
|
||||
msg,
|
||||
|
@ -30,7 +30,7 @@ impl GPUCompilationInfo {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
msg: Vec<DomRoot<GPUCompilationMessage>>,
|
||||
can_gc: CanGc,
|
||||
|
@ -38,7 +38,7 @@ impl GPUCompilationInfo {
|
|||
reflect_dom_object_with_proto(Box::new(Self::new_inherited(msg)), global, None, can_gc)
|
||||
}
|
||||
|
||||
pub fn from(
|
||||
pub(crate) fn from(
|
||||
global: &GlobalScope,
|
||||
error: Option<ShaderCompilationInfo>,
|
||||
can_gc: CanGc,
|
||||
|
|
|
@ -12,12 +12,12 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
|
|||
};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::types::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::test::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUCompilationMessage {
|
||||
pub(crate) struct GPUCompilationMessage {
|
||||
reflector_: Reflector,
|
||||
// #[ignore_malloc_size_of = "defined in wgpu-types"]
|
||||
message: DOMString,
|
||||
|
@ -48,7 +48,7 @@ impl GPUCompilationMessage {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
message: DOMString,
|
||||
mtype: GPUCompilationMessageType,
|
||||
|
@ -66,7 +66,7 @@ impl GPUCompilationMessage {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn from(global: &GlobalScope, info: ShaderCompilationInfo) -> DomRoot<Self> {
|
||||
pub(crate) fn from(global: &GlobalScope, info: ShaderCompilationInfo) -> DomRoot<Self> {
|
||||
GPUCompilationMessage::new(
|
||||
global,
|
||||
info.message.into(),
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::dom::webgpu::gpucomputepipeline::GPUComputePipeline;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUComputePassEncoder {
|
||||
pub(crate) struct GPUComputePassEncoder {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -45,7 +45,7 @@ impl GPUComputePassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
parent: &GPUCommandEncoder,
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUComputePipeline {
|
||||
pub(crate) struct GPUComputePipeline {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -48,7 +48,7 @@ impl GPUComputePipeline {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
compute_pipeline: WebGPUComputePipeline,
|
||||
label: USVString,
|
||||
|
@ -67,12 +67,12 @@ impl GPUComputePipeline {
|
|||
}
|
||||
|
||||
impl GPUComputePipeline {
|
||||
pub fn id(&self) -> &WebGPUComputePipeline {
|
||||
pub(crate) fn id(&self) -> &WebGPUComputePipeline {
|
||||
&self.compute_pipeline
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipeline>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUComputePipelineDescriptor,
|
||||
async_sender: Option<IpcSender<WebGPUResponse>>,
|
||||
|
|
|
@ -506,7 +506,7 @@ impl<'a> Convert<Option<Cow<'a, str>>> for &GPUObjectDescriptorBase {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn convert_bind_group_layout_entry(
|
||||
pub(crate) fn convert_bind_group_layout_entry(
|
||||
bgle: &GPUBindGroupLayoutEntry,
|
||||
device: &GPUDevice,
|
||||
) -> Fallible<Result<wgt::BindGroupLayoutEntry, webgpu::Error>> {
|
||||
|
@ -581,7 +581,7 @@ pub fn convert_bind_group_layout_entry(
|
|||
}))
|
||||
}
|
||||
|
||||
pub fn convert_texture_descriptor(
|
||||
pub(crate) fn convert_texture_descriptor(
|
||||
descriptor: &GPUTextureDescriptor,
|
||||
device: &GPUDevice,
|
||||
) -> Fallible<(TextureDescriptor<'static>, wgt::Extent3d)> {
|
||||
|
|
|
@ -65,7 +65,7 @@ use crate::realms::InRealm;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUDevice {
|
||||
pub(crate) struct GPUDevice {
|
||||
eventtarget: EventTarget,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -85,20 +85,20 @@ pub struct GPUDevice {
|
|||
valid: Cell<bool>,
|
||||
}
|
||||
|
||||
pub enum PipelineLayout {
|
||||
pub(crate) enum PipelineLayout {
|
||||
Implicit(PipelineLayoutId, Vec<BindGroupLayoutId>),
|
||||
Explicit(PipelineLayoutId),
|
||||
}
|
||||
|
||||
impl PipelineLayout {
|
||||
pub fn explicit(&self) -> Option<PipelineLayoutId> {
|
||||
pub(crate) fn explicit(&self) -> Option<PipelineLayoutId> {
|
||||
match self {
|
||||
PipelineLayout::Explicit(layout_id) => Some(*layout_id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn implicit(self) -> Option<(PipelineLayoutId, Vec<BindGroupLayoutId>)> {
|
||||
pub(crate) fn implicit(self) -> Option<(PipelineLayoutId, Vec<BindGroupLayoutId>)> {
|
||||
match self {
|
||||
PipelineLayout::Implicit(layout_id, bind_group_layout_ids) => {
|
||||
Some((layout_id, bind_group_layout_ids))
|
||||
|
@ -137,7 +137,7 @@ impl GPUDevice {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
adapter: &GPUAdapter,
|
||||
|
@ -174,19 +174,19 @@ impl GPUDevice {
|
|||
}
|
||||
|
||||
impl GPUDevice {
|
||||
pub fn id(&self) -> webgpu::WebGPUDevice {
|
||||
pub(crate) fn id(&self) -> webgpu::WebGPUDevice {
|
||||
self.device
|
||||
}
|
||||
|
||||
pub fn queue_id(&self) -> webgpu::WebGPUQueue {
|
||||
pub(crate) fn queue_id(&self) -> webgpu::WebGPUQueue {
|
||||
self.default_queue.id()
|
||||
}
|
||||
|
||||
pub fn channel(&self) -> WebGPU {
|
||||
pub(crate) fn channel(&self) -> WebGPU {
|
||||
self.channel.clone()
|
||||
}
|
||||
|
||||
pub fn dispatch_error(&self, error: webgpu::Error) {
|
||||
pub(crate) fn dispatch_error(&self, error: webgpu::Error) {
|
||||
if let Err(e) = self.channel.0.send(WebGPURequest::DispatchError {
|
||||
device_id: self.device.0,
|
||||
error,
|
||||
|
@ -195,7 +195,7 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fire_uncaptured_error(&self, error: webgpu::Error, can_gc: CanGc) {
|
||||
pub(crate) fn fire_uncaptured_error(&self, error: webgpu::Error, can_gc: CanGc) {
|
||||
let error = GPUError::from_error(&self.global(), error, can_gc);
|
||||
let ev = GPUUncapturedErrorEvent::new(
|
||||
&self.global(),
|
||||
|
@ -213,7 +213,7 @@ impl GPUDevice {
|
|||
///
|
||||
/// Validates that the device suppports required features,
|
||||
/// and if so returns an ok containing wgpu's `TextureFormat`
|
||||
pub fn validate_texture_format_required_features(
|
||||
pub(crate) fn validate_texture_format_required_features(
|
||||
&self,
|
||||
format: &GPUTextureFormat,
|
||||
) -> Fallible<TextureFormat> {
|
||||
|
@ -231,11 +231,11 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_lost(&self) -> bool {
|
||||
pub(crate) fn is_lost(&self) -> bool {
|
||||
self.lost_promise.borrow().is_fulfilled()
|
||||
}
|
||||
|
||||
pub fn get_pipeline_layout_data(
|
||||
pub(crate) fn get_pipeline_layout_data(
|
||||
&self,
|
||||
layout: &GPUPipelineLayoutOrGPUAutoLayoutMode,
|
||||
) -> PipelineLayout {
|
||||
|
@ -253,7 +253,7 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_render_pipeline<'a>(
|
||||
pub(crate) fn parse_render_pipeline<'a>(
|
||||
&self,
|
||||
descriptor: &GPURenderPipelineDescriptor,
|
||||
) -> Fallible<(PipelineLayout, RenderPipelineDescriptor<'a>)> {
|
||||
|
@ -369,7 +369,7 @@ impl GPUDevice {
|
|||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#lose-the-device>
|
||||
pub fn lose(&self, reason: GPUDeviceLostReason, msg: String) {
|
||||
pub(crate) fn lose(&self, reason: GPUDeviceLostReason, msg: String) {
|
||||
let lost_promise = &(*self.lost_promise.borrow());
|
||||
let global = &self.global();
|
||||
let lost = GPUDeviceLostInfo::new(global, msg.into(), reason);
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUDeviceLostInfo {
|
||||
pub(crate) struct GPUDeviceLostInfo {
|
||||
reflector_: Reflector,
|
||||
message: DOMString,
|
||||
reason: GPUDeviceLostReason,
|
||||
|
@ -31,7 +31,7 @@ impl GPUDeviceLostInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
message: DOMString,
|
||||
reason: GPUDeviceLostReason,
|
||||
|
|
|
@ -16,13 +16,13 @@ use crate::dom::types::{GPUInternalError, GPUOutOfMemoryError, GPUValidationErro
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUError {
|
||||
pub(crate) struct GPUError {
|
||||
reflector_: Reflector,
|
||||
message: DOMString,
|
||||
}
|
||||
|
||||
impl GPUError {
|
||||
pub fn new_inherited(message: DOMString) -> Self {
|
||||
pub(crate) fn new_inherited(message: DOMString) -> Self {
|
||||
Self {
|
||||
reflector_: Reflector::new(),
|
||||
message,
|
||||
|
@ -30,12 +30,12 @@ impl GPUError {
|
|||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn new(global: &GlobalScope, message: DOMString, can_gc: CanGc) -> DomRoot<Self> {
|
||||
pub(crate) fn new(global: &GlobalScope, message: DOMString, can_gc: CanGc) -> DomRoot<Self> {
|
||||
Self::new_with_proto(global, None, message, can_gc)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn new_with_proto(
|
||||
pub(crate) fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
|
@ -49,7 +49,7 @@ impl GPUError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn from_error(global: &GlobalScope, error: Error, can_gc: CanGc) -> DomRoot<Self> {
|
||||
pub(crate) fn from_error(global: &GlobalScope, error: Error, can_gc: CanGc) -> DomRoot<Self> {
|
||||
match error {
|
||||
Error::Validation(msg) => DomRoot::upcast(GPUValidationError::new_with_proto(
|
||||
global,
|
||||
|
@ -91,7 +91,7 @@ impl Convert<GPUErrorFilter> for ErrorFilter {
|
|||
}
|
||||
|
||||
impl GPUErrorFilter {
|
||||
pub fn as_webgpu(&self) -> ErrorFilter {
|
||||
pub(crate) fn as_webgpu(&self) -> ErrorFilter {
|
||||
match self {
|
||||
GPUErrorFilter::Validation => ErrorFilter::Validation,
|
||||
GPUErrorFilter::Out_of_memory => ErrorFilter::OutOfMemory,
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::types::GPUError;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUInternalError {
|
||||
pub(crate) struct GPUInternalError {
|
||||
gpu_error: GPUError,
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl GPUInternalError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_proto(
|
||||
pub(crate) fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
|
|
|
@ -7,6 +7,6 @@ use dom_struct::dom_struct;
|
|||
use crate::dom::bindings::reflector::Reflector;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUMapMode {
|
||||
pub(crate) struct GPUMapMode {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::types::GPUError;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUOutOfMemoryError {
|
||||
pub(crate) struct GPUOutOfMemoryError {
|
||||
gpu_error: GPUError,
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl GPUOutOfMemoryError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_proto(
|
||||
pub(crate) fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::script_runtime::CanGc;
|
|||
|
||||
/// <https://gpuweb.github.io/gpuweb/#gpupipelineerror>
|
||||
#[dom_struct]
|
||||
pub struct GPUPipelineError {
|
||||
pub(crate) struct GPUPipelineError {
|
||||
exception: DOMException,
|
||||
reason: GPUPipelineErrorReason,
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ impl GPUPipelineError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_proto(
|
||||
pub(crate) fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
|
@ -45,7 +45,7 @@ impl GPUPipelineError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
message: DOMString,
|
||||
reason: GPUPipelineErrorReason,
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUPipelineLayout {
|
||||
pub(crate) struct GPUPipelineLayout {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -49,7 +49,7 @@ impl GPUPipelineLayout {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
pipeline_layout: WebGPUPipelineLayout,
|
||||
|
@ -70,16 +70,16 @@ impl GPUPipelineLayout {
|
|||
}
|
||||
|
||||
impl GPUPipelineLayout {
|
||||
pub fn id(&self) -> WebGPUPipelineLayout {
|
||||
pub(crate) fn id(&self) -> WebGPUPipelineLayout {
|
||||
self.pipeline_layout
|
||||
}
|
||||
|
||||
pub fn bind_group_layouts(&self) -> Vec<WebGPUBindGroupLayout> {
|
||||
pub(crate) fn bind_group_layouts(&self) -> Vec<WebGPUBindGroupLayout> {
|
||||
self.bind_group_layouts.clone()
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createpipelinelayout>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUPipelineLayoutDescriptor,
|
||||
) -> DomRoot<GPUPipelineLayout> {
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::dom::bindings::reflector::Reflector;
|
|||
use crate::dom::bindings::str::USVString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUQuerySet {
|
||||
pub(crate) struct GPUQuerySet {
|
||||
reflector_: Reflector,
|
||||
// #[ignore_malloc_size_of = "defined in wgpu-types"]
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUQueue {
|
||||
pub(crate) struct GPUQueue {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -49,7 +49,7 @@ impl GPUQueue {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, channel: WebGPU, queue: WebGPUQueue) -> DomRoot<Self> {
|
||||
pub(crate) fn new(global: &GlobalScope, channel: WebGPU, queue: WebGPUQueue) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUQueue::new_inherited(channel, queue)),
|
||||
global,
|
||||
|
@ -59,11 +59,11 @@ impl GPUQueue {
|
|||
}
|
||||
|
||||
impl GPUQueue {
|
||||
pub fn set_device(&self, device: &GPUDevice) {
|
||||
pub(crate) fn set_device(&self, device: &GPUDevice) {
|
||||
*self.device.borrow_mut() = Some(Dom::from_ref(device));
|
||||
}
|
||||
|
||||
pub fn id(&self) -> WebGPUQueue {
|
||||
pub(crate) fn id(&self) -> WebGPUQueue {
|
||||
self.queue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPURenderBundle {
|
||||
pub(crate) struct GPURenderBundle {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -42,7 +42,7 @@ impl GPURenderBundle {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
render_bundle: WebGPURenderBundle,
|
||||
device: WebGPUDevice,
|
||||
|
@ -63,7 +63,7 @@ impl GPURenderBundle {
|
|||
}
|
||||
|
||||
impl GPURenderBundle {
|
||||
pub fn id(&self) -> WebGPURenderBundle {
|
||||
pub(crate) fn id(&self) -> WebGPURenderBundle {
|
||||
self.render_bundle
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPURenderBundleEncoder {
|
||||
pub(crate) struct GPURenderBundleEncoder {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -57,7 +57,7 @@ impl GPURenderBundleEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
render_bundle_encoder: RenderBundleEncoder,
|
||||
device: &GPUDevice,
|
||||
|
@ -79,7 +79,7 @@ impl GPURenderBundleEncoder {
|
|||
|
||||
impl GPURenderBundleEncoder {
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderbundleencoder>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPURenderBundleEncoderDescriptor,
|
||||
) -> Fallible<DomRoot<GPURenderBundleEncoder>> {
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPURenderPassEncoder {
|
||||
pub(crate) struct GPURenderPassEncoder {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -51,7 +51,7 @@ impl GPURenderPassEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
render_pass: WebGPURenderPass,
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::dom::webgpu::gpudevice::{GPUDevice, PipelineLayout};
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPURenderPipeline {
|
||||
pub(crate) struct GPURenderPipeline {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
#[no_trace]
|
||||
|
@ -45,7 +45,7 @@ impl GPURenderPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
render_pipeline: WebGPURenderPipeline,
|
||||
label: USVString,
|
||||
|
@ -64,12 +64,12 @@ impl GPURenderPipeline {
|
|||
}
|
||||
|
||||
impl GPURenderPipeline {
|
||||
pub fn id(&self) -> WebGPURenderPipeline {
|
||||
pub(crate) fn id(&self) -> WebGPURenderPipeline {
|
||||
self.render_pipeline
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipeline>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
pipeline_layout: PipelineLayout,
|
||||
descriptor: RenderPipelineDescriptor<'static>,
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::dom::webgpu::gpudevice::GPUDevice;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUSampler {
|
||||
pub(crate) struct GPUSampler {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -50,7 +50,7 @@ impl GPUSampler {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
device: WebGPUDevice,
|
||||
|
@ -73,12 +73,15 @@ impl GPUSampler {
|
|||
}
|
||||
|
||||
impl GPUSampler {
|
||||
pub fn id(&self) -> WebGPUSampler {
|
||||
pub(crate) fn id(&self) -> WebGPUSampler {
|
||||
self.sampler
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createsampler>
|
||||
pub fn create(device: &GPUDevice, descriptor: &GPUSamplerDescriptor) -> DomRoot<GPUSampler> {
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUSamplerDescriptor,
|
||||
) -> DomRoot<GPUSampler> {
|
||||
let sampler_id = device.global().wgpu_id_hub().create_sampler_id();
|
||||
let compare_enable = descriptor.compare.is_some();
|
||||
let desc = SamplerDescriptor {
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::realms::InRealm;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUShaderModule {
|
||||
pub(crate) struct GPUShaderModule {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -53,7 +53,7 @@ impl GPUShaderModule {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
shader_module: WebGPUShaderModule,
|
||||
|
@ -74,12 +74,12 @@ impl GPUShaderModule {
|
|||
}
|
||||
|
||||
impl GPUShaderModule {
|
||||
pub fn id(&self) -> WebGPUShaderModule {
|
||||
pub(crate) fn id(&self) -> WebGPUShaderModule {
|
||||
self.shader_module
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: RootedTraceableBox<GPUShaderModuleDescriptor>,
|
||||
comp: InRealm,
|
||||
|
|
|
@ -7,6 +7,6 @@ use dom_struct::dom_struct;
|
|||
use crate::dom::bindings::reflector::Reflector;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUShaderStage {
|
||||
pub(crate) struct GPUShaderStage {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUSupportedFeatures {
|
||||
pub(crate) struct GPUSupportedFeatures {
|
||||
reflector: Reflector,
|
||||
// internal storage for features
|
||||
#[custom_trace]
|
||||
|
@ -96,7 +96,7 @@ impl GPUSupportedFeatures {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
pub(crate) fn Constructor(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
features: Features,
|
||||
|
@ -107,7 +107,7 @@ impl GPUSupportedFeatures {
|
|||
}
|
||||
|
||||
impl GPUSupportedFeatures {
|
||||
pub fn wgpu_features(&self) -> Features {
|
||||
pub(crate) fn wgpu_features(&self) -> Features {
|
||||
self.features
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ impl GPUSupportedFeaturesMethods<crate::DomTypeHolder> for GPUSupportedFeatures
|
|||
}
|
||||
}
|
||||
|
||||
pub fn gpu_to_wgt_feature(feature: GPUFeatureName) -> Option<Features> {
|
||||
pub(crate) fn gpu_to_wgt_feature(feature: GPUFeatureName) -> Option<Features> {
|
||||
match feature {
|
||||
GPUFeatureName::Depth_clip_control => Some(Features::DEPTH_CLIP_CONTROL),
|
||||
GPUFeatureName::Depth32float_stencil8 => Some(Features::DEPTH32FLOAT_STENCIL8),
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUSupportedLimits {
|
||||
pub(crate) struct GPUSupportedLimits {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in wgpu-types"]
|
||||
#[no_trace]
|
||||
|
@ -29,7 +29,7 @@ impl GPUSupportedLimits {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, limits: Limits) -> DomRoot<Self> {
|
||||
pub(crate) fn new(global: &GlobalScope, limits: Limits) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(limits)), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ impl GPUSupportedLimitsMethods<crate::DomTypeHolder> for GPUSupportedLimits {
|
|||
}
|
||||
|
||||
/// Returns false if unknown limit or other value error
|
||||
pub fn set_limit(limits: &mut Limits, limit: &str, value: u64) -> bool {
|
||||
pub(crate) fn set_limit(limits: &mut Limits, limit: &str, value: u64) -> bool {
|
||||
/// per spec defaults are lower bounds for values
|
||||
///
|
||||
/// <https://www.w3.org/TR/webgpu/#limit-class-maximum>
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::dom::webgpu::gputextureview::GPUTextureView;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUTexture {
|
||||
pub(crate) struct GPUTexture {
|
||||
reflector_: Reflector,
|
||||
#[no_trace]
|
||||
texture: WebGPUTexture,
|
||||
|
@ -74,7 +74,7 @@ impl GPUTexture {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
texture: WebGPUTexture,
|
||||
device: &GPUDevice,
|
||||
|
@ -122,12 +122,12 @@ impl Drop for GPUTexture {
|
|||
}
|
||||
|
||||
impl GPUTexture {
|
||||
pub fn id(&self) -> WebGPUTexture {
|
||||
pub(crate) fn id(&self) -> WebGPUTexture {
|
||||
self.texture
|
||||
}
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpudevice-createtexture>
|
||||
pub fn create(
|
||||
pub(crate) fn create(
|
||||
device: &GPUDevice,
|
||||
descriptor: &GPUTextureDescriptor,
|
||||
) -> Fallible<DomRoot<GPUTexture>> {
|
||||
|
|
|
@ -7,6 +7,6 @@ use dom_struct::dom_struct;
|
|||
use crate::dom::bindings::reflector::Reflector;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUTextureUsage {
|
||||
pub(crate) struct GPUTextureUsage {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::dom::webgpu::gputexture::GPUTexture;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUTextureView {
|
||||
pub(crate) struct GPUTextureView {
|
||||
reflector_: Reflector,
|
||||
#[ignore_malloc_size_of = "defined in webgpu"]
|
||||
#[no_trace]
|
||||
|
@ -42,7 +42,7 @@ impl GPUTextureView {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
texture_view: WebGPUTextureView,
|
||||
|
@ -63,7 +63,7 @@ impl GPUTextureView {
|
|||
}
|
||||
|
||||
impl GPUTextureView {
|
||||
pub fn id(&self) -> WebGPUTextureView {
|
||||
pub(crate) fn id(&self) -> WebGPUTextureView {
|
||||
self.texture_view
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::dom::webgpu::gpuerror::GPUError;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUUncapturedErrorEvent {
|
||||
pub(crate) struct GPUUncapturedErrorEvent {
|
||||
event: Event,
|
||||
#[ignore_malloc_size_of = "Because it is non-owning"]
|
||||
gpu_error: Dom<GPUError>,
|
||||
|
@ -33,7 +33,7 @@ impl GPUUncapturedErrorEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
type_: DOMString,
|
||||
init: &GPUUncapturedErrorEventInit,
|
||||
|
@ -63,7 +63,7 @@ impl GPUUncapturedErrorEvent {
|
|||
ev
|
||||
}
|
||||
|
||||
pub fn event(&self) -> &Event {
|
||||
pub(crate) fn event(&self) -> &Event {
|
||||
&self.event
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::dom::types::GPUError;
|
|||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUValidationError {
|
||||
pub(crate) struct GPUValidationError {
|
||||
gpu_error: GPUError,
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl GPUValidationError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_proto(
|
||||
pub(crate) fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
message: DOMString,
|
||||
|
|
|
@ -16,7 +16,7 @@ use webgpu::wgc::id::{
|
|||
use webgpu::wgc::identity::IdentityManager;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IdentityHub {
|
||||
pub(crate) struct IdentityHub {
|
||||
adapters: IdentityManager<Adapter>,
|
||||
devices: IdentityManager<Device>,
|
||||
queues: IdentityManager<Queue>,
|
||||
|
@ -61,139 +61,139 @@ impl Default for IdentityHub {
|
|||
}
|
||||
|
||||
impl IdentityHub {
|
||||
pub fn create_device_id(&self) -> DeviceId {
|
||||
pub(crate) fn create_device_id(&self) -> DeviceId {
|
||||
self.devices.process()
|
||||
}
|
||||
|
||||
pub fn free_device_id(&self, id: DeviceId) {
|
||||
pub(crate) fn free_device_id(&self, id: DeviceId) {
|
||||
self.devices.free(id);
|
||||
}
|
||||
|
||||
pub fn create_queue_id(&self) -> QueueId {
|
||||
pub(crate) fn create_queue_id(&self) -> QueueId {
|
||||
self.queues.process()
|
||||
}
|
||||
|
||||
pub fn free_queue_id(&self, id: QueueId) {
|
||||
pub(crate) fn free_queue_id(&self, id: QueueId) {
|
||||
self.queues.free(id);
|
||||
}
|
||||
|
||||
pub fn create_adapter_id(&self) -> AdapterId {
|
||||
pub(crate) fn create_adapter_id(&self) -> AdapterId {
|
||||
self.adapters.process()
|
||||
}
|
||||
|
||||
pub fn free_adapter_id(&self, id: AdapterId) {
|
||||
pub(crate) fn free_adapter_id(&self, id: AdapterId) {
|
||||
self.adapters.free(id);
|
||||
}
|
||||
|
||||
pub fn create_buffer_id(&self) -> BufferId {
|
||||
pub(crate) fn create_buffer_id(&self) -> BufferId {
|
||||
self.buffers.process()
|
||||
}
|
||||
|
||||
pub fn free_buffer_id(&self, id: BufferId) {
|
||||
pub(crate) fn free_buffer_id(&self, id: BufferId) {
|
||||
self.buffers.free(id);
|
||||
}
|
||||
|
||||
pub fn create_bind_group_id(&self) -> BindGroupId {
|
||||
pub(crate) fn create_bind_group_id(&self) -> BindGroupId {
|
||||
self.bind_groups.process()
|
||||
}
|
||||
|
||||
pub fn free_bind_group_id(&self, id: BindGroupId) {
|
||||
pub(crate) fn free_bind_group_id(&self, id: BindGroupId) {
|
||||
self.bind_groups.free(id);
|
||||
}
|
||||
|
||||
pub fn create_bind_group_layout_id(&self) -> BindGroupLayoutId {
|
||||
pub(crate) fn create_bind_group_layout_id(&self) -> BindGroupLayoutId {
|
||||
self.bind_group_layouts.process()
|
||||
}
|
||||
|
||||
pub fn free_bind_group_layout_id(&self, id: BindGroupLayoutId) {
|
||||
pub(crate) fn free_bind_group_layout_id(&self, id: BindGroupLayoutId) {
|
||||
self.bind_group_layouts.free(id);
|
||||
}
|
||||
|
||||
pub fn create_compute_pipeline_id(&self) -> ComputePipelineId {
|
||||
pub(crate) fn create_compute_pipeline_id(&self) -> ComputePipelineId {
|
||||
self.compute_pipelines.process()
|
||||
}
|
||||
|
||||
pub fn free_compute_pipeline_id(&self, id: ComputePipelineId) {
|
||||
pub(crate) fn free_compute_pipeline_id(&self, id: ComputePipelineId) {
|
||||
self.compute_pipelines.free(id);
|
||||
}
|
||||
|
||||
pub fn create_pipeline_layout_id(&self) -> PipelineLayoutId {
|
||||
pub(crate) fn create_pipeline_layout_id(&self) -> PipelineLayoutId {
|
||||
self.pipeline_layouts.process()
|
||||
}
|
||||
|
||||
pub fn free_pipeline_layout_id(&self, id: PipelineLayoutId) {
|
||||
pub(crate) fn free_pipeline_layout_id(&self, id: PipelineLayoutId) {
|
||||
self.pipeline_layouts.free(id);
|
||||
}
|
||||
|
||||
pub fn create_shader_module_id(&self) -> ShaderModuleId {
|
||||
pub(crate) fn create_shader_module_id(&self) -> ShaderModuleId {
|
||||
self.shader_modules.process()
|
||||
}
|
||||
|
||||
pub fn free_shader_module_id(&self, id: ShaderModuleId) {
|
||||
pub(crate) fn free_shader_module_id(&self, id: ShaderModuleId) {
|
||||
self.shader_modules.free(id);
|
||||
}
|
||||
|
||||
pub fn create_command_encoder_id(&self) -> CommandEncoderId {
|
||||
pub(crate) fn create_command_encoder_id(&self) -> CommandEncoderId {
|
||||
self.command_encoders.process()
|
||||
}
|
||||
|
||||
pub fn free_command_buffer_id(&self, id: CommandEncoderId) {
|
||||
pub(crate) fn free_command_buffer_id(&self, id: CommandEncoderId) {
|
||||
self.command_encoders.free(id);
|
||||
}
|
||||
|
||||
pub fn create_sampler_id(&self) -> SamplerId {
|
||||
pub(crate) fn create_sampler_id(&self) -> SamplerId {
|
||||
self.samplers.process()
|
||||
}
|
||||
|
||||
pub fn free_sampler_id(&self, id: SamplerId) {
|
||||
pub(crate) fn free_sampler_id(&self, id: SamplerId) {
|
||||
self.samplers.free(id);
|
||||
}
|
||||
|
||||
pub fn create_render_pipeline_id(&self) -> RenderPipelineId {
|
||||
pub(crate) fn create_render_pipeline_id(&self) -> RenderPipelineId {
|
||||
self.render_pipelines.process()
|
||||
}
|
||||
|
||||
pub fn free_render_pipeline_id(&self, id: RenderPipelineId) {
|
||||
pub(crate) fn free_render_pipeline_id(&self, id: RenderPipelineId) {
|
||||
self.render_pipelines.free(id);
|
||||
}
|
||||
|
||||
pub fn create_texture_id(&self) -> TextureId {
|
||||
pub(crate) fn create_texture_id(&self) -> TextureId {
|
||||
self.textures.process()
|
||||
}
|
||||
|
||||
pub fn free_texture_id(&self, id: TextureId) {
|
||||
pub(crate) fn free_texture_id(&self, id: TextureId) {
|
||||
self.textures.free(id);
|
||||
}
|
||||
|
||||
pub fn create_texture_view_id(&self) -> TextureViewId {
|
||||
pub(crate) fn create_texture_view_id(&self) -> TextureViewId {
|
||||
self.texture_views.process()
|
||||
}
|
||||
|
||||
pub fn free_texture_view_id(&self, id: TextureViewId) {
|
||||
pub(crate) fn free_texture_view_id(&self, id: TextureViewId) {
|
||||
self.texture_views.free(id);
|
||||
}
|
||||
|
||||
pub fn create_render_bundle_id(&self) -> RenderBundleId {
|
||||
pub(crate) fn create_render_bundle_id(&self) -> RenderBundleId {
|
||||
self.render_bundles.process()
|
||||
}
|
||||
|
||||
pub fn free_render_bundle_id(&self, id: RenderBundleId) {
|
||||
pub(crate) fn free_render_bundle_id(&self, id: RenderBundleId) {
|
||||
self.render_bundles.free(id);
|
||||
}
|
||||
|
||||
pub fn create_compute_pass_id(&self) -> ComputePassId {
|
||||
pub(crate) fn create_compute_pass_id(&self) -> ComputePassId {
|
||||
self.compute_passes.process()
|
||||
}
|
||||
|
||||
pub fn free_compute_pass_id(&self, id: ComputePassId) {
|
||||
pub(crate) fn free_compute_pass_id(&self, id: ComputePassId) {
|
||||
self.compute_passes.free(id);
|
||||
}
|
||||
|
||||
pub fn create_render_pass_id(&self) -> RenderPassId {
|
||||
pub(crate) fn create_render_pass_id(&self) -> RenderPassId {
|
||||
self.render_passes.process()
|
||||
}
|
||||
|
||||
pub fn free_render_pass_id(&self, id: RenderPassId) {
|
||||
pub(crate) fn free_render_pass_id(&self, id: RenderPassId) {
|
||||
self.render_passes.free(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,44 +2,46 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub mod gpu;
|
||||
pub mod gpuadapter;
|
||||
pub mod gpuadapterinfo;
|
||||
pub mod gpubindgroup;
|
||||
pub mod gpubindgrouplayout;
|
||||
pub mod gpubuffer;
|
||||
pub mod gpubufferusage;
|
||||
pub mod gpucanvascontext;
|
||||
pub mod gpucolorwrite;
|
||||
pub mod gpucommandbuffer;
|
||||
pub mod gpucommandencoder;
|
||||
pub mod gpucompilationinfo;
|
||||
pub mod gpucompilationmessage;
|
||||
pub mod gpucomputepassencoder;
|
||||
pub mod gpucomputepipeline;
|
||||
pub mod gpuconvert;
|
||||
pub mod gpudevice;
|
||||
pub mod gpudevicelostinfo;
|
||||
pub mod gpuerror;
|
||||
pub mod gpuinternalerror;
|
||||
pub mod gpumapmode;
|
||||
pub mod gpuoutofmemoryerror;
|
||||
pub mod gpupipelineerror;
|
||||
pub mod gpupipelinelayout;
|
||||
pub mod gpuqueryset;
|
||||
pub mod gpuqueue;
|
||||
pub mod gpurenderbundle;
|
||||
pub mod gpurenderbundleencoder;
|
||||
pub mod gpurenderpassencoder;
|
||||
pub mod gpurenderpipeline;
|
||||
pub mod gpusampler;
|
||||
pub mod gpushadermodule;
|
||||
pub mod gpushaderstage;
|
||||
pub mod gpusupportedfeatures;
|
||||
pub mod gpusupportedlimits;
|
||||
pub mod gputexture;
|
||||
pub mod gputextureusage;
|
||||
pub mod gputextureview;
|
||||
pub mod gpuuncapturederrorevent;
|
||||
pub mod gpuvalidationerror;
|
||||
pub mod identityhub;
|
||||
pub(crate) mod gpu;
|
||||
pub(crate) mod gpuadapter;
|
||||
pub(crate) mod gpuadapterinfo;
|
||||
pub(crate) mod gpubindgroup;
|
||||
pub(crate) mod gpubindgrouplayout;
|
||||
pub(crate) mod gpubuffer;
|
||||
pub(crate) mod gpubufferusage;
|
||||
pub(crate) mod gpucanvascontext;
|
||||
pub(crate) mod gpucolorwrite;
|
||||
pub(crate) mod gpucommandbuffer;
|
||||
pub(crate) mod gpucommandencoder;
|
||||
pub(crate) mod gpucompilationinfo;
|
||||
pub(crate) mod gpucompilationmessage;
|
||||
pub(crate) mod gpucomputepassencoder;
|
||||
pub(crate) mod gpucomputepipeline;
|
||||
pub(crate) mod gpuconvert;
|
||||
pub(crate) mod gpudevice;
|
||||
pub(crate) mod gpudevicelostinfo;
|
||||
pub(crate) mod gpuerror;
|
||||
pub(crate) mod gpuinternalerror;
|
||||
pub(crate) mod gpumapmode;
|
||||
pub(crate) mod gpuoutofmemoryerror;
|
||||
pub(crate) mod gpupipelineerror;
|
||||
#[allow(dead_code)]
|
||||
pub(crate) mod gpupipelinelayout;
|
||||
pub(crate) mod gpuqueryset;
|
||||
pub(crate) mod gpuqueue;
|
||||
pub(crate) mod gpurenderbundle;
|
||||
pub(crate) mod gpurenderbundleencoder;
|
||||
pub(crate) mod gpurenderpassencoder;
|
||||
pub(crate) mod gpurenderpipeline;
|
||||
pub(crate) mod gpusampler;
|
||||
pub(crate) mod gpushadermodule;
|
||||
pub(crate) mod gpushaderstage;
|
||||
pub(crate) mod gpusupportedfeatures;
|
||||
pub(crate) mod gpusupportedlimits;
|
||||
pub(crate) mod gputexture;
|
||||
pub(crate) mod gputextureusage;
|
||||
pub(crate) mod gputextureview;
|
||||
pub(crate) mod gpuuncapturederrorevent;
|
||||
pub(crate) mod gpuvalidationerror;
|
||||
#[allow(dead_code)]
|
||||
pub(crate) mod identityhub;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue