Skip to content

Commit c8d0da6

Browse files
bors[bot]kvark
andauthored
Merge #357
357: Explicit Global hubs r=grovesNL a=kvark Fixes #354 Co-authored-by: Dzmitry Malyshau <[email protected]>
2 parents ae5a78f + 5099754 commit c8d0da6

22 files changed

+730
-478
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ before_install:
5858
script:
5959
- cargo test
6060
# TODO: enable GL backend
61-
#- (cd wgpu-native && cargo check --features local,glutin)
61+
- (cd wgpu-native && cargo check --features local)
6262
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then (cd wgpu-native && cargo check --features gfx-backend-vulkan); fi
6363
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then cargo check --release; fi
6464
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]]; then cargo +nightly install cbindgen; fi

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ clear:
4444
$(CLEAN_FFI_DIR)
4545

4646
lib-native: Cargo.lock wgpu-native/Cargo.toml $(WILDCARD_WGPU_NATIVE)
47-
cargo build --manifest-path wgpu-native/Cargo.toml
47+
cargo build --manifest-path wgpu-native/Cargo.toml --features local
4848

4949
lib-remote: Cargo.lock wgpu-remote/Cargo.toml $(WILDCARD_WGPU_NATIVE_AND_REMOTE)
5050
cargo build --manifest-path wgpu-remote/Cargo.toml

ffi/wgpu.h

+102-22
Original file line numberDiff line numberDiff line change
@@ -665,257 +665,337 @@ typedef struct {
665665
uint32_t array_layer_count;
666666
} WGPUTextureViewDescriptor;
667667

668-
#if !defined(WGPU_REMOTE)
668+
#if defined(WGPU_LOCAL)
669669
WGPUDeviceId wgpu_adapter_request_device(WGPUAdapterId adapter_id,
670670
const WGPUDeviceDescriptor *desc);
671671
#endif
672672

673+
#if defined(WGPU_LOCAL)
673674
void wgpu_bind_group_destroy(WGPUBindGroupId bind_group_id);
675+
#endif
674676

677+
#if defined(WGPU_LOCAL)
675678
void wgpu_buffer_destroy(WGPUBufferId buffer_id);
679+
#endif
676680

681+
#if defined(WGPU_LOCAL)
677682
void wgpu_buffer_map_read_async(WGPUBufferId buffer_id,
678683
WGPUBufferAddress start,
679684
WGPUBufferAddress size,
680685
WGPUBufferMapReadCallback callback,
681686
uint8_t *userdata);
687+
#endif
682688

689+
#if defined(WGPU_LOCAL)
683690
void wgpu_buffer_map_write_async(WGPUBufferId buffer_id,
684691
WGPUBufferAddress start,
685692
WGPUBufferAddress size,
686693
WGPUBufferMapWriteCallback callback,
687694
uint8_t *userdata);
695+
#endif
688696

697+
#if defined(WGPU_LOCAL)
689698
void wgpu_buffer_unmap(WGPUBufferId buffer_id);
699+
#endif
690700

691-
#if !defined(WGPU_REMOTE)
701+
#if defined(WGPU_LOCAL)
692702
WGPUComputePassId wgpu_command_encoder_begin_compute_pass(WGPUCommandEncoderId encoder_id,
693703
const WGPUComputePassDescriptor *desc);
694704
#endif
695705

696-
#if !defined(WGPU_REMOTE)
706+
#if defined(WGPU_LOCAL)
697707
WGPURenderPassId wgpu_command_encoder_begin_render_pass(WGPUCommandEncoderId encoder_id,
698708
const WGPURenderPassDescriptor *desc);
699709
#endif
700710

711+
#if defined(WGPU_LOCAL)
701712
void wgpu_command_encoder_copy_buffer_to_buffer(WGPUCommandEncoderId command_encoder_id,
702713
WGPUBufferId source,
703714
WGPUBufferAddress source_offset,
704715
WGPUBufferId destination,
705716
WGPUBufferAddress destination_offset,
706717
WGPUBufferAddress size);
718+
#endif
707719

720+
#if defined(WGPU_LOCAL)
708721
void wgpu_command_encoder_copy_buffer_to_texture(WGPUCommandEncoderId command_encoder_id,
709722
const WGPUBufferCopyView *source,
710723
const WGPUTextureCopyView *destination,
711724
WGPUExtent3d copy_size);
725+
#endif
712726

727+
#if defined(WGPU_LOCAL)
713728
void wgpu_command_encoder_copy_texture_to_buffer(WGPUCommandEncoderId command_encoder_id,
714729
const WGPUTextureCopyView *source,
715730
const WGPUBufferCopyView *destination,
716731
WGPUExtent3d copy_size);
732+
#endif
717733

