Change buffer-related sizes/offsets to be uint64_t

Bug: dawn:121
Change-Id: I9d88e2b2b8eff4eda98d25ae0922bc07199a69c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5720
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-04-05 20:51:29 +00:00 committed by Commit Bot service account
parent 952860bf9f
commit cf52d711fb
58 changed files with 207 additions and 204 deletions

View File

@ -32,8 +32,8 @@
"members": [
{"name": "binding", "type": "uint32_t"},
{"name": "buffer", "type": "buffer", "optional": true},
{"name": "offset", "type": "uint32_t"},
{"name": "size", "type": "uint32_t"},
{"name": "offset", "type": "uint64_t"},
{"name": "size", "type": "uint64_t"},
{"name": "sampler", "type": "sampler", "optional": true},
{"name": "texture view", "type": "texture view", "optional": true}
]
@ -142,8 +142,8 @@
{
"name": "set sub data",
"args": [
{"name": "start", "type": "uint32_t"},
{"name": "count", "type": "uint32_t"},
{"name": "start", "type": "uint64_t"},
{"name": "count", "type": "uint64_t"},
{"name": "data", "type": "uint8_t", "annotation": "const*", "length": "count"}
]
},
@ -174,7 +174,7 @@
"extensible": true,
"members": [
{"name": "buffer", "type": "buffer"},
{"name": "offset", "type": "uint32_t"},
{"name": "offset", "type": "uint64_t"},
{"name": "row pitch", "type": "uint32_t"},
{"name": "image height", "type": "uint32_t"}
]
@ -184,7 +184,7 @@
"extensible": true,
"members": [
{"name": "usage", "type": "buffer usage bit"},
{"name": "size", "type": "uint32_t"}
{"name": "size", "type": "uint64_t"}
]
},
"buffer map read callback": {
@ -267,10 +267,10 @@
"name": "copy buffer to buffer",
"args": [
{"name": "source", "type": "buffer"},
{"name": "source offset", "type": "uint32_t"},
{"name": "source offset", "type": "uint64_t"},
{"name": "destination", "type": "buffer"},
{"name": "destination offset", "type": "uint32_t"},
{"name": "size", "type": "uint32_t"}
{"name": "destination offset", "type": "uint64_t"},
{"name": "size", "type": "uint64_t"}
],
"TODO": [
"Restrictions on the alignment of the copy? Cf Metal on OSX"
@ -359,7 +359,7 @@
{"name": "group index", "type": "uint32_t"},
{"name": "group", "type": "bind group"},
{"name": "dynamic offset count", "type": "uint32_t"},
{"name": "dynamic offsets", "type": "uint32_t", "annotation": "const*", "length": "dynamic offset count"}
{"name": "dynamic offsets", "type": "uint64_t", "annotation": "const*", "length": "dynamic offset count"}
]
},
{
@ -573,7 +573,7 @@
"members": [
{"name": "shader location", "type": "uint32_t"},
{"name": "input slot", "type": "uint32_t"},
{"name": "offset", "type": "uint32_t"},
{"name": "offset", "type": "uint64_t"},
{"name": "format", "type": "vertex format"}
]
},
@ -582,7 +582,7 @@
"extensible": false,
"members": [
{"name": "input slot", "type": "uint32_t"},
{"name": "stride", "type": "uint32_t"},
{"name": "stride", "type": "uint64_t"},
{"name": "step mode", "type": "input step mode"}
]
},
@ -741,7 +741,7 @@
{"name": "group index", "type": "uint32_t"},
{"name": "group", "type": "bind group"},
{"name": "dynamic offset count", "type": "uint32_t"},
{"name": "dynamic offsets", "type": "uint32_t", "annotation": "const*", "length": "dynamic offset count"}
{"name": "dynamic offsets", "type": "uint64_t", "annotation": "const*", "length": "dynamic offset count"}
]
},
{
@ -806,14 +806,14 @@
{"name": "start slot", "type": "uint32_t"},
{"name": "count", "type": "uint32_t"},
{"name": "buffers", "type": "buffer", "annotation": "const*", "length": "count"},
{"name": "offsets", "type": "uint32_t", "annotation": "const*", "length": "count"}
{"name": "offsets", "type": "uint64_t", "annotation": "const*", "length": "count"}
]
},
{
"name": "set index buffer",
"args": [
{"name": "buffer", "type": "buffer"},
{"name": "offset", "type": "uint32_t"}
{"name": "offset", "type": "uint64_t"}
]
},
{

View File

@ -35,14 +35,14 @@
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
{ "name": "request serial", "type": "uint32_t" },
{ "name": "status", "type": "uint32_t" },
{ "name": "data length", "type": "uint32_t" },
{ "name": "data length", "type": "uint64_t" },
{ "name": "data", "type": "uint8_t", "annotation": "const*", "length": "data length" }
],
"buffer map write async callback": [
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
{ "name": "request serial", "type": "uint32_t" },
{ "name": "status", "type": "uint32_t" },
{ "name": "data length", "type": "uint32_t" }
{ "name": "data length", "type": "uint64_t" }
],
"device error callback": [
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }

View File

@ -256,7 +256,7 @@ void initSim() {
}
dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i) {
static const uint32_t zeroOffsets[1] = {0};
static const uint64_t zeroOffsets[1] = {0};
auto& bufferDst = particleBuffers[(i + 1) % 2];
dawn::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -153,7 +153,7 @@ void frame() {
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
depthStencilView);
static const uint32_t vertexBufferOffsets[1] = {0};
static const uint64_t vertexBufferOffsets[1] = {0};
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);

