Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
!packages/webgpu/scripts/build
# Yarn
.package/.yarn/*
.yarn/*
Expand Down Expand Up @@ -65,11 +64,6 @@ package/lib


# Externals
packages/webgpu/libs
packages/webgpu/cpp/dawn/
packages/webgpu/cpp/webgpu/
packages/webgpu/lib
!packages/webgpu/scripts/build
artifacts/


Expand Down
9 changes: 5 additions & 4 deletions packages/webgpu/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
!scripts/build
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json
Expand Down Expand Up @@ -71,3 +67,8 @@ android/keystores/debug.keystore

# generated by bob
lib/

libs/
cpp/dawn/
cpp/webgpu/
scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,27 @@ public WebGPUAHBView(Context context, WebGPUAPI api) {
mApi = api;
}

private ImageReader createReader() {
ImageReader reader = ImageReader.newInstance(getWidth(), getHeight(), PixelFormat.RGBA_8888, 2, HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE |
private static ImageReader createReader(int width, int height, ImageReader.OnImageAvailableListener listener) {
ImageReader reader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, 2, HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE |
HardwareBuffer.USAGE_GPU_COLOR_OUTPUT);
reader.setOnImageAvailableListener(this, null);
reader.setOnImageAvailableListener(listener, null);
return reader;
}

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);

if (mReader == null) {
mReader = createReader();
mApi.surfaceCreated(mReader.getSurface());
} else {
mApi.surfaceChanged(mReader.getSurface());
int width = getWidth();
int height = getHeight();

if (width == 0 || height == 0) return;

mReader = WebGPUAHBView.createReader(width, height, this);
}

mApi.surfaceChanged(mReader.getSurface());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public void setContextId(int contextId) {
}

public void setTransparent(boolean value) {
Context ctx = getContext();
if (value != mTransparent || mView == null) {
if (mView != null) {
removeView(mView);
}
Context ctx = getContext();
mTransparent = value;
if (mTransparent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Expand Down
Loading