734+
#if defined(WGPU_LOCAL)
718735
void wgpu_command_encoder_copy_texture_to_texture(WGPUCommandEncoderId command_encoder_id,
719736
const WGPUTextureCopyView *source,
720737
const WGPUTextureCopyView *destination,
721738
WGPUExtent3d copy_size);
739+
#endif
722740

741+
#if defined(WGPU_LOCAL)
723742
WGPUCommandBufferId wgpu_command_encoder_finish(WGPUCommandEncoderId encoder_id,
724743
const WGPUCommandBufferDescriptor *desc);
744+
#endif
725745

746+
#if defined(WGPU_LOCAL)
726747
void wgpu_compute_pass_dispatch(WGPUComputePassId pass_id, uint32_t x, uint32_t y, uint32_t z);
748+
#endif
727749

750+
#if defined(WGPU_LOCAL)
728751
void wgpu_compute_pass_dispatch_indirect(WGPUComputePassId pass_id,
729752
WGPUBufferId indirect_buffer_id,
730753
WGPUBufferAddress indirect_offset);
754+
#endif
731755

756+
#if defined(WGPU_LOCAL)
732757
void wgpu_compute_pass_end_pass(WGPUComputePassId pass_id);
758+
#endif
733759

734760
void wgpu_compute_pass_insert_debug_marker(WGPUComputePassId _pass_id, WGPURawString _label);
735761

736762
void wgpu_compute_pass_pop_debug_group(WGPUComputePassId _pass_id);
737763

738764
void wgpu_compute_pass_push_debug_group(WGPUComputePassId _pass_id, WGPURawString _label);
739765

766+
#if defined(WGPU_LOCAL)
740767
void wgpu_compute_pass_set_bind_group(WGPUComputePassId pass_id,
741768
uint32_t index,
742769
WGPUBindGroupId bind_group_id,
743770
const WGPUBufferAddress *offsets,
744771
uintptr_t offsets_length);
772+
#endif
745773

774+
#if defined(WGPU_LOCAL)
746775
void wgpu_compute_pass_set_pipeline(WGPUComputePassId pass_id, WGPUComputePipelineId pipeline_id);
776+
#endif
747777

748-
#if !defined(WGPU_REMOTE)
778+
#if defined(WGPU_LOCAL)
749779
WGPUSurfaceId wgpu_create_surface_from_metal_layer(void *layer);
750780
#endif
751781

752-
#if !defined(WGPU_REMOTE)
782+
#if defined(WGPU_LOCAL)
753783
WGPUSurfaceId wgpu_create_surface_from_windows_hwnd(void *_hinstance, void *hwnd);
754784
#endif
755785

756-
#if !defined(WGPU_REMOTE)
786+
#if defined(WGPU_LOCAL)
757787
WGPUSurfaceId wgpu_create_surface_from_xlib(const void **display, uint64_t window);
758788
#endif
759789

760-
#if !defined(WGPU_REMOTE)
790+
#if defined(WGPU_LOCAL)
761791
WGPUBindGroupId wgpu_device_create_bind_group(WGPUDeviceId device_id,
762792
const WGPUBindGroupDescriptor *desc);
763793
#endif
764794

765-
#if !defined(WGPU_REMOTE)
795+
#if defined(WGPU_LOCAL)
766796
WGPUBindGroupLayoutId wgpu_device_create_bind_group_layout(WGPUDeviceId device_id,
767797
const WGPUBindGroupLayoutDescriptor *desc);
768798
#endif
769799

770-
#if !defined(WGPU_REMOTE)
800+
#if defined(WGPU_LOCAL)
771801
WGPUBufferId wgpu_device_create_buffer(WGPUDeviceId device_id, const WGPUBufferDescriptor *desc);
772802
#endif
773803

774-
#if !defined(WGPU_REMOTE)
804+
#if defined(WGPU_LOCAL)
775805
WGPUBufferId wgpu_device_create_buffer_mapped(WGPUDeviceId device_id,
776806
const WGPUBufferDescriptor *desc,
777807
uint8_t **mapped_ptr_out);
778808
#endif
779809

780-
#if !defined(WGPU_REMOTE)
810+
#if defined(WGPU_LOCAL)
781811
WGPUCommandEncoderId wgpu_device_create_command_encoder(WGPUDeviceId device_id,
782812
const WGPUCommandEncoderDescriptor *desc);
783813
#endif
784814

785-
#if !defined(WGPU_REMOTE)
815+
#if defined(WGPU_LOCAL)
786816
WGPUComputePipelineId wgpu_device_create_compute_pipeline(WGPUDeviceId device_id,
787817
const WGPUComputePipelineDescriptor *desc);
788818
#endif
789819

