Precompute all the Formats at Device creation in the FormatTable

This is needed for two reasons:
 - TextureBase and TextureViewBase stored Formats by value which isn't too
much overhead at this time but will get bigger in the future.
 - The OpenGL backends needs its own GLFormat structure to store data about
each format which will eventually contain complicated logic to detect
support in the GL driver so it shouldn't be duplicated in Textures.

The computations of the information about Format is moved from being done
whenever they are needed to being precomputed at DeviceBase initialization.
This makes each format have a constant "index" in that can be used in the
backends to address their own structure, for example a GLFormat table.

Also some DeviceBase pointers were made const for validation.

BUG=dawn:128

Change-Id: I37d1e9c739b87cddcea09cb1759e175704d90f9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9101
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2019-07-18 09:25:04 +00:00
committed by Commit Bot service account
parent d6cc1fe099
commit 1546bfbdec
16 changed files with 358 additions and 224 deletions

View File

@@ -17,7 +17,7 @@
#include "common/Assert.h"
#include "common/Constants.h"
#include "common/Math.h"
#include "dawn_native/Texture.h"
#include "dawn_native/Format.h"
#include "dawn_native/d3d12/TextureCopySplitter.h"
#include "dawn_native/d3d12/d3d12_platform.h"