Gather PCI device info through the adapter when possible

This will help migrate PCI info collection from the device to the
adapter where it belongs.

BUG=dawn:29

Change-Id: Ifa7d167249c97f1934f7c10d420f864f59babd37
Reviewed-on: https://dawn-review.googlesource.com/c/3843
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2019-01-10 10:50:54 +00:00
committed by Commit Bot service account
parent 7aae840a22
commit ec18f9683c
11 changed files with 28 additions and 40 deletions

View File

@@ -32,6 +32,8 @@ namespace dawn_native { namespace opengl {
glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
mPCIInfo.name = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
}
virtual ~Adapter() = default;
@@ -39,7 +41,7 @@ namespace dawn_native { namespace opengl {
ResultOrError<DeviceBase*> CreateDeviceImpl() override {
// There is no limit on the number of devices created from this adapter because they can
// all share the same backing OpenGL context.
return {new Device};
return {new Device(this)};
}
};

View File

@@ -32,8 +32,7 @@
namespace dawn_native { namespace opengl {
Device::Device() {
CollectPCIInfo();
Device::Device(AdapterBase* adapter) : DeviceBase(adapter) {
}
Device::~Device() {
@@ -145,12 +144,4 @@ namespace dawn_native { namespace opengl {
}
}
const dawn_native::PCIInfo& Device::GetPCIInfo() const {
return mPCIInfo;
}
void Device::CollectPCIInfo() {
mPCIInfo.name = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
}
}} // namespace dawn_native::opengl

View File

@@ -34,7 +34,7 @@ namespace dawn_native { namespace opengl {
class Device : public DeviceBase {
public:
Device();
Device(AdapterBase* adapter);
~Device();
void SubmitFenceSync();
@@ -50,8 +50,6 @@ namespace dawn_native { namespace opengl {
Serial GetLastSubmittedCommandSerial() const final override;
void TickImpl() override;
const dawn_native::PCIInfo& GetPCIInfo() const override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
const BindGroupDescriptor* descriptor) override;
@@ -72,15 +70,12 @@ namespace dawn_native { namespace opengl {
ResultOrError<TextureViewBase*> CreateTextureViewImpl(
TextureBase* texture,
const TextureViewDescriptor* descriptor) override;
void CollectPCIInfo();
void CheckPassedFences();
Serial mCompletedSerial = 0;
Serial mLastSubmittedSerial = 0;
std::queue<std::pair<GLsync, Serial>> mFencesInFlight;
dawn_native::PCIInfo mPCIInfo;
};
}} // namespace dawn_native::opengl