790-
#if !defined(WGPU_REMOTE)
820+
#if defined(WGPU_LOCAL)
791821
WGPUPipelineLayoutId wgpu_device_create_pipeline_layout(WGPUDeviceId device_id,
792822
const WGPUPipelineLayoutDescriptor *desc);
793823
#endif
794824

795-
#if !defined(WGPU_REMOTE)
825+
#if defined(WGPU_LOCAL)
796826
WGPURenderPipelineId wgpu_device_create_render_pipeline(WGPUDeviceId device_id,
797827
const WGPURenderPipelineDescriptor *desc);
798828
#endif
799829

800-
#if !defined(WGPU_REMOTE)
830+
#if defined(WGPU_LOCAL)
801831
WGPUSamplerId wgpu_device_create_sampler(WGPUDeviceId device_id, const WGPUSamplerDescriptor *desc);
802832
#endif
803833

804-
#if !defined(WGPU_REMOTE)
834+
#if defined(WGPU_LOCAL)
805835
WGPUShaderModuleId wgpu_device_create_shader_module(WGPUDeviceId device_id,
806836
const WGPUShaderModuleDescriptor *desc);
807837
#endif
808838

809-
#if !defined(WGPU_REMOTE)
839+
#if defined(WGPU_LOCAL)
810840
WGPUSwapChainId wgpu_device_create_swap_chain(WGPUDeviceId device_id,
811841
WGPUSurfaceId surface_id,
812842
const WGPUSwapChainDescriptor *desc);
813843
#endif
814844

815-
#if !defined(WGPU_REMOTE)
845+
#if defined(WGPU_LOCAL)
816846
WGPUTextureId wgpu_device_create_texture(WGPUDeviceId device_id, const WGPUTextureDescriptor *desc);
817847
#endif
818848

849+
#if defined(WGPU_LOCAL)
819850
void wgpu_device_destroy(WGPUDeviceId device_id);
851+
#endif
820852

821-
#if !defined(WGPU_REMOTE)
853+
#if defined(WGPU_LOCAL)
822854
void wgpu_device_get_limits(WGPUDeviceId _device_id, WGPULimits *limits);
823855
#endif
824856

857+
#if defined(WGPU_LOCAL)
825858
WGPUQueueId wgpu_device_get_queue(WGPUDeviceId device_id);
859+
#endif
826860

861+
#if defined(WGPU_LOCAL)
827862
void wgpu_device_poll(WGPUDeviceId device_id, bool force_wait);
863+
#endif
828864

865+
#if defined(WGPU_LOCAL)
829866
void wgpu_queue_submit(WGPUQueueId queue_id,
830867
const WGPUCommandBufferId *command_buffers,
831868
uintptr_t command_buffers_length);
869+
#endif
832870

871+
#if defined(WGPU_LOCAL)
833872
void wgpu_render_pass_draw(WGPURenderPassId pass_id,
834873
uint32_t vertex_count,
835874
uint32_t instance_count,
836875
uint32_t first_vertex,
837876
uint32_t first_instance);
877+
#endif
838878

879+
#if defined(WGPU_LOCAL)
839880
void wgpu_render_pass_draw_indexed(WGPURenderPassId pass_id,
840881
uint32_t index_count,
841882
uint32_t instance_count,
842883
uint32_t first_index,
843884
int32_t base_vertex,
844885
uint32_t first_instance);
886+
#endif
845887

888+
#if defined(WGPU_LOCAL)
846889
void wgpu_render_pass_draw_indexed_indirect(WGPURenderPassId pass_id,
847890
WGPUBufferId indirect_buffer_id,
848891
WGPUBufferAddress indirect_offset);
892+
#endif
849893

894+
#if defined(WGPU_LOCAL)
850895
void wgpu_render_pass_draw_indirect(WGPURenderPassId pass_id,
851896
WGPUBufferId indirect_buffer_id,
852897
WGPUBufferAddress indirect_offset);
898+
#endif
853899

900+
#if defined(WGPU_LOCAL)
854901
void wgpu_render_pass_end_pass(WGPURenderPassId pass_id);
902+
#endif
855903

904+
#if defined(WGPU_LOCAL)
856905
void wgpu_render_pass_execute_bundles(WGPURenderPassId _pass_id,
857906
const WGPURenderBundleId *_bundles,
858907
uintptr_t _bundles_length);
908+
#endif
859909

910+
#if defined(WGPU_LOCAL)
860911
void wgpu_render_pass_insert_debug_marker(WGPURenderPassId _pass_id, WGPURawString _label);
912+
#endif
861913