View File

@ -249,7 +249,7 @@ void frame() {
s.a = (s.a + 1) % 256;
s.b += 0.01f;
if (s.b >= 1.0f) {s.b = 0.0f;}
static const uint32_t vertexBufferOffsets[1] = {0};
static const uint64_t vertexBufferOffsets[1] = {0};
cameraData.view = glm::lookAt(
glm::vec3(8.f * std::sin(glm::radians(s.b * 360.f)), 2.f, 8.f * std::cos(glm::radians(s.b * 360.f))),

View File

@ -523,7 +523,7 @@ namespace {
uint32_t slot = s.first;
auto it = iPrim.attributes.find(s.second);
if (it == iPrim.attributes.end()) {
uint32_t zero = 0;
uint64_t zero = 0;
pass.SetVertexBuffers(slot, 1, &defaultBuffer, &zero);
continue;
}
@ -538,7 +538,7 @@ namespace {
vertexCount = static_cast<uint32_t>(iAccessor.count);
}
const auto& oBuffer = buffers.at(iAccessor.bufferView);
uint32_t iBufferOffset = static_cast<uint32_t>(iAccessor.byteOffset);
uint64_t iBufferOffset = static_cast<uint64_t>(iAccessor.byteOffset);
pass.SetVertexBuffers(slot, 1, &oBuffer, &iBufferOffset);
}

View File

@ -50,8 +50,8 @@
// Custom types depending on the target language
typedef uint64_t DawnCallbackUserdata;
typedef void (*DawnDeviceErrorCallback)(const char* message, DawnCallbackUserdata userdata);
typedef void (*DawnBufferMapReadCallback)(DawnBufferMapAsyncStatus status, const void* data, uint32_t dataLength, DawnCallbackUserdata userdata);
typedef void (*DawnBufferMapWriteCallback)(DawnBufferMapAsyncStatus status, void* data, uint32_t dataLength, DawnCallbackUserdata userdata);
typedef void (*DawnBufferMapReadCallback)(DawnBufferMapAsyncStatus status, const void* data, uint64_t dataLength, DawnCallbackUserdata userdata);
typedef void (*DawnBufferMapWriteCallback)(DawnBufferMapAsyncStatus status, void* data, uint64_t dataLength, DawnCallbackUserdata userdata);
typedef void (*DawnFenceOnCompletionCallback)(DawnFenceCompletionStatus status,
DawnCallbackUserdata userdata);

View File

@ -37,7 +37,7 @@ namespace dawn_native {
}
DAWN_TRY(device->ValidateObject(binding.buffer));
uint32_t bufferSize = binding.buffer->GetSize();
uint64_t bufferSize = binding.buffer->GetSize();
if (binding.size > bufferSize) {
return DAWN_VALIDATION_ERROR("Buffer binding size larger than the buffer");
}

View File

@ -34,8 +34,8 @@ namespace dawn_native {
struct BufferBinding {
BufferBase* buffer;
uint32_t offset;
uint32_t size;
uint64_t offset;
uint64_t size;
};
class BindGroupBase : public ObjectBase {

View File

@ -84,7 +84,7 @@ namespace dawn_native {
MaybeError ValidateUnmap() const;
MaybeError ValidateDestroy() const;
uint32_t mSize = 0;
uint64_t mSize = 0;
dawn::BufferUsageBit mUsage = dawn::BufferUsageBit::None;
DawnBufferMapReadCallback mMapReadCallback = nullptr;

View File

@ -62,12 +62,12 @@ namespace dawn_native {
return {};
}
bool FitsInBuffer(const BufferBase* buffer, uint32_t offset, uint32_t size) {
uint32_t bufferSize = buffer->GetSize();
bool FitsInBuffer(const BufferBase* buffer, uint64_t offset, uint64_t size) {
uint64_t bufferSize = buffer->GetSize();
return offset <= bufferSize && (size <= (bufferSize - offset));
}
MaybeError ValidateCopySizeFitsInBuffer(const BufferCopy& bufferCopy, uint32_t dataSize) {
MaybeError ValidateCopySizeFitsInBuffer(const BufferCopy& bufferCopy, uint64_t dataSize) {
if (!FitsInBuffer(bufferCopy.buffer.Get(), bufferCopy.offset, dataSize)) {
return DAWN_VALIDATION_ERROR("Copy would overflow the buffer");
}
@ -75,9 +75,9 @@ namespace dawn_native {
return {};
}
MaybeError ValidateB2BCopySizeAlignment(uint32_t dataSize,
uint32_t srcOffset,
uint32_t dstOffset) {
MaybeError ValidateB2BCopySizeAlignment(uint64_t dataSize,
uint64_t srcOffset,
uint64_t dstOffset) {
// Copy size must be a multiple of 4 bytes on macOS.
if (dataSize % 4 != 0) {
return DAWN_VALIDATION_ERROR("Copy size must be a multiple of 4 bytes");
@ -677,10 +677,10 @@ namespace dawn_native {
}
void CommandEncoderBase::CopyBufferToBuffer(BufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
if (ConsumedError(ValidateCanRecordTopLevelCommands())) {
return;
}
@ -1165,7 +1165,7 @@ namespace dawn_native {
case Command::SetVertexBuffers: {
SetVertexBuffersCmd* cmd = mIterator.NextCommand<SetVertexBuffersCmd>();
auto buffers = mIterator.NextData<Ref<BufferBase>>(cmd->count);
mIterator.NextData<uint32_t>(cmd->count);
mIterator.NextData<uint64_t>(cmd->count);
for (uint32_t i = 0; i < cmd->count; ++i) {
usageTracker.BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);

View File

@ -40,10 +40,10 @@ namespace dawn_native {
ComputePassEncoderBase* BeginComputePass();
RenderPassEncoderBase* BeginRenderPass(const RenderPassDescriptor* info);
void CopyBufferToBuffer(BufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size);
uint64_t destinationOffset,
uint64_t size);
void CopyBufferToTexture(const BufferCopyView* source,
const TextureCopyView* destination,
const Extent3D* copySize);

View File

@ -127,7 +127,7 @@ namespace dawn_native {
for (size_t i = 0; i < cmd->count; ++i) {
(&buffers[i])->~Ref<BufferBase>();
}
commands->NextData<uint32_t>(cmd->count);
commands->NextData<uint64_t>(cmd->count);
cmd->~SetVertexBuffersCmd();
} break;
}
@ -231,7 +231,7 @@ namespace dawn_native {
case Command::SetVertexBuffers: {
auto* cmd = commands->NextCommand<SetVertexBuffersCmd>();
commands->NextData<Ref<BufferBase>>(cmd->count);
commands->NextData<uint32_t>(cmd->count);
commands->NextData<uint64_t>(cmd->count);
} break;
}
}

View File

@ -90,7 +90,7 @@ namespace dawn_native {
struct BufferCopy {
Ref<BufferBase> buffer;
uint32_t offset; // Bytes
uint64_t offset; // Bytes
uint32_t rowPitch; // Bytes
uint32_t imageHeight; // Texels
};
@ -105,7 +105,7 @@ namespace dawn_native {
struct CopyBufferToBufferCmd {
BufferCopy source;
BufferCopy destination;
uint32_t size;
uint64_t size;
};
struct CopyBufferToTextureCmd {
@ -194,7 +194,7 @@ namespace dawn_native {
struct SetIndexBufferCmd {
Ref<BufferBase> buffer;
uint32_t offset;
uint64_t offset;
};
struct SetVertexBuffersCmd {

View File

@ -108,10 +108,10 @@ namespace dawn_native {
virtual ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(
size_t size) = 0;
virtual MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) = 0;
uint64_t destinationOffset,
uint64_t size) = 0;
ResultOrError<DynamicUploader*> GetDynamicUploader() const;

View File

@ -85,7 +85,7 @@ namespace dawn_native {
void ProgrammablePassEncoder::SetBindGroup(uint32_t groupIndex,
BindGroupBase* group,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets) {
const uint64_t* dynamicOffsets) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(group))) {
return;

View File

@ -42,7 +42,7 @@ namespace dawn_native {
void SetBindGroup(uint32_t groupIndex,
BindGroupBase* group,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets);
const uint64_t* dynamicOffsets);
void SetPushConstants(dawn::ShaderStageBit stages,
uint32_t offset,
uint32_t count,

View File

@ -128,7 +128,7 @@ namespace dawn_native {
cmd->height = height;
}
void RenderPassEncoderBase::SetIndexBuffer(BufferBase* buffer, uint32_t offset) {
void RenderPassEncoderBase::SetIndexBuffer(BufferBase* buffer, uint64_t offset) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(buffer))) {
return;
@ -143,7 +143,7 @@ namespace dawn_native {
void RenderPassEncoderBase::SetVertexBuffers(uint32_t startSlot,
uint32_t count,
BufferBase* const* buffers,
uint32_t const* offsets) {
uint64_t const* offsets) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
return;
}
@ -165,8 +165,8 @@ namespace dawn_native {
new (&cmdBuffers[i]) Ref<BufferBase>(buffers[i]);
}
uint32_t* cmdOffsets = mAllocator->AllocateData<uint32_t>(count);
memcpy(cmdOffsets, offsets, count * sizeof(uint32_t));
uint64_t* cmdOffsets = mAllocator->AllocateData<uint64_t>(count);
memcpy(cmdOffsets, offsets, count * sizeof(uint64_t));
}
} // namespace dawn_native

View File

@ -53,7 +53,7 @@ namespace dawn_native {
void SetVertexBuffers(uint32_t startSlot,
uint32_t count,
T* const* buffers,
uint32_t const* offsets) {
uint64_t const* offsets) {
static_assert(std::is_base_of<BufferBase, T>::value, "");
SetVertexBuffers(startSlot, count, reinterpret_cast<BufferBase* const*>(buffers),
offsets);
@ -61,8 +61,8 @@ namespace dawn_native {
void SetVertexBuffers(uint32_t startSlot,
uint32_t count,
BufferBase* const* buffers,
uint32_t const* offsets);
void SetIndexBuffer(BufferBase* buffer, uint32_t offset);
uint64_t const* offsets);
void SetIndexBuffer(BufferBase* buffer, uint64_t offset);
protected:
RenderPassEncoderBase(DeviceBase* device,

View File

@ -861,7 +861,7 @@ namespace dawn_native { namespace d3d12 {
case Command::SetVertexBuffers: {
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
auto offsets = mCommands.NextData<uint32_t>(cmd->count);
auto offsets = mCommands.NextData<uint64_t>(cmd->count);
vertexBuffersInfo.startSlot =
std::min(vertexBuffersInfo.startSlot, cmd->startSlot);

View File

@ -253,10 +253,10 @@ namespace dawn_native { namespace d3d12 {
}
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
ToBackend(destination)
->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::TransferDst);

View File

@ -69,10 +69,10 @@ namespace dawn_native { namespace d3d12 {
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) override;
uint64_t destinationOffset,
uint64_t size) override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(

View File

@ -39,14 +39,15 @@ namespace dawn_native { namespace d3d12 {
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
Extent3D copySize,
uint32_t texelSize,
uint32_t offset,
uint64_t offset,
uint32_t rowPitch,
uint32_t imageHeight) {
TextureCopySplit copy;
ASSERT(rowPitch % texelSize == 0);
uint32_t alignedOffset = offset & ~(D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT - 1);
uint64_t alignedOffset =
offset & ~static_cast<uint64_t>(D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT - 1);
copy.offset = alignedOffset;
if (offset == alignedOffset) {
@ -67,10 +68,11 @@ namespace dawn_native { namespace d3d12 {
}
ASSERT(alignedOffset < offset);
ASSERT(offset - alignedOffset < D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
Origin3D texelOffset;
ComputeTexelOffsets(offset - alignedOffset, rowPitch, rowPitch * imageHeight, texelSize,
&texelOffset);
ComputeTexelOffsets(static_cast<uint32_t>(offset - alignedOffset), rowPitch,
rowPitch * imageHeight, texelSize, &texelOffset);
uint32_t rowPitchInTexels = rowPitch / texelSize;

View File

@ -32,7 +32,7 @@ namespace dawn_native { namespace d3d12 {
Extent3D copySize;
};
uint32_t offset = 0;
uint64_t offset = 0;
uint32_t count = 0;
std::array<CopyInfo, kMaxTextureCopyRegions> copies;
};
@ -40,7 +40,7 @@ namespace dawn_native { namespace d3d12 {
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
Extent3D copySize,
uint32_t texelSize,
uint32_t offset,
uint64_t offset,
uint32_t rowPitch,
uint32_t imageHeight);
}} // namespace dawn_native::d3d12

View File

@ -307,7 +307,7 @@ namespace dawn_native { namespace metal {
break;
}
uint32_t offset = src.offset;
uint64_t offset = src.offset;
// Doing all the copy except the last image.
if (size.depth > 1) {
@ -419,7 +419,7 @@ namespace dawn_native { namespace metal {
break;
}
uint32_t offset = dst.offset;
uint64_t offset = dst.offset;
// Doing all the copy except the last image.
if (size.depth > 1) {
@ -743,7 +743,7 @@ namespace dawn_native { namespace metal {
case Command::SetVertexBuffers: {
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
auto offsets = mCommands.NextData<uint32_t>(cmd->count);
auto offsets = mCommands.NextData<uint64_t>(cmd->count);
std::array<id<MTLBuffer>, kMaxVertexInputs> mtlBuffers;
std::array<NSUInteger, kMaxVertexInputs> mtlOffsets;

View File

@ -58,10 +58,10 @@ namespace dawn_native { namespace metal {
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) override;
uint64_t destinationOffset,
uint64_t size) override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(

View File

@ -215,10 +215,10 @@ namespace dawn_native { namespace metal {
}
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
id<MTLBuffer> uploadBuffer = ToBackend(source)->GetBufferHandle();
id<MTLBuffer> buffer = ToBackend(destination)->GetMTLBuffer();
id<MTLCommandBuffer> commandBuffer = GetPendingCommandBuffer();

View File

@ -125,10 +125,10 @@ namespace dawn_native { namespace null {
}
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
}

View File

@ -97,10 +97,10 @@ namespace dawn_native { namespace null {
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) override;
uint64_t destinationOffset,
uint64_t size) override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(

View File

@ -198,7 +198,7 @@ namespace dawn_native { namespace opengl {
void OnSetVertexBuffers(uint32_t startSlot,
uint32_t count,
Ref<BufferBase>* buffers,
uint32_t* offsets) {
uint64_t* offsets) {
for (uint32_t i = 0; i < count; ++i) {
uint32_t slot = startSlot + i;
mVertexBuffers[slot] = ToBackend(buffers[i].Get());
@ -234,7 +234,7 @@ namespace dawn_native { namespace opengl {
auto attribute = mLastPipeline->GetAttribute(location);
GLuint buffer = mVertexBuffers[slot]->GetHandle();
uint32_t offset = mVertexBufferOffsets[slot];
uint64_t offset = mVertexBufferOffsets[slot];
auto input = mLastPipeline->GetInput(slot);
auto components = VertexFormatNumComponents(attribute.format);
@ -258,7 +258,7 @@ namespace dawn_native { namespace opengl {
std::bitset<kMaxVertexInputs> mDirtyVertexBuffers;
std::array<Buffer*, kMaxVertexInputs> mVertexBuffers;
std::array<uint32_t, kMaxVertexInputs> mVertexBufferOffsets;
std::array<uint64_t, kMaxVertexInputs> mVertexBufferOffsets;
RenderPipelineBase* mLastPipeline = nullptr;
};
@ -692,7 +692,7 @@ namespace dawn_native { namespace opengl {
}
RenderPipeline* lastPipeline = nullptr;
uint32_t indexBufferBaseOffset = 0;
uint64_t indexBufferBaseOffset = 0;
PersistentPipelineState persistentPipelineState;
@ -815,7 +815,7 @@ namespace dawn_native { namespace opengl {
case Command::SetVertexBuffers: {
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
auto offsets = mCommands.NextData<uint32_t>(cmd->count);
auto offsets = mCommands.NextData<uint64_t>(cmd->count);
inputBuffers.OnSetVertexBuffers(cmd->startSlot, cmd->count, buffers, offsets);
} break;

View File

@ -149,10 +149,10 @@ namespace dawn_native { namespace opengl {
}
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
}

View File

@ -49,10 +49,10 @@ namespace dawn_native { namespace opengl {
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) override;
uint64_t destinationOffset,
uint64_t size) override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(

View File

@ -611,7 +611,7 @@ namespace dawn_native { namespace vulkan {
case Command::SetVertexBuffers: {
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
auto offsets = mCommands.NextData<uint32_t>(cmd->count);
auto offsets = mCommands.NextData<uint64_t>(cmd->count);
std::array<VkBuffer, kMaxVertexInputs> vkBuffers;
std::array<VkDeviceSize, kMaxVertexInputs> vkOffsets;

View File

@ -502,10 +502,10 @@ namespace dawn_native { namespace vulkan {
}
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) {
uint64_t destinationOffset,
uint64_t size) {
// Insert memory barrier to ensure host write operations are made visible before
// copying from the staging buffer. However, this barrier can be removed (see note below).
//

View File

@ -72,10 +72,11 @@ namespace dawn_native { namespace vulkan {
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
uint32_t sourceOffset,
uint64_t sourceOffset,
BufferBase* destination,
uint32_t destinationOffset,
uint32_t size) override;
uint64_t destinationOffset,
uint64_t size) override;
private:
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
const BindGroupDescriptor* descriptor) override;

View File

@ -44,7 +44,7 @@ namespace dawn_wire { namespace client {
// Only one mapped pointer can be active at a time because Unmap clears all the in-flight
// requests.
void* mappedData = nullptr;
size_t mappedDataSize = 0;
uint64_t mappedDataSize = 0;
bool isWriteMapped = false;
};

View File

@ -27,7 +27,7 @@ namespace dawn_wire { namespace client {
bool Client::DoBufferMapReadAsyncCallback(Buffer* buffer,
uint32_t requestSerial,
uint32_t status,
uint32_t dataLength,
uint64_t dataLength,
const uint8_t* data) {
// The buffer might have been deleted or recreated so this isn't an error.
if (buffer == nullptr) {
@ -77,7 +77,7 @@ namespace dawn_wire { namespace client {
bool Client::DoBufferMapWriteAsyncCallback(Buffer* buffer,
uint32_t requestSerial,
uint32_t status,
uint32_t dataLength) {
uint64_t dataLength) {
// The buffer might have been deleted or recreated so this isn't an error.
if (buffer == nullptr) {
return true;

View File

@ -25,7 +25,7 @@ namespace dawn_wire { namespace server {
Server* server;
ObjectHandle buffer;
uint32_t requestSerial;
uint32_t size;
uint64_t size;
bool isWrite;
};
@ -51,11 +51,11 @@ namespace dawn_wire { namespace server {
static void ForwardDeviceError(const char* message, DawnCallbackUserdata userdata);
static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata);
static void ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata);
static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status,
DawnCallbackUserdata userdata);
@ -64,11 +64,11 @@ namespace dawn_wire { namespace server {
void OnDeviceError(const char* message);
void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
MapUserdata* userdata);
void OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
MapUserdata* userdata);
void OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status,
FenceCompletionUserdata* userdata);

View File

@ -83,7 +83,7 @@ namespace dawn_wire { namespace server {
void Server::ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
data->server->OnBufferMapReadAsyncCallback(status, ptr, dataLength, data);
@ -91,7 +91,7 @@ namespace dawn_wire { namespace server {
void Server::ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
data->server->OnBufferMapWriteAsyncCallback(status, ptr, dataLength, data);
@ -99,7 +99,7 @@ namespace dawn_wire { namespace server {
void Server::OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
MapUserdata* userdata) {
std::unique_ptr<MapUserdata> data(userdata);
@ -127,7 +127,7 @@ namespace dawn_wire { namespace server {
void Server::OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
MapUserdata* userdata) {
std::unique_ptr<MapUserdata> data(userdata);

View File

@ -345,8 +345,8 @@ void DawnTest::OnDeviceError(const char* message, DawnCallbackUserdata userdata)
std::ostringstream& DawnTest::AddBufferExpectation(const char* file,
int line,
const dawn::Buffer& buffer,
uint32_t offset,
uint32_t size,
uint64_t offset,
uint64_t size,
detail::Expectation* expectation) {
auto readback = ReserveReadback(size);
@ -440,7 +440,7 @@ void DawnTest::FlushWire() {
}
}
DawnTest::ReadbackReservation DawnTest::ReserveReadback(uint32_t readbackSize) {
DawnTest::ReadbackReservation DawnTest::ReserveReadback(uint64_t readbackSize) {
// For now create a new MapRead buffer for each readback
// TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly?
dawn::BufferDescriptor descriptor;
@ -483,7 +483,7 @@ void DawnTest::MapSlotsSynchronously() {
// static
void DawnTest::SlotMapReadCallback(DawnBufferMapAsyncStatus status,
const void* data,
uint32_t,
uint64_t,
DawnCallbackUserdata userdata_) {
DAWN_ASSERT(status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS);

View File

@ -143,8 +143,8 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
std::ostringstream& AddBufferExpectation(const char* file,
int line,
const dawn::Buffer& buffer,
uint32_t offset,
uint32_t size,
uint64_t offset,
uint64_t size,
detail::Expectation* expectation);
std::ostringstream& AddTextureExpectation(const char* file,
int line,
@ -178,7 +178,7 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
// MapRead buffers used to get data for the expectations
struct ReadbackSlot {
dawn::Buffer buffer;
uint32_t bufferSize;
uint64_t bufferSize;
const void* mappedData = nullptr;
};
std::vector<ReadbackSlot> mReadbackSlots;
@ -187,7 +187,7 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
void MapSlotsSynchronously();
static void SlotMapReadCallback(DawnBufferMapAsyncStatus status,
const void* data,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata);
size_t mNumPendingMapOperations = 0;
@ -195,16 +195,16 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
struct ReadbackReservation {
dawn::Buffer buffer;
size_t slot;
uint32_t offset;
uint64_t offset;
};
ReadbackReservation ReserveReadback(uint32_t readbackSize);
ReadbackReservation ReserveReadback(uint64_t readbackSize);
struct DeferredExpectation {
const char* file;
int line;
size_t readbackSlot;
uint32_t readbackOffset;
uint32_t size;
uint64_t readbackOffset;
uint64_t size;
uint32_t rowBytes;
uint32_t rowPitch;
std::unique_ptr<detail::Expectation> expectation;

View File

@ -20,7 +20,7 @@ class BufferMapReadTests : public DawnTest {
protected:
static void MapReadCallback(DawnBufferMapAsyncStatus status,
const void* data,
uint32_t,
uint64_t,
DawnCallbackUserdata userdata) {
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
ASSERT_NE(nullptr, data);
@ -87,7 +87,7 @@ class BufferMapWriteTests : public DawnTest {
protected:
static void MapWriteCallback(DawnBufferMapAsyncStatus status,
void* data,
uint32_t,
uint64_t,
DawnCallbackUserdata userdata) {
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
ASSERT_NE(nullptr, data);
@ -171,7 +171,7 @@ TEST_P(BufferSetSubDataTests, SmallDataAtOffset) {
descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
constexpr uint32_t kOffset = 2000;
constexpr uint64_t kOffset = 2000;
uint32_t value = 0x01020304;
buffer.SetSubData(kOffset, sizeof(value), reinterpret_cast<uint8_t*>(&value));
@ -189,7 +189,7 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) {
// executing these commands in-flight. If this takes longer than ~2s, a device reset occurs and
// fails the test. Since GPUs may or may not complete by then, this test must be disabled OR
// modified to be well-below the timeout limit.
constexpr uint32_t kSize = 4000 * 1000;
constexpr uint64_t kSize = 4000 * 1000;
constexpr uint32_t kElements = 500 * 500;
dawn::BufferDescriptor descriptor;
descriptor.size = kSize;
@ -207,7 +207,7 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) {
// Test using SetSubData for lots of data
TEST_P(BufferSetSubDataTests, LargeSetSubData) {
constexpr uint32_t kSize = 4000 * 1000;
constexpr uint64_t kSize = 4000 * 1000;
constexpr uint32_t kElements = 1000 * 1000;
dawn::BufferDescriptor descriptor;
descriptor.size = kSize;

View File

@ -35,8 +35,8 @@ class CopyTests : public DawnTest {
};
struct BufferSpec {
uint32_t size;
uint32_t offset;
uint64_t size;
uint64_t offset;
uint32_t rowPitch;
};
@ -123,7 +123,7 @@ class CopyTests_T2B : public CopyTests {
std::vector<RGBA8> emptyData(bufferSpec.size / kBytesPerTexel * textureSpec.arraySize);
buffer.SetSubData(0, static_cast<uint32_t>(emptyData.size() * sizeof(RGBA8)), reinterpret_cast<const uint8_t*>(emptyData.data()));
uint32_t bufferOffset = bufferSpec.offset;
uint64_t bufferOffset = bufferSpec.offset;
for (uint32_t slice = 0; slice < textureSpec.arraySize; ++slice) {
// Copy the region [(`x`, `y`), (`x + copyWidth, `y + copyWidth`)] from the `level` mip into the buffer at `offset + bufferSpec.size * slice` and `rowPitch`
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
@ -463,7 +463,7 @@ TEST_P(CopyTests_T2B, OffsetBufferAligned) {
constexpr uint32_t kHeight = 128;
for (unsigned int i = 0; i < 3; ++i) {
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
uint32_t offset = 512 * i;
uint64_t offset = 512 * i;
bufferSpec.size += offset;
bufferSpec.offset += offset;
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);
@ -627,7 +627,7 @@ TEST_P(CopyTests_B2T, OffsetBufferAligned) {
constexpr uint32_t kHeight = 128;
for (unsigned int i = 0; i < 3; ++i) {
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
uint32_t offset = 512 * i;
uint64_t offset = 512 * i;
bufferSpec.size += offset;
bufferSpec.offset += offset;
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);

View File

@ -70,7 +70,7 @@ class DestroyTest : public DawnTest {
dawn::Buffer vertexBuffer;
dawn::CommandBuffer CreateTriangleCommandBuffer() {
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);

View File

@ -80,7 +80,7 @@ class DrawIndexedTest : public DawnTest {
void Test(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex,
uint32_t baseVertex, uint32_t firstInstance, RGBA8 bottomLeftExpected,
RGBA8 topRightExpected) {
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(

View File

@ -73,7 +73,7 @@ class DrawTest : public DawnTest {
uint32_t firstInstance,
RGBA8 bottomLeftExpected,
RGBA8 topRightExpected) {
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);

View File

@ -78,7 +78,7 @@ TEST_P(IndexFormatTest, Uint32) {
1, 2, 3
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -109,7 +109,7 @@ TEST_P(IndexFormatTest, Uint16) {
1, 2, 0, 0, 0, 0
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -153,7 +153,7 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) {
0, 1, 2, 0xFFFFFFFFu, 3, 4, 2,
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -189,7 +189,7 @@ TEST_P(IndexFormatTest, Uint16PrimitiveRestart) {
0xFFFFu,
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -228,7 +228,7 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) {
1, 2, 3
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -263,7 +263,7 @@ TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) {
0, 1, 2
});
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);

View File

@ -134,13 +134,13 @@ class InputStateTest : public DawnTest {
struct InputSpec {
uint32_t slot;
uint32_t stride;
uint64_t stride;
InputStepMode step;
};
struct AttributeSpec {
uint32_t location;
uint32_t slot;
uint32_t offset;
uint64_t offset;
VertexFormat format;
};
@ -187,7 +187,7 @@ class InputStateTest : public DawnTest {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
for (const auto& buffer : vertexBuffers) {
pass.SetVertexBuffers(buffer.location, 1, buffer.buffer, &zeroOffset);
}
@ -422,7 +422,7 @@ TEST_P(InputStateTest, UnusedVertexSlot) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);
@ -465,7 +465,7 @@ TEST_P(InputStateTest, MultiplePipelinesMixedInputState) {
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
uint32_t zeroOffset = 0;
uint64_t zeroOffset = 0;
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);

View File

@ -193,7 +193,7 @@ class PrimitiveTopologyTest : public DawnTest {
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
static const uint32_t zeroOffset = 0;
static const uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(

View File

@ -35,7 +35,7 @@ namespace {
};
struct BufferSpec {
uint32_t offset;
uint64_t offset;
uint32_t rowPitch;
uint32_t imageHeight;
};

View File

@ -25,14 +25,14 @@ class MockBufferMapReadCallback {
MOCK_METHOD4(Call,
void(DawnBufferMapAsyncStatus status,
const uint32_t* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata));
};
static std::unique_ptr<MockBufferMapReadCallback> mockBufferMapReadCallback;
static void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
// Assume the data is uint32_t to make writing matchers easier
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), dataLength,
@ -44,14 +44,14 @@ class MockBufferMapWriteCallback {
MOCK_METHOD4(Call,
void(DawnBufferMapAsyncStatus status,
uint32_t* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata));
};
static std::unique_ptr<MockBufferMapWriteCallback> mockBufferMapWriteCallback;
static void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
// Assume the data is uint32_t to make writing matchers easier
mockBufferMapWriteCallback->Call(status, reinterpret_cast<uint32_t*>(ptr), dataLength,
@ -60,21 +60,21 @@ static void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
class BufferValidationTest : public ValidationTest {
protected:
dawn::Buffer CreateMapReadBuffer(uint32_t size) {
dawn::Buffer CreateMapReadBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = dawn::BufferUsageBit::MapRead;
return device.CreateBuffer(&descriptor);
}
dawn::Buffer CreateMapWriteBuffer(uint32_t size) {
dawn::Buffer CreateMapWriteBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = dawn::BufferUsageBit::MapWrite;
return device.CreateBuffer(&descriptor);
}
dawn::Buffer CreateSetSubDataBuffer(uint32_t size) {
dawn::Buffer CreateSetSubDataBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = dawn::BufferUsageBit::TransferDst;
@ -455,7 +455,7 @@ TEST_F(BufferValidationTest, SetSubDataOutOfBoundsOverflow) {
// An offset that when added to "2" would overflow to be zero and pass validation without
// overflow checks.
uint32_t offset = uint32_t(int32_t(0) - int32_t(2));
uint64_t offset = uint64_t(int64_t(0) - int64_t(2));
ASSERT_DEVICE_ERROR(buf.SetSubData(offset, 2, foo));
}
@ -492,7 +492,7 @@ TEST_F(BufferValidationTest, SetSubDataWithUnalignedOffset) {
dawn::Buffer buf = device.CreateBuffer(&descriptor);
uint32_t kOffset = 2999;
uint64_t kOffset = 2999;
uint32_t value = 0x01020304;
ASSERT_DEVICE_ERROR(buf.SetSubData(kOffset, sizeof(value), reinterpret_cast<uint8_t*>(&value)));
}

View File

@ -180,7 +180,7 @@ TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
// Use the buffer as both index and vertex in the same pass
uint32_t zero = 0;
uint64_t zero = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
DummyRenderPass dummyRenderPass(device);
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass);

View File

@ -19,7 +19,7 @@
class CopyCommandTest : public ValidationTest {
protected:
dawn::Buffer CreateBuffer(uint32_t size, dawn::BufferUsageBit usage) {
dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsageBit usage) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = usage;
@ -59,7 +59,7 @@ class CopyCommandTest : public ValidationTest {
void TestB2TCopy(utils::Expectation expectation,
dawn::Buffer srcBuffer,
uint32_t srcOffset,
uint64_t srcOffset,
uint32_t srcRowPitch,
uint32_t srcImageHeight,
dawn::Texture destTexture,
@ -84,7 +84,7 @@ class CopyCommandTest : public ValidationTest {
uint32_t srcSlice,
dawn::Origin3D srcOrigin,
dawn::Buffer destBuffer,
uint32_t destOffset,
uint64_t destOffset,
uint32_t destRowPitch,
uint32_t destImageHeight,
dawn::Extent3D extent3D) {
@ -228,7 +228,7 @@ TEST_F(CopyCommandTest_B2B, BuffersInErrorState) {
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
constexpr uint32_t bufferSize = 4;
constexpr uint64_t bufferSize = 4;
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
{
@ -249,7 +249,7 @@ class CopyCommandTest_B2T : public CopyCommandTest {
// Test a successfull B2T copy
TEST_F(CopyCommandTest_B2T, Success) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -302,7 +302,7 @@ TEST_F(CopyCommandTest_B2T, Success) {
// Test OOB conditions on the buffer
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -333,7 +333,7 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
// Test OOB conditions on the texture
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -393,7 +393,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
}
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -412,7 +412,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
}
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
uint32_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -436,7 +436,7 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
// Test B2T copies with incorrect buffer offset usage
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
@ -458,7 +458,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
// Test multisampled textures cannot be used in B2T copies.
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
uint32_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst, 4);
@ -497,7 +497,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
}
{
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
@ -513,7 +513,7 @@ class CopyCommandTest_T2B : public CopyCommandTest {
// Test a successfull T2B copy
TEST_F(CopyCommandTest_T2B, Success) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -566,7 +566,7 @@ TEST_F(CopyCommandTest_T2B, Success) {
// Test OOB conditions on the texture
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -590,7 +590,7 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
// Test OOB conditions on the buffer
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -620,7 +620,7 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -636,7 +636,7 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
// Test T2B copies with incorrect buffer usage
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
@ -653,7 +653,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
}
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferDst);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
@ -672,7 +672,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
}
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
uint32_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -696,7 +696,7 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
// Test T2B copies with incorrect buffer offset usage
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
@ -718,7 +718,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
dawn::TextureUsageBit::TransferSrc, 4);
uint32_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
@ -743,7 +743,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
dawn::Extent3D extent3D = {1, 1, 1};
{
uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);

View File

@ -23,7 +23,7 @@ class QueueSubmitValidationTest : public ValidationTest {
static void StoreTrueMapWriteCallback(DawnBufferMapAsyncStatus status,
void*,
uint32_t,
uint64_t,
DawnCallbackUserdata userdata) {
bool* userdataPtr = reinterpret_cast<bool*>(static_cast<intptr_t>(userdata));
*userdataPtr = true;

View File

@ -97,7 +97,7 @@ TEST_F(VertexBufferValidationTest, VertexInputsInheritedBetweenPipelines) {
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
auto vertexBuffers = MakeVertexBuffers<2>();
uint32_t offsets[] = { 0, 0 };
uint64_t offsets[] = { 0, 0 };
// Check failure when vertex buffer is not set
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@ -132,7 +132,7 @@ TEST_F(VertexBufferValidationTest, VertexInputsNotInheritedBetweenRendePasses) {
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
auto vertexBuffers = MakeVertexBuffers<2>();
uint32_t offsets[] = { 0, 0 };
uint64_t offsets[] = { 0, 0 };
// Check success when vertex buffer is set for each render pass
dawn::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -25,14 +25,14 @@ namespace {
MOCK_METHOD4(Call,
void(DawnBufferMapAsyncStatus status,
const uint32_t* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata));
};
std::unique_ptr<StrictMock<MockBufferMapReadCallback>> mockBufferMapReadCallback;
void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
const void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
// Assume the data is uint32_t to make writing matchers easier
mockBufferMapReadCallback->Call(status, static_cast<const uint32_t*>(ptr), dataLength,
@ -44,7 +44,7 @@ namespace {
MOCK_METHOD4(Call,
void(DawnBufferMapAsyncStatus status,
uint32_t* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata));
};
@ -52,7 +52,7 @@ namespace {
uint32_t* lastMapWritePointer = nullptr;
void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
void* ptr,
uint32_t dataLength,
uint64_t dataLength,
DawnCallbackUserdata userdata) {
// Assume the data is uint32_t to make writing matchers easier
lastMapWritePointer = static_cast<uint32_t*>(ptr);

View File

@ -115,7 +115,7 @@ namespace utils {
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
const void* data,
uint32_t size,
uint64_t size,
dawn::BufferUsageBit usage) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
@ -234,7 +234,7 @@ namespace utils {
}
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
uint32_t offset,
uint64_t offset,
uint32_t rowPitch,
uint32_t imageHeight) {
dawn::BufferCopyView bufferCopyView;
@ -319,8 +319,8 @@ namespace utils {
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
const dawn::Buffer& buffer,
uint32_t offset,
uint32_t size)
uint64_t offset,
uint64_t size)
: binding(binding), buffer(buffer), offset(offset), size(size) {
}

View File

@ -33,7 +33,7 @@ namespace utils {
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
const void* data,
uint32_t size,
uint64_t size,
dawn::BufferUsageBit usage);
template <typename T>
@ -44,7 +44,7 @@ namespace utils {
}
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
uint32_t offset,
uint64_t offset,
uint32_t rowPitch,
uint32_t imageHeight);
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
@ -107,8 +107,8 @@ namespace utils {
BindingInitializationHelper(uint32_t binding, const dawn::TextureView& textureView);
BindingInitializationHelper(uint32_t binding,
const dawn::Buffer& buffer,
uint32_t offset,
uint32_t size);
uint64_t offset,
uint64_t size);
dawn::BindGroupBinding GetAsBinding() const;
@ -116,8 +116,8 @@ namespace utils {
dawn::Sampler sampler;
dawn::TextureView textureView;
dawn::Buffer buffer;
uint32_t offset = 0;
uint32_t size = 0;
uint64_t offset = 0;
uint64_t size = 0;
};
dawn::BindGroup MakeBindGroup(