Commit Graph

10405 Commits

Author SHA1 Message Date
Natasha Lee 99b76d1b8f Clear D3D12 texture on first usage if not yet initialized
This prevents dirty textures to be used when memory is recycled while
destroying/creating new textures. If a texture is being used for the
first time and has not yet been initialized, it will be cleared
to zeros.

Bug: dawn:145
Change-Id: I8b9571c5a8fdd366717ffbd0fafca89b86653cea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8062
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-06-24 17:49:46 +00:00
David 'Digit' Turner 5dee3e826b [generator_lib]: Make generator_lib.py easier to reuse.
This CL tries to make generator_lib.py easier to reuse in
other projects (e.g. non Dawn-related), by doing the following:

- Removing dawn-specific variables from the script and
  replacing them by path-relative defaults, or through
  additional command-line parameters (e.g. --root-dir can
  now be used to pass the root source directory for Python
  dependency computations).

- Move project-agnostic processing from dawn_generator
  GN template into a new generator_lib:generator_lib_action
  template. The new generator_lib.gni file does not
  contain Dawn-specific settings and can be reused more
  easily outside of Dawn.

+ Replace --extra-python-path with --jinja2-path to be
  more explicit.

+ Add a few documentation comments in the Python scripts.

R=cwallez@chromium.org

Bug: NONE
Change-Id: I3e89f4bc32bdb6a019d251473222c6ce5cdc5f9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-24 14:31:06 +00:00
Li, Hao 4ec2c1060e Init PointSize value when pipeline topology is PointList in end2end
When pipeline topology is set to Point_List, PointSize must be written
in vertex shader for Vulkan backend.

BUG=dawn:146

Change-Id: Id5aac73bb7e60646503f1ea06c2aa0d39c8384b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7820
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-21 10:56:35 +00:00
Corentin Wallez a92f83b725 Add internal Format structure for texture formats
Texture formats have plenty of properties we'd like to query on them
like their texel size, whether they are compressend or if they are depth
stencil. Instead of making switch statements for each of these
properties, we store them in a new `Format` structure. Textures compute
their format only onces and then pass a const reference to it on
GetFormat().

This is in preparation of adding all WebGPU texture formats.

BUG=dawn:128

Change-Id: Iad2831cf16f14e1a1bfce2c10b22527fc982d1aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8166
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-21 10:16:15 +00:00
Rafael Cintron 4729b15365 Add begin-capture-on-startup testing flag
In order to debug single frame applications such as unit tests with
with PIX, you need to call BeginCapture() at the start of your
application.

This change adds a begin-capture-on-startup flag to the Dawn test
environment. The flag, when set, will call BeginCapture() right after
the DXGI factory is created.

Bug: dawn:44
Change-Id: Ibb8f7b05707915510f9886524f0144c0576d2603
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8200
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-21 02:09:05 +00:00
Natasha Lee bfd0d94a31 Fix vulkan clear texture image layout format
Also ensure depth stencil texture is clear in begin render pass.

Bug: dawn:175, dawn:145
Change-Id: I19fc857dedf9f353a4834b8e1c9616d02c5a15ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8140
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-20 20:05:15 +00:00
Corentin Wallez db8b3fa44c Remove unnecessary DeviceBase::GetDevice
BUG=

Change-Id: Iac73c9ffb4900961a0b47bf26dac049518021af2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8165
Reviewed-by: Idan Raiter <idanr@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-20 09:08:24 +00:00
Ryan Harrison 24f8d1870b Migrate to use new Shader Model API
The currently used method, SetShaderModel has been deprecated in
favour of SetHLSLShaderModel. This CL migrates Dawn, so that the
deprecated method can be removed from upstream.

BUG=chromium:976798

Change-Id: Id1e655b77291179dd6e15f1a85c8664f07cf8396
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8220
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-19 15:48:59 +00:00
Ryan Harrison da8223d2ef Add script to assist in manually rolling shaderc and related DEPS
Uses the functionality in depot_tools/roll-dep to generate a patch
rolling all of the shaderc dependencies in DEPS to
origin/master. Still will require manual testing to confirm this roll
is good.