914+
#if defined(WGPU_LOCAL)
862915
void wgpu_render_pass_pop_debug_group(WGPURenderPassId _pass_id);
916+
#endif
863917

918+
#if defined(WGPU_LOCAL)
864919
void wgpu_render_pass_push_debug_group(WGPURenderPassId _pass_id, WGPURawString _label);
920+
#endif
865921

922+
#if defined(WGPU_LOCAL)
866923
void wgpu_render_pass_set_bind_group(WGPURenderPassId pass_id,
867924
uint32_t index,
868925
WGPUBindGroupId bind_group_id,
869926
const WGPUBufferAddress *offsets,
870927
uintptr_t offsets_length);
928+
#endif
871929

930+
#if defined(WGPU_LOCAL)
872931
void wgpu_render_pass_set_blend_color(WGPURenderPassId pass_id, const WGPUColor *color);
932+
#endif
873933

934+
#if defined(WGPU_LOCAL)
874935
void wgpu_render_pass_set_index_buffer(WGPURenderPassId pass_id,
875936
WGPUBufferId buffer_id,
876937
WGPUBufferAddress offset);
938+
#endif
877939

940+
#if defined(WGPU_LOCAL)
878941
void wgpu_render_pass_set_pipeline(WGPURenderPassId pass_id, WGPURenderPipelineId pipeline_id);
942+
#endif
879943

944+
#if defined(WGPU_LOCAL)
880945
void wgpu_render_pass_set_scissor_rect(WGPURenderPassId pass_id,
881946
uint32_t x,
882947
uint32_t y,
883948
uint32_t w,
884949
uint32_t h);
950+
#endif
885951

952+
#if defined(WGPU_LOCAL)
886953
void wgpu_render_pass_set_stencil_reference(WGPURenderPassId pass_id, uint32_t value);
954+
#endif
887955

956+
#if defined(WGPU_LOCAL)
888957
void wgpu_render_pass_set_vertex_buffers(WGPURenderPassId pass_id,
889958
uint32_t start_slot,
890959
const WGPUBufferId *buffers,
891960
const WGPUBufferAddress *offsets,
892961
uintptr_t length);
962+
#endif
893963

964+
#if defined(WGPU_LOCAL)
894965
void wgpu_render_pass_set_viewport(WGPURenderPassId pass_id,
895966
float x,
896967
float y,
897968
float w,
898969
float h,
899970
float min_depth,
900971
float max_depth);
972+
#endif
901973

902-
#if !defined(WGPU_REMOTE)
974+
#if defined(WGPU_LOCAL)
903975
WGPUAdapterId wgpu_request_adapter(const WGPURequestAdapterOptions *desc);
904976
#endif
905977

978+
#if defined(WGPU_LOCAL)
906979
void wgpu_sampler_destroy(WGPUSamplerId sampler_id);
980+
#endif
907981

908-
#if !defined(WGPU_REMOTE)
982+
#if defined(WGPU_LOCAL)
909983
WGPUSwapChainOutput wgpu_swap_chain_get_next_texture(WGPUSwapChainId swap_chain_id);
910984
#endif
911985

986+
#if defined(WGPU_LOCAL)
912987
void wgpu_swap_chain_present(WGPUSwapChainId swap_chain_id);
988+
#endif
913989

914-
#if !defined(WGPU_REMOTE)
990+
#if defined(WGPU_LOCAL)
915991
WGPUTextureViewId wgpu_texture_create_view(WGPUTextureId texture_id,
916992
const WGPUTextureViewDescriptor *desc);
917993
#endif
918994

995+
#if defined(WGPU_LOCAL)
919996
void wgpu_texture_destroy(WGPUTextureId texture_id);
997+
#endif
920998

999+
#if defined(WGPU_LOCAL)
9211000
void wgpu_texture_view_destroy(WGPUTextureViewId texture_view_id);
1001+
#endif

wgpu-native/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ crate-type = ["lib", "cdylib", "staticlib"]
1717

1818
[features]
1919
default = []
20-
remote = ["serde"]
20+
local = ["lazy_static"]
2121
metal-auto-capture = ["gfx-backend-metal/auto-capture"]
2222
#NOTE: glutin feature is not stable, use at your own risk
2323
#glutin = ["gfx-backend-gl/glutin"]
@@ -26,7 +26,7 @@ metal-auto-capture = ["gfx-backend-metal/auto-capture"]
2626
arrayvec = "0.5"
2727
bitflags = "1.0"
2828
copyless = "0.1"
29-
lazy_static = "1.1.0"
29+
lazy_static = { version = "1.1.0", optional = true }
3030
log = "0.4"
3131
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
3232
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }

0 commit comments

Comments
 (0)