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 {
|
||||
procs.deviceTick(knownDevice.Get(1)->handle);
|
||||
|
||||
while (size > sizeof(WireCmd)) {
|
||||
WireCmd cmdId = *reinterpret_cast<const WireCmd*>(commands);
|
||||
|
||||
|
|
|
@ -461,6 +461,9 @@
|
|||
"name": "create texture builder",
|
||||
"returns": "texture builder"
|
||||
},
|
||||
{
|
||||
"name": "tick"
|
||||
},
|
||||
{
|
||||
"name": "copy bind groups",
|
||||
"args": [
|
||||
|
|
|
@ -130,6 +130,10 @@ namespace backend {
|
|||
return new TextureBuilder(this);
|
||||
}
|
||||
|
||||
void DeviceBase::Tick() {
|
||||
TickImpl();
|
||||
}
|
||||
|
||||
void DeviceBase::CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target) {
|
||||
// TODO(cwallez@chromium.org): update state tracking then call the backend
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace backend {
|
|||
~DeviceBase();
|
||||
|
||||
void HandleError(const char* message);
|
||||
void SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata);
|
||||
|
||||
// Used by autogenerated code, returns itself
|
||||
DeviceBase* GetDevice();
|
||||
|
@ -52,6 +51,8 @@ namespace backend {
|
|||
virtual TextureBase* CreateTexture(TextureBuilder* 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
|
||||
// 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.
|
||||
|
@ -86,7 +87,9 @@ namespace backend {
|
|||
ShaderModuleBuilder* CreateShaderModuleBuilder();
|
||||
TextureBuilder* CreateTextureBuilder();
|
||||
|
||||
void Tick();
|
||||
void CopyBindGroups(uint32_t start, uint32_t count, BindGroupBase* source, BindGroupBase* target);
|
||||
void SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata);
|
||||
|
||||
private:
|
||||
// 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;
|
||||
}
|
||||
|
||||
void Device::Tick() {
|
||||
void Device::TickImpl() {
|
||||
// Execute any pending commands
|
||||
ASSERT_SUCCESS(pendingCommandList->Close());
|
||||
ID3D12CommandList* commandLists[] = { pendingCommandList.Get() };
|
||||
|
|
|
@ -105,6 +105,8 @@ namespace d3d12 {
|
|||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
void TickImpl() override;
|
||||
|
||||
ComPtr<ID3D12Device> GetD3D12Device();
|
||||
ComPtr<ID3D12CommandQueue> GetCommandQueue();
|
||||
ComPtr<ID3D12CommandAllocator> GetPendingCommandAllocator();
|
||||
|
@ -114,7 +116,6 @@ namespace d3d12 {
|
|||
|
||||
void SetNextRenderTargetDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE renderTargetDescriptor);
|
||||
|
||||
void Tick();
|
||||
uint64_t GetSerial() const;
|
||||
void IncrementSerial();
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ namespace metal {
|
|||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
void TickImpl() override;
|
||||
|
||||
void SetNextDrawable(id<CAMetalDrawable> drawable);
|
||||
void Present();
|
||||
|
||||
|
|
|
@ -114,6 +114,9 @@ namespace metal {
|
|||
return new TextureView(this, builder);
|
||||
}
|
||||
|
||||
void Device::TickImpl() {
|
||||
}
|
||||
|
||||
void Device::SetNextDrawable(id<CAMetalDrawable> drawable) {
|
||||
[currentDrawable release];
|
||||
currentDrawable = drawable;
|
||||
|
|
|
@ -89,6 +89,9 @@ namespace null {
|
|||
return new TextureViewBase(builder);
|
||||
}
|
||||
|
||||
void Device::TickImpl() {
|
||||
}
|
||||
|
||||
void Device::AddPendingOperation(std::unique_ptr<PendingOperation> operation) {
|
||||
pendingOperations.emplace_back(std::move(operation));
|
||||
}
|
||||
|
|
|
@ -107,6 +107,8 @@ namespace null {
|
|||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
void TickImpl() override;
|
||||
|
||||
void AddPendingOperation(std::unique_ptr<PendingOperation> operation);
|
||||
std::vector<std::unique_ptr<PendingOperation>> AcquirePendingOperations();
|
||||
|
||||
|
|
|
@ -97,6 +97,9 @@ namespace opengl {
|
|||
return new TextureView(this, builder);
|
||||
}
|
||||
|
||||
void Device::TickImpl() {
|
||||
}
|
||||
|
||||
void Device::Reference() {
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,8 @@ namespace opengl {
|
|||
TextureBase* CreateTexture(TextureBuilder* builder) override;
|
||||
TextureViewBase* CreateTextureView(TextureViewBuilder* builder) override;
|
||||
|
||||
void TickImpl() override;
|
||||
|
||||
// NXT API
|
||||
void Reference();
|
||||
void Release();
|
||||
|
|
|
@ -74,6 +74,7 @@ class WireTestsBase : public Test {
|
|||
if (ignoreSetCallbackCalls) {
|
||||
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
|
||||
}
|
||||
EXPECT_CALL(api, DeviceTick(_)).Times(AnyNumber());
|
||||
|
||||
s2cBuf = new TerribleCommandBuffer();
|
||||
c2sBuf = new TerribleCommandBuffer(wireServer);
|
||||
|
|
Loading…
Reference in New Issue