Skip to content

Commit

Permalink
Fix linux surface creation; update copyright year; update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed May 25, 2022
1 parent d2204d7 commit fe63db6
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 14 deletions.
2 changes: 1 addition & 1 deletion COPYING.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Boost Software License - Version 1.0 - August 17th, 2003

Copyright (c) 2019-2021 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Dynamic binding to [gfx-rs/wgpu-native](https://github.com/gfx-rs/wgpu-native) b
Usage:
```
"dependencies": {
"bindbc-wgpu": "0.11.0"
"bindbc-wgpu": "0.12.0"
}
```

Expand Down
40 changes: 36 additions & 4 deletions demo/main.d
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
/*
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
module main;

import core.stdc.stdlib;
Expand Down Expand Up @@ -306,10 +333,10 @@ WGPUSurface createSurface(SDL_SysWMinfo wmInfo)
{
auto x11_display = wmInfo.info.x11.display;
auto x11_window = wmInfo.info.x11.window;
WGPUSurfaceDescriptorFromXlib sfdX11 = {
WGPUSurfaceDescriptorFromXlibWindow sfdX11 = {
chain: {
next: null,
sType: WGPUSType.SurfaceDescriptorFromXlib
sType: WGPUSType.SurfaceDescriptorFromXlibWindow
},
display: x11_display,
window: x11_window
Expand All @@ -320,6 +347,11 @@ WGPUSurface createSurface(SDL_SysWMinfo wmInfo)
};
surface = wgpuInstanceCreateSurface(null, &sfd);
}
else if (wmInfo.subsystem == SDL_SYSWM_WAYLAND)
{
// TODO: support Wayland
quit("Unsupported subsystem, sorry");
}
else
{
quit("Unsupported subsystem, sorry");
Expand All @@ -329,14 +361,14 @@ WGPUSurface createSurface(SDL_SysWMinfo wmInfo)
{
// Needs test!
SDL_Renderer* renderer = SDL_CreateRenderer(window.sdlWindow, -1, SDL_RENDERER_PRESENTVSYNC);
auto m_layer = SDL_RenderGetMetalLayer(renderer);
auto metalLayer = SDL_RenderGetMetalLayer(renderer);

WGPUSurfaceDescriptorFromMetalLayer sfdMetal = {
chain: {
next: null,
sType: WGPUSType.SurfaceDescriptorFromMetalLayer
},
layer: m_layer
layer: metalLayer
};
WGPUSurfaceDescriptor sfd = {
label: null,
Expand Down
5 changes: 1 addition & 4 deletions src/bindbc/wgpu/funcs.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019-2021 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Expand Down Expand Up @@ -99,9 +99,6 @@ __gshared
alias da_wgpuCommandEncoderCopyTextureToTexture = void function(WGPUCommandEncoder commandEncoder, const(WGPUImageCopyTexture)* source, const(WGPUImageCopyTexture)* destination, const(WGPUExtent3D)* copySize);
da_wgpuCommandEncoderCopyTextureToTexture wgpuCommandEncoderCopyTextureToTexture;

//alias da_wgpuCommandEncoderFillBuffer = void function(WGPUCommandEncoder commandEncoder, WGPUBuffer destination, ulong destinationOffset, ulong size, ubyte value);
//da_wgpuCommandEncoderFillBuffer wgpuCommandEncoderFillBuffer;

alias da_wgpuCommandEncoderFinish = WGPUCommandBuffer function(WGPUCommandEncoder commandEncoder, const(WGPUCommandBufferDescriptor)* descriptor);
da_wgpuCommandEncoderFinish wgpuCommandEncoderFinish;

Expand Down
2 changes: 1 addition & 1 deletion src/bindbc/wgpu/loader.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019-2021 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Expand Down
2 changes: 1 addition & 1 deletion src/bindbc/wgpu/package.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019-2020 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Expand Down
2 changes: 1 addition & 1 deletion src/bindbc/wgpu/types.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019-2021 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Expand Down
2 changes: 1 addition & 1 deletion src/bindbc/wgpu/types2.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019-2021 Timur Gafarov.
Copyright (c) 2019-2022 Timur Gafarov.
Boost Software License - Version 1.0 - August 17th, 2003
Expand Down

0 comments on commit fe63db6

Please sign in to comment.