Skip to content

Commit

Permalink
Add option for gles3 minor version in instance extras (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel authored Sep 30, 2023
1 parent baaee05 commit 064624c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 18 deletions.
43 changes: 32 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,40 @@ trace = ["wgc/trace"]
[dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "21098cdaceee49c22a7e3a9648ce019b4e74beec"
rev = "9a76c483da4891fb7046c579e36d7c54bdb0b251"
version = "0.17"
features = ["raw-window-handle", "gles"]

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "21098cdaceee49c22a7e3a9648ce019b4e74beec"
rev = "9a76c483da4891fb7046c579e36d7c54bdb0b251"
version = "0.17"
features = ["metal"]

[target.'cfg(windows)'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "21098cdaceee49c22a7e3a9648ce019b4e74beec"
rev = "9a76c483da4891fb7046c579e36d7c54bdb0b251"
version = "0.17"
features = ["dx11", "dx12"]

[target.'cfg(any(windows, all(unix, not(target_arch = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "21098cdaceee49c22a7e3a9648ce019b4e74beec"
rev = "9a76c483da4891fb7046c579e36d7c54bdb0b251"
version = "0.17"
features = ["vulkan"]

[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "21098cdaceee49c22a7e3a9648ce019b4e74beec"
rev = "9a76c483da4891fb7046c579e36d7c54bdb0b251"
version = "0.17"

[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "bac2d82a430fbfcf100ee22b7c3bc12f3d593079"
rev = "df8107b7"
version = "0.13.0"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion ffi/webgpu-headers
Submodule webgpu-headers updated 1 files
+13 −26 webgpu.h
9 changes: 9 additions & 0 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,19 @@ typedef enum WGPUDx12Compiler {
WGPUDx12Compiler_Force32 = 0x7FFFFFFF
} WGPUDx12Compiler;

typedef enum WGPUGles3MinorVersion {
WGPUGles3MinorVersion_Automatic = 0x00000000,
WGPUGles3MinorVersion_Version0 = 0x00000001,
WGPUGles3MinorVersion_Version1 = 0x00000002,
WGPUGles3MinorVersion_Version2 = 0x00000003,
WGPUGles3MinorVersion_Force32 = 0x7FFFFFFF
} WGPUGles3MinorVersion;

typedef struct WGPUInstanceExtras {
WGPUChainedStruct chain;
WGPUInstanceBackendFlags backends;
WGPUDx12Compiler dx12ShaderCompiler;
WGPUGles3MinorVersion gles3MinorVersion;
const char * dxilPath;
const char * dxcPath;
} WGPUInstanceExtras;
Expand Down
13 changes: 13 additions & 0 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ map_enum!(
Inherit: Inherit
);

map_enum!(
map_gles3_minor_version,
WGPUGles3MinorVersion,
wgt::Gles3MinorVersion,
"Unknown gles3 minor version",
Automatic,
Version0,
Version1,
Version2
);

pub const WGPU_WHOLE_SIZE: ::std::os::raw::c_ulonglong = native::WGPU_WHOLE_SIZE as _;
pub const WGPU_LIMIT_U64_UNDEFINED: ::std::os::raw::c_ulonglong =
native::WGPU_LIMIT_U64_UNDEFINED as _;
Expand Down Expand Up @@ -275,6 +286,8 @@ pub fn map_instance_descriptor(
wgt::InstanceDescriptor {
backends: map_instance_backend_flags(extras.backends as native::WGPUInstanceBackend),
dx12_shader_compiler,
gles_minor_version: map_gles3_minor_version(extras.gles3MinorVersion),

}
} else {
wgt::InstanceDescriptor::default()
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ pub unsafe extern "C" fn wgpuCommandEncoderBeginComputePass(
let desc = match descriptor {
Some(descriptor) => wgc::command::ComputePassDescriptor {
label: ptr_into_label(descriptor.label),
timestamp_writes: None,
},
None => wgc::command::ComputePassDescriptor::default(),
};
Expand Down Expand Up @@ -1069,6 +1070,8 @@ pub unsafe extern "C" fn wgpuCommandEncoderBeginRenderPass(
.collect(),
),
depth_stencil_attachment: depth_stencil_attachment.as_ref(),
timestamp_writes: None,
occlusion_query_set: None,
};

Arc::into_raw(Arc::new(WGPURenderPassEncoderImpl {
Expand Down

0 comments on commit 064624c

Please sign in to comment.