Added support for global variables
Bug: 30964317
Pass necessary metadata about global variables--i.e., offsets of each
global variable in the synthesized global buffer--from the compiler to
the driver. This metadata is encoded as an OpString in the generated
SPIR-V code. The driver also creates the global buffer to store all
global variables.
Added support for sharing globals between invokes and kernels. rs2spirv
also does global variable access to global buffer field access
transformation for the CPU code, so that CPU and GPU access the same
global buffer resident in shared memory assuming the same data layout.
Added in the compiler support to handle global variable intializers,
and contantant expressions.
Removed capability Address, since Vulkan validation rules disallow it.
Converted OpInBoundsPtrAccessChain into OpInBoundsAccessChain, since the
former requires capability Address. OpInBoundsPtrAccessChain
instructions get generated for accesses to global variables, which are
now fields in the global buffer.
Added an RSoV test for global variables. Adjusted lit tests to check
the new OpString.
This CL is limited to non-allocation global variables, as global
rs_allocations are handled in separate CLs.
This CL does not handle constant globals either, which will be dealt
with in followup CLs.
Test: lit tests and RSoVTest
Change-Id: Ia8f44c4ffa22046a72a58a26942ced595b3f5f53
32 files changed