Change-Id: Iadf6ee0f75ac84ce9bc7ec1ba82247dd96560088
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8180
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-19 15:04:09 +00:00
Corentin Wallez 77fa31c5c6 Make Texture format names match WebGPU
BUG=dawn:128

Change-Id: I73cc77082d02941d91fab8ee578e529db979fed1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8164
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-19 09:26:07 +00:00
Ryan Harrison 92cdeaaf81 Rolling 4 dependencies
Roll third_party/SPIRV-Tools/ 0125b28ed..001e823b6 (24 commits)

0125b28ed4..001e823b65

$ git log 0125b28ed..001e823b6 --date=short --no-merges --format='%ad %ae %s'
2019-06-18 afdx Add fuzzer pass to obfuscate constants. (#2671)
2019-06-17 33432579+alan-baker Handle volatile memory semantics in upgrade (#2674)
2019-06-17 33432579+alan-baker Validate Volatile memory semantics bit (#2672)
2019-06-17 33432579+alan-baker Disallow stores to UBOs (#2651)
2019-06-17 dneto Another fix uint -> uint32_t (#2676)
2019-06-15 33432579+alan-baker Validate variable initializer type (#2668)
2019-06-14 dneto Fix uint -> uint32_t in fuzz.cpp (#2675)
2019-06-13 afdx Add replayer tool for spirv-fuzz. (#2664)
2019-06-13 33432579+alan-baker Add validation for Subgroup builtins (#2637)
2019-06-11 afdx Add constant == uniform facts. (#2660)
2019-06-07 stevenperron Cast __LINE__ to size_t (#2661)
2019-06-06 afdx Add transformation to replace a boolean constant with a numeric comparison (#2659)
2019-06-06 dgkoch Add builtin validation for SPV_NV_shader_sm_builtins (#2656)
2019-06-06 greg Instrument: Fix code for version 2 output format. (#2655)
2019-06-05 afdx Fix bug in 'split blocks', and add tests for fuzzer. (#2658)
2019-06-05 dneto Optimizer: Handle array type with OpSpecConstantOp length (#2652)
2019-06-05 afdx Add fuzzer pass to add dead breaks. (#2654)
2019-06-04 afdx Add fuzzer pass that adds useful constructs to a module (#2647)
2019-06-03 jbolz Add validation for SPV_EXT_fragment_shader_interlock (#2650)
2019-05-31 zoddicus Remove asserts from GetUnderlyingType (#2646)
2019-05-31 dsinclair Close opened file handles. (#2644)
2019-05-31 kevin.petit Validate OpenCL rules for ImageRead and OpImageSampleExplicitLod (#2643)
2019-05-31 afdx Add spirv-fuzz pass to permute blocks. (#2642)
2019-05-29 pierremoreau Linker: Better type comparison for OpTypeArray and OpTypeForwardPointer (#2580)

Roll third_party/glslang/ f88e5824d..f9d08a25f (44 commits)

f88e5824d2..f9d08a25fb

$ git log f88e5824d..f9d08a25f --date=short --no-merges --format='%ad %ae %s'
2019-06-18 cepheus Bump revision.
2019-06-17 cepheus AST/SPV: Fix #930: translate uvec4 <-> uint64 for SubgroupGeMask et. al.
2019-06-18 cepheus Bump revision.
2019-06-17 cepheus SPV: Add a switch for favoring non-NaN operands in min, max, and clamp.
2019-06-17 cepheus Bump revision.
2019-06-17 siglesias Delete duplicated gl_SubGroupSizeARB builtin treatment
2019-06-12 siglesias Add missing GL_ARB_shader_ballot builtins to Geometry and Tessellation shaders
2019-06-14 jbolz Add gl_SemanticsVolatile to GL_KHR_memory_scope_semantics, and make volatile-qualified atomics generate MemorySemanticsVolatile when using the Vulkan memory model
2019-06-13 alanbaker Update test expectations for new SPIRV-Tools
2019-06-13 alanbaker Update known good SPIRV-Tools
2019-06-04 dkoch Add support for GL_NV_shader_sm_builtins
2019-06-08 cepheus GLSL: Revert f6873f7 to fix #1764.
2019-06-07 jbolz Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL
2019-06-06 greg Uppdate spirv-tools known-good
2019-06-05 dsinclair Remove unused parameter
2019-06-04 jbolz Add missing NV_EXTENSIONS ifdef
2019-06-03 jbolz Support GL_ARB_fragment_shader_interlock
2019-05-27 dkoch Fix subgroup support for ray tracing
2019-05-30 dkoch Add AST tests for ray tracing shaders
2019-05-30 dkoch Add AST tests for mesh and task shaders
2019-05-30 dkoch Add more subgroup testing
2019-05-30 jbolz Allow runtime-sized arrays of acceleration structures
2019-05-28 dkoch Fix include guard for GL_EXT_multiview
2019-05-28 dkoch Return consistent names from CapabilityString
2019-05-23 mattparks5855 Fixed .dll install on MSVC.
2019-05-17 thomasanderson Remove non-source sources from binary targets
2019-05-16 syoussefi Build.gn: allow optimization in glslang lib and standalone
2019-05-16 dneto Update SPIRV-Tools, SPIRV-Headers
2019-05-10 cepheus Build: Fix 3 warnings.
2019-05-10 cepheus Bump version and revision.
2019-05-09 cepheus SPV 1.4: Move to 1.4 validation, removing all 1.4 validation failures.
2019-03-31 cepheus SPV 1.4: Emit SignExtend and ZeroExtend for integer image reads/writes.
2019-02-07 cepheus SPV 1.4: Lookup tables: Use variable initializer and NonWritable...
2019-01-15 cepheus SPV 1.4: Add support for OpCopyLogical, careful of Boolean differences.
2019-01-12 cepheus SPV 1.4: Implement the 5 new loop controls.
2019-01-10 cepheus SPV 1.4: Use OpSelect for trivial typed non-scalar/vector expressions.
2019-01-04 cepheus SPV 1.4: Add testing infrastructure for SPV 1.4 tests.
2019-01-04 cepheus SPV 1.4: Generate all globals on OpEntryPoint interface list.
2019-05-09 cepheus SPV: Move to the SPIR-V 1.4 header.
2019-05-09 cepheus Latest known-good SPIRV-Tools: WARNING: Needs python 3.x.
2019-05-09 cepheus Bump revision.
2019-05-08 jbolz For nonuniformEXT constructor, make a copy of the node to decorate
2019-03-08 jbolz Add support for GL_EXT_buffer_reference2
2019-02-17 jbolz Add Float16/Int8/Int16 capabilities for private variables and function parameters

Roll third_party/spirv-cross/ fce83b7e8..05ea05509 (46 commits)

fce83b7e8b..05ea055096

$ git log fce83b7e8..05ea05509 --date=short --no-merges --format='%ad %ae %s'
2019-06-18 post Make sure args.msl22 is set in test_shaders.py.
2019-06-18 post MSL: Fix path check in test_shaders.py.
2019-06-17 post MSL: Conditionally validate MSL 2.2 shaders.
2019-06-14 post MSL: New SDK errors out on cull distance.
2019-06-13 post MSL: Fix regression with Private parameter declaration.
2019-06-12 post MSL: Support stencil export.
2019-06-12 post GLSL: Support GL_ARB_shader_stencil_export.
2019-06-11 post MSL: Support Invariant qualifier on position.
2019-06-12 post Add MSL 2.2 path in test_shaders.py.
2019-06-10 post Expand constexpr sampler sanity check.
2019-06-10 post MSL: Support remapping constexpr samplers by set/binding.
2019-06-10 post Employ heuristics to figure out how to emit SSBO/UAV reflection names.
2019-06-06 post Deal with nested loops.
2019-06-06 post Use the existing loop dominator when doing loop variable preservation.
2019-06-06 post Rewrite how loop dominators are propagated.
2019-06-06 post Deal with case where a variable is dominated by inner part of a loop.
2019-06-05 pmours Fix storage packing qualifiers missing on "shaderRecordNV" buffers
2019-06-05 pmours Add test for callable data
2019-06-05 pmours Fix callable data variables
2019-06-03 pmours Add support for "shaderRecordNV" qualifier
2019-06-05 post Deal with case where a block is somehow emitted in a duplicated fashion.
2019-06-02 post Fix erronous default for emit_line_directives.
2019-05-31 post MSL: Fix declaration of unused input variables.
2019-05-28 post Fixup OpLine parsing comments.
2019-05-28 post Support emitting OpLine directive.
2019-05-28 post GLSL: Support std430 in UBOs with scalar layout.
2019-05-27 post Run format_all.sh.
2019-05-27 post MSL: Use correct address space when passing array-of-buffers.
2019-05-27 post OpArrayLength must trigger active variables.
2019-05-27 post MSL: Implement OpArrayLength.
2019-05-24 post Add Git/timestamp --revision support.
2019-05-23 post MSL: Add test case for complex type alias.
2019-05-23 post MSL: Fix struct declaration order with complex type aliases.
2019-05-18 post Fix formatting, update C ABI version.
2019-05-09 post MSL: Support argument buffers and image swizzling.
2019-05-08 stuart.carnie Add get_member_name and active_buffer_ranges to C APIs
2019-05-17 amerkoleci Fix spvc_type_get_vector_size C function.
2019-05-16 cdavis Remove fallback for OpGroupNonUniformElect.
2019-05-15 cdavis MSL: Add support for subgroup operations.
2019-05-14 post Only deploy on new tags.
2019-05-14 post Add setup for Github releases via Travis.
2019-05-14 post Validate that C ABI in CMakeLists.txt matches code.
2019-05-14 post Run format_all.sh.
2019-05-11 laszlo.agocs GLSL: Add option to disable buffer blocks regardless of version
2019-05-13 post Fix nonuniform test for MSL.
2019-05-13 post HLSL/MSL: Deal correctly with nonuniformEXT qualifier.

Roll third_party/spirv-headers/ c4f8f6579..de99d4d83 (17 commits)

c4f8f65792..de99d4d834

$ git log c4f8f6579..de99d4d83 --date=short --no-merges --format='%ad %ae %s'
2019-06-12 dneto Add Volatile to Memory Semantics, for SPV_KHR_vulkan_memory_model
2019-06-10 ehsannas Add grammar and symbols for UserTypeGOOGLE extension to unified1.
2019-06-07 cepheus Add missing "version" : "None" to a bunch of reserved enumerants.
2019-06-07 cepheus Add more detail about reserving tokens to the README.
2019-06-07 cepheus Restore numerical order in enumerants.
2019-06-02 jbolz Add SPV_EXT_fragment_shader_interlock
2019-05-17 dkoch Add support for SPV_NV_sm_shader_builtins
2019-05-31 cepheus OpenCL ext. inst. header: Support C in addition to C++.
2019-05-27 michael.kinsner Proposed LoopControl bitfield allocation mechanism in spir-v.xml
2019-05-23 victor Reserve token range for Codeplay
2019-05-18 mchiasson Update CMakeLists.txt
2019-05-16 jbolz Update HasResultAndType code generation to skip duplicate enum values. There weren't any until SPIR-V 1.4 release, now there are two.
2019-05-16 mchiasson updated as per code review
2019-05-12 alan Compare enum names rather than values to determine last element
2019-05-11 mchiasson cmake development configuration package Fixes #104
2019-05-09 rex.xu Enable Groups capability by the extension SPV_AMD_shader_ballot
2019-04-30 ian.d.romanick Add INTEL_shader_integer_functions2

Created with:
  roll-dep third_party/SPIRV-Tools third_party/glslang third_party/spirv-cross third_party/spirv-headers

Change-Id: Ie30848dc4e2d6932dc86d42c632537a19828329a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8181
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-06-18 20:32:47 +00:00
Jiawei Shao 872c1d7fe9 Add validations to the texture copies with BC formats
This patch adds the validation on the texture copies with BC formats.
1. BufferCopyView.offset in B2T and T2B copies must be a multiple of the
   compressed texel block size in bytes.
2. BufferCopyView.rowPitch in B2T and T2B copies refers to the number of
   bytes from the start of one row of blocks to the start of the next
   row of blocks.
3. BufferCopyView.imageHeight must be a multiple of the compressed texel
   block height (4 for BC formats).
4. All members in TextureCopyView.origin must be a multiple of the
   corresponding dimensions of the compressed texel block (4x4x1 for BC
   formats).
5. All the mumbers in 'copySize' must be a multiple of the corresponding
   dimensions of the compressed texel block (4x4x1 for BC formats)
   because D3D12 requires the width and height of a texture in BC
   formats must be multiples of 4.
6. Compute the texture size in non-zero mipmap levels with paddings for
   textures in BC formats when necessary.

BUG=dawn:42
TEST=dawn_unittests

Change-Id: Iac8d6c93ab8b37bb46becffd4175339722ab6016
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7860
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-18 01:06:09 +00:00
Corentin Wallez 8f4046b0b6 Remove glad and replace it with our own GL header
This completely removes the dependency on glad by generating the GL
headers from gl.xml directly.

This requires adding khrplatform.h so all Khronos dependencies are
gathered in third_party/khronos.

Also removes a stray CMakeLists.txt that was still hanging out.

BUG=dawn:165

Change-Id: Ia64bc51bc8b18c6b48613918e2f309f7405ecb3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8163
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-06-17 09:17:29 +00:00
Corentin Wallez abdb566c30 Remove OpenGLBinding's dependency on glad
This move all the OpenGL-specific code for swapchain handling in a new
NativeSwapChainImpl in the OpenGL backend so no code outside of
dawn_native needs OpenGL.

BUG=dawn:165

Change-Id: I3c0c1055e3215a59fdc8e9550baf30762a7014b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8161
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-17 09:01:09 +00:00
Austin Eng 21eba761b5 Implement CreateBufferMappedAsync in dawn_wire and dawn_native
Bug: dawn:7
Change-Id: I1a4e5eece53d83a4c5395ba6b41df2e20668c5bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8120
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-14 17:35:56 +00:00
Brandon Jones d1b4b5cba5 Allow D3D12 Implicit State Transitions
When transitioning from the COMMON state, an explicit ResourceBarrier
call is unnecessary and can be handled implicitly by the driver. This
acts as an optimization because no synchronization waits are required
when transitioning from the COMMON state.

Bug: dawn:167
Change-Id: Ifd45236dc51c339de8b9945e6f4e2a00934f3676
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7920
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-14 15:14:12 +00:00
Corentin Wallez e0a2ae8a0b Fix casing of includes in D3D12Info
BUG=dawn:144

Change-Id: I95fd1839247ccdf2d4e3b75e6ad84fad02c71ede
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8162
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-14 12:44:22 +00:00
Corentin Wallez 55ab6aacac Fix compilation of the GL backend on Windows
The generated OpenGLFunctionsBase code uses the MemoryBarrier identifier
which is a macro defined in windows.h. Undefined it in
windows_with_undefs.

BUG=dawn:165

Change-Id: I6fcfef8fa14074e946d6c13536c1ae33b38c2ac2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8160
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-14 08:50:42 +00:00
Corentin Wallez df69f24824 OpenGL: Don't use glad to load OpenGL entrypoints
This makes the OpenGL entry points loaded at Adapter creation from the
getProcAddress passed in the DiscoveryOptions and update all GL calls in
the backend to go through the new OpenGLFunctions object.

A code generator is added that generates the function loader and list of
GL procs from Khronos' gl.xml file but we can't get rid of glad yet
because it is used to have the PROC typedefs and enum values.

BUG=dawn:165

Change-Id: I2a583d79752f55877fa4190846f5be16cf91651a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7983
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-06-13 10:22:32 +00:00
Jiawei Shao 87ab2f96d9 Vulkan: always specify TRANSFER_DST_BIT usage when creating images
This patch adds VK_IMAGE_USAGE_TRANSFER_DST_BIT usage when creating
Vulkan images because when we do resource initialization with
vkCmdClearColorImage() and vkCmdClearDepthStencilImage(), the image must
have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag
according to Vulkan SPEC.

BUG=dawn:171
TEST=dawn_end2end_tests

Change-Id: Iaba6c04c6942354cc6be502eeee04457d3f43ba7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-06-13 00:07:42 +00:00
Corentin Wallez 3dc8bf4c6f Update glad for Desktop GL 4.6 and GLES 3.2
This is necessary because we currently use GLAD to generate all the
OpenGL enums and proc typedef that we use.

BUG=dawn:165

Change-Id: Ie1b88fd676421703e9af63dafe6dee168c600d4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7982
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-12 21:59:42 +00:00
Bryan Bernhart 970101a102 Improve D3D12 adapter initialization.
Gather device info at device initialization rather than adapter initialization.

BUG=dawn:144

Change-Id: I07e114731a37f3738daa585afa99675f2fd36289
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7700
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-12 18:54:57 +00:00
Idan Raiter 0e646e95e0 Add Vulkan / D3D12 indirect buffer flags
Adds missing flags for the indirect usage in vulkan and d3d12.

Bug: dawn:169
Change-Id: I786ea56faaefcbd10100dae40c7893bbc6d5d0ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8061
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2019-06-12 16:35:09 +00:00
Jiawei Shao 17738b6d8c Fix wrong computation of texture copy buffer size
This patch fixes a bug in the computation of texture copy buffer size.
As the 'width' and 'height' in copy commands are all in pixels, while
the buffer size is counted in bytes, we shoud first convert 'width' into
bytes before calculating the buffer size.

BUG=dawn:42
TEST=dawn_unittests

Change-Id: Iebd5ed07a54eea762f4a653e295ecacb845ba32f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7940
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-12 08:53:45 +00:00
Ryan Harrison 3e51fada29 Remove Full SPIRV-Cross fuzzers
BUG=chromium:972753

Change-Id: Ic61d5d0ed44b0693f4df09b1f9c34bd928609c3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-12 08:49:15 +00:00
Idan Raiter 8f813ac8a2 Fix indirect draw test for MSVC
We need a negative number in a buffer of uint32_t, to test negative
baseVertex. MSVC requires an explicit cast here.

Bug: dawn:172
Change-Id: Iea6c609f11054ba02e5c041fff89def0557c8091
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8060
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-11 19:05:45 +00:00
Natasha Lee 28232ce9f5 Clear Vulkan Textures at first usage
This prevents dirty textures to be used when memory is recycled
while destroying/creating textures. If a texture is not cleared at load,
it will be cleared to 0 before it is used.

Bug: dawn:145
Change-Id: Ia3f02427478fb48649089829186ccb377caa1912
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6960
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-11 18:11:05 +00:00
Corentin Wallez 031fbbbaa1 Generators: main.py is now dawn_json_generator.py
This merges all the files for main.py together again except
generator_lib.py because there doesn't seeem to be a good way to
separate the pure dawn.json generators and the dawn wire generator.

Also updates the GN templates to make it easier to define new generators
based on generator_lib, and move the Jinja2 template "stdlib" to
generator_lib.py

BUG=dawn:165

Change-Id: I1b5b2ef0a59cb142e214f3af9a58048a88ae949a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7880
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-11 18:03:05 +00:00
Austin Eng 88860d1ced Add 32 bit Linux/Windows builders to the Dawn CQ
We need a 32-bit Dawn CQ builders to catch build breakages on those
platforms.

Bug: dawn:168
Change-Id: Iafc1af9002992fbf16c9ca996fd578dc21aa516d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8040
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-06-11 16:51:24 +00:00
Yunchao He 29f3de54a5 Update VertexInput (InputState) to match the spec - Part 4
This patch added support for null vertex buffer(s).

BUG=dawn:80, dawn:107

Change-Id: I3fb9427fcd4323c6df441be7011223088b40ec53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2019-06-11 16:45:04 +00:00
Ryan Harrison 903fc2b049 Explictly set the environment for the Fast fuzzers
BUG=chromium:970300

Change-Id: Ib57a2dcd92a378412588901df9cadc271cad18d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8001
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-06-11 14:38:51 +00:00
Idan Raiter 05f7ad5ac8 Reland "dawn_native: Indirect draw/dispatch"
This is a reland of 7eb6be186b
Fixes casting issue on 32 bit machines

Original change's description:
> dawn_native: Indirect draw/dispatch
>
> Adds indirect draw and dispatch for all backends (without validation).
>
> Tests for opengl negative offset are skipped since there is no easy
> way to add the index buffer offset. Current idea is to use a compute
> shader to modify the indirect draw buffer.
>
> Change-Id: I1d3eec7c699b211423f4b911769cca17bfbcd045
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7481
> Commit-Queue: Idan Raiter <idanr@google.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

Change-Id: Id28c5658ee18ec5c030f721fb44d9f11ebe21ff9
Bug:dawn:54,chromium:972358
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7961
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2019-06-10 20:56:27 +00:00
Austin Eng 9d4d3eac14 Always back Buffers with data in the Null backend.
Now that CreateBufferMapped is implemented. Buffers of any usage may
be initialized with staging data. All buffers need to have backing data
otherwise copying from staging data to the buffer will dereference nullptr.

Bug: chromium:971542
Change-Id: I623cc236ffab918ec048cd1949520a4cb329c1b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7980
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-06-10 20:53:57 +00:00
Ryan Harrison fa8190ae44 Manually roll shaderc related dependencies
Getting the autorollers fully working is going to take a while, so
rolling ahead the DEPS by hand, so the new shaderc API can be used and
some tasks unblocked.

BUG=chromium:970300

Change-Id: I2137deb27e867cd8439ef0143b36cf91d89d8b1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8000
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2019-06-10 19:01:17 +00:00
Austin Eng 39b8ddfbd9 Revert "dawn_native: Indirect draw/dispatch"
This reverts commit 7eb6be186b.

Reason for revert: This change is breaking Clusterfuzz bots. crbug.com/972358

Bug: chromium:972358

Original change's description:
> dawn_native: Indirect draw/dispatch
>
> Adds indirect draw and dispatch for all backends (without validation).
>
> Tests for opengl negative offset are skipped since there is no easy
> way to add the index buffer offset. Current idea is to use a compute
> shader to modify the indirect draw buffer.
>
> Change-Id: I1d3eec7c699b211423f4b911769cca17bfbcd045
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7481
> Commit-Queue: Idan Raiter <idanr@google.com>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

TBR=cwallez@chromium.org,kainino@chromium.org,idanr@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I9b7b63de0900e20c4da8561ceb9b2dece77c3885
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7960
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2019-06-10 17:15:27 +00:00
Idan Raiter 7eb6be186b dawn_native: Indirect draw/dispatch
Adds indirect draw and dispatch for all backends (without validation).

Tests for opengl negative offset are skipped since there is no easy
way to add the index buffer offset. Current idea is to use a compute
shader to modify the indirect draw buffer.

Change-Id: I1d3eec7c699b211423f4b911769cca17bfbcd045
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7481
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-07 17:32:37 +00:00
Brandon Jones de1ac9fd7b D3D12: Batch Usage Transitions For Render Pass
Instead of looping through usages and calling ResourceBarrier for
each transition, we should load all transitions into a single call.
This allows the driver to make better optimization decisions.

Bug: dawn:163
Change-Id: I4859aa2c71b60a40249df00ad67ab13eb0389cd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7680
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2019-06-07 17:08:47 +00:00
Corentin Wallez 2b82eb2902 Fix incorrect ASSERT in vertex validation.
Also adds a test that would have fired the ASSERT.

BUG=dawn:80
BUG=dawn:107

Change-Id: I56cdbc91956465c8941b45bb5e9da4c27da301ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-07 11:05:37 +00:00
Corentin Wallez 0c38e92187 Split off the reusable part of the code generator
This is in preparation for using it to generate code for replacing glad
with our own OpenGL function pointer loading code.

BUG=dawn:165

Change-Id: Ic3e774ab207e85a1491f299ad06131c8095416ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7781
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2019-06-07 08:59:17 +00:00
Austin Eng 120f5d9062 Return nullptr from MakeErrorMapped if OOM allocating staging data
Bug: chromium:970305
Change-Id: If5ea037170260b8b8dddf3e3428ad2e77d4b67a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7800
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-07 03:53:07 +00:00
Austin Eng fa7228a1fa Cleanup CopyBufferToBufferCmd
This command internally used a BufferCopy struct which is meant for
Buffer->Texture / Texture->Buffer copies. It contained unnecessary rowPitch
and imageHeight. This patch changes the members of CopyBufferToBufferCmd to
match the CopyBufferToBuffer api call.

Bug: dawn:164
Change-Id: I4737eb4ceb655e8282964c438242627070e355dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2019-06-07 03:06:47 +00:00
Yunchao He 2d4b529443 Update VertexInput (InputState) to match the spec - Part 3
Rename num{Attribute|Buffer}s to {Attribute|Buffer}Count for VertexInput

BUG=dawn:80, dawn:107

Change-Id: I7ad62f28449e6283d5c5788dfbd5df1d1e9c813e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-06 17:54:30 +00:00
Corentin Wallez 67ab1ea8c7 dawn.json: Use void* instead of uint8_t* for data pointers
This requires some changes in the wire because WireCmd doesn't know the
size of void. This also adds a handwritten implementation of the Wire
commands for SetSubData that internally converts to uint8_t so that
WireCmd can generate the de/serialization.

BUG=dawn:160

Change-Id: Icbf0fd7dd841639ee6f67333844e027b27a8afcc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7780
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-06 16:19:15 +00:00
Yunchao He 97c0885a4a Update VertexInput (InputState) to match the spec - Part 2
This patch changed the front end code and tests and examples.

BUG=dawn:80, dawn:107

Change-Id: Ia6c60232c04a1bfb862263766eb28e9afc3bc8db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7620
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-06 01:56:57 +00:00
Austin Eng 9cd21f1bf9 Implement CreateBufferMapped for non-mappable buffers
This uses an intermediate staging buffer to copy data into the buffer.

Bug: dawn:7
Change-Id: I3bda19a8450ef0eddc5b4382ce1b9120f074b917
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7500
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-05 18:35:31 +00:00
Austin Eng 233ce73c50 Add Create/ReleaseStagingBuffer to DynamicUploader
StagingBuffers need to be created and explicitly released outside of
the RingBuffer for CreateBufferMapped since the staging buffer must live
until the Buffer is Unmapped or Destroyed. This patch adds methods to the
DynamicUploaded for creating and tracking the release of StagingBuffers.

This patch also fixes SerialQueue for non-copy-constructible types.

Bug: dawn:7
Change-Id: I582c4d9cf452f808a8a7ab4164ff833087619a18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7720
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2019-06-05 16:16:37 +00:00
Corentin Wallez b632bc58ed Vulkan: Don't enable primitiveRestart on "list" topologies
This conforms to the Vulkan usage validation rules and is otherwise a
noop because primitive restart would do nothing for "list" topologies.

BUG=dawn:162

Change-Id: Icda96b15e2f931a0abd3fba794c2aff56dccb714
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7660
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2019-06-03 22:53:29 +00:00
Jiawei Shao c2750abd0c Add validations on the creation of textures in BC formats
This patch adds all the BC compressed texture formats and the checks on
the creation of textures in BC formats. If a texture is in BC format,
then:
1. The width and height of the texture must be multiple of 4.
2. The usage of the texture can only be Sampled or TransferSrc or
   TransferDst.
3. The sample count of the texture can only be 1.

BUG=dawn:42
TEST=dawn_unittests

Change-Id: I0844fb6a1aadbb96d94a61fd969db07c21b6adf5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7600
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-06-01 02:30:51 +00:00
Corentin Wallez 8dfc593eb7 Remove the concept of push constants
BUG=dawn:14

Change-Id: I20587081ec806034ce4f90457c3d475a6fbe834d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7180
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-05-29 13:16:06 +00:00
Corentin Wallez 839053b90c Replace dawn::CallbackUserdata with void*
This initial reasoning for having a u64 userdata was to be able to pack
two u32s in a single userdata but that was never used, and made a bunch
of code uglier than it should.

BUG=dawn:160

Change-Id: Ia0d20bc23f09f5d8f3748ca4edd1a331604f2ba8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7561
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2019-05-29 13:03:50 +00:00