mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
Add Device::Tick for periodic work
This commit is contained in:
parent
b947993e1a
commit
dbb5729e64
@ -205,6 +205,8 @@ namespace wire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* HandleCommands(const uint8_t* commands, size_t size) override {
|
const uint8_t* HandleCommands(const uint8_t* commands, size_t size) override {
|
||||||
|
procs.deviceTick(knownDevice.Get(1)->handle);
|
||||||
|
|
||||||
while (size > sizeof(WireCmd)) {
|
while (size > sizeof(WireCmd)) {
|
||||||
WireCmd cmdId = *reinterpret_cast<const WireCmd*>(commands);
|
WireCmd cmdId = *reinterpret_cast<const WireCmd*>(commands);
|
||||||
|
|
||||||
|
@ -461,6 +461,9 @@
|
|||||||
"name": "create texture builder",
|
"name": "create texture builder",
|
||||||
"returns": "texture builder"
|
"returns": "texture builder"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "tick"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "copy bind groups",
|
"name": "copy bind groups",
|
||||||
"args": [
|
"args": [
|
||||||
|
@ -130,6 +130,10 @@ namespace backend {
|
|||||||
return new TextureBuilder(this);
|
return new TextureBuilder(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceBase::Tick() {
|
||||||
|
TickImpl();
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceBase::CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target) {
|
void DeviceBase::CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target) {
|
||||||
// TODO(cwallez@chromium.org): update state tracking then call the backend
|
// TODO(cwallez@chromium.org): update state tracking then call the backend
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ namespace backend {
|
|||||||
~DeviceBase();
|
~DeviceBase();
|
||||||
|
|
||||||
void HandleError(const char* message);
|
void HandleError(const char* message);
|
||||||
void SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata);
|
|
||||||
|
|
||||||
// Used by autogenerated code, returns itself
|
// Used by autogenerated code, returns itself
|
||||||
DeviceBase* GetDevice();
|
DeviceBase* GetDevice();
|
||||||
@ -52,6 +51,8 @@ namespace backend {
|
|||||||
virtual TextureBase* CreateTexture(TextureBuilder* builder) = 0;
|
virtual TextureBase* CreateTexture(TextureBuilder* builder) = 0;
|
||||||
virtual TextureViewBase* CreateTextureView(TextureViewBuilder* builder) = 0;
|
virtual TextureViewBase* CreateTextureView(TextureViewBuilder* builder) = 0;
|
||||||
|
|
||||||
|
virtual void TickImpl() = 0;
|
||||||
|
|
||||||
// Many NXT objects are completely immutable once created which means that if two
|
// Many NXT objects are completely immutable once created which means that if two
|
||||||
// builders are given the same arguments, they can return the same object. Reusing
|
// builders are given the same arguments, they can return the same object. Reusing
|
||||||
// objects will help make comparisons between objects by a single pointer comparison.
|
// objects will help make comparisons between objects by a single pointer comparison.
|
||||||
@ -86,7 +87,9 @@ namespace backend {
|
|||||||
ShaderModuleBuilder* CreateShaderModuleBuilder();
|
ShaderModuleBuilder* CreateShaderModuleBuilder();
|
||||||
TextureBuilder* CreateTextureBuilder();
|
TextureBuilder* CreateTextureBuilder();
|
||||||
|
|
||||||
|
void Tick();
|
||||||
void CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target);
|
void CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target);
|
||||||
|
void SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The object caches aren't exposed in the header as they would require a lot of
|
// The object caches aren't exposed in the header as they would require a lot of
|
||||||
|
@ -99,7 +99,7 @@ namespace d3d12 {
|
|||||||
this->renderTargetDescriptor = renderTargetDescriptor;
|
this->renderTargetDescriptor = renderTargetDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::Tick() {
|
void Device::TickImpl() {
|
||||||
// Execute any pending commands
|
// Execute any pending commands
|
||||||
ASSERT_SUCCESS(pendingCommandList->Close());
|
ASSERT_SUCCESS(pendingCommandList->Close());
|
||||||
ID3D12CommandList* commandLists[] = { pendingCommandList.Get() };
|
ID3D12CommandList* commandLists[] = { pendingCommandList.Get() };
|
||||||
|
@ -105,6 +105,8 @@ namespace d3d12 {
|
|||||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||||
|
|
||||||
|
void TickImpl() override;
|
||||||
|
|
||||||
ComPtr<ID3D12Device> GetD3D12Device();
|
ComPtr<ID3D12Device> GetD3D12Device();
|
||||||
ComPtr<ID3D12CommandQueue> GetCommandQueue();
|
ComPtr<ID3D12CommandQueue> GetCommandQueue();
|
||||||
ComPtr<ID3D12CommandAllocator> GetPendingCommandAllocator();
|
ComPtr<ID3D12CommandAllocator> GetPendingCommandAllocator();
|
||||||
@ -114,7 +116,6 @@ namespace d3d12 {
|
|||||||
|
|
||||||
void SetNextRenderTargetDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE renderTargetDescriptor);
|
void SetNextRenderTargetDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE renderTargetDescriptor);
|
||||||
|
|
||||||
void Tick();
|
|
||||||
uint64_t GetSerial() const;
|
uint64_t GetSerial() const;
|
||||||
void IncrementSerial();
|
void IncrementSerial();
|
||||||
|
|
||||||
|
@ -114,6 +114,8 @@ namespace metal {
|
|||||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||||
|
|
||||||
|
void TickImpl() override;
|
||||||
|
|
||||||
void SetNextDrawable(id<CAMetalDrawable> drawable);
|
void SetNextDrawable(id<CAMetalDrawable> drawable);
|
||||||
void Present();
|
void Present();
|
||||||
|
|
||||||
|
@ -114,6 +114,9 @@ namespace metal {
|
|||||||
return new TextureView(this, builder);
|
return new TextureView(this, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Device::TickImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
void Device::SetNextDrawable(id<CAMetalDrawable> drawable) {
|
void Device::SetNextDrawable(id<CAMetalDrawable> drawable) {
|
||||||
[currentDrawable release];
|
[currentDrawable release];
|
||||||
currentDrawable = drawable;
|
currentDrawable = drawable;
|
||||||
|
@ -89,6 +89,9 @@ namespace null {
|
|||||||
return new TextureViewBase(builder);
|
return new TextureViewBase(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Device::TickImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
void Device::AddPendingOperation(std::unique_ptr<PendingOperation> operation) {
|
void Device::AddPendingOperation(std::unique_ptr<PendingOperation> operation) {
|
||||||
pendingOperations.emplace_back(std::move(operation));
|
pendingOperations.emplace_back(std::move(operation));
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ namespace null {
|
|||||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||||
|
|
||||||
|
void TickImpl() override;
|
||||||
|
|
||||||
void AddPendingOperation(std::unique_ptr<PendingOperation> operation);
|
void AddPendingOperation(std::unique_ptr<PendingOperation> operation);
|
||||||
std::vector<std::unique_ptr<PendingOperation>> AcquirePendingOperations();
|
std::vector<std::unique_ptr<PendingOperation>> AcquirePendingOperations();
|
||||||
|
|
||||||
|
@ -97,6 +97,9 @@ namespace opengl {
|
|||||||
return new TextureView(this, builder);
|
return new TextureView(this, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Device::TickImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
void Device::Reference() {
|
void Device::Reference() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +97,8 @@ namespace opengl {
|
|||||||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||||
|
|
||||||
|
void TickImpl() override;
|
||||||
|
|
||||||
// NXT API
|
// NXT API
|
||||||
void Reference();
|
void Reference();
|
||||||
void Release();
|
void Release();
|
||||||
|
@ -74,6 +74,7 @@ class WireTestsBase : public Test {
|
|||||||
if (ignoreSetCallbackCalls) {
|
if (ignoreSetCallbackCalls) {
|
||||||
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
|
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
|
||||||
}
|
}
|
||||||
|
EXPECT_CALL(api, DeviceTick(_)).Times(AnyNumber());
|
||||||
|
|
||||||
s2cBuf = new TerribleCommandBuffer();
|
s2cBuf = new TerribleCommandBuffer();
|
||||||
c2sBuf = new TerribleCommandBuffer(wireServer);
|
c2sBuf = new TerribleCommandBuffer(wireServer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user