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:
parent
952860bf9f
commit
cf52d711fb
30
dawn.json
30
dawn.json
|
@ -32,8 +32,8 @@
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "binding", "type": "uint32_t"},
|
{"name": "binding", "type": "uint32_t"},
|
||||||
{"name": "buffer", "type": "buffer", "optional": true},
|
{"name": "buffer", "type": "buffer", "optional": true},
|
||||||
{"name": "offset", "type": "uint32_t"},
|
{"name": "offset", "type": "uint64_t"},
|
||||||
{"name": "size", "type": "uint32_t"},
|
{"name": "size", "type": "uint64_t"},
|
||||||
{"name": "sampler", "type": "sampler", "optional": true},
|
{"name": "sampler", "type": "sampler", "optional": true},
|
||||||
{"name": "texture view", "type": "texture view", "optional": true}
|
{"name": "texture view", "type": "texture view", "optional": true}
|
||||||
]
|
]
|
||||||
|
@ -142,8 +142,8 @@
|
||||||
{
|
{
|
||||||
"name": "set sub data",
|
"name": "set sub data",
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "start", "type": "uint32_t"},
|
{"name": "start", "type": "uint64_t"},
|
||||||
{"name": "count", "type": "uint32_t"},
|
{"name": "count", "type": "uint64_t"},
|
||||||
{"name": "data", "type": "uint8_t", "annotation": "const*", "length": "count"}
|
{"name": "data", "type": "uint8_t", "annotation": "const*", "length": "count"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -174,7 +174,7 @@
|
||||||
"extensible": true,
|
"extensible": true,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "buffer", "type": "buffer"},
|
{"name": "buffer", "type": "buffer"},
|
||||||
{"name": "offset", "type": "uint32_t"},
|
{"name": "offset", "type": "uint64_t"},
|
||||||
{"name": "row pitch", "type": "uint32_t"},
|
{"name": "row pitch", "type": "uint32_t"},
|
||||||
{"name": "image height", "type": "uint32_t"}
|
{"name": "image height", "type": "uint32_t"}
|
||||||
]
|
]
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
"extensible": true,
|
"extensible": true,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "usage", "type": "buffer usage bit"},
|
{"name": "usage", "type": "buffer usage bit"},
|
||||||
{"name": "size", "type": "uint32_t"}
|
{"name": "size", "type": "uint64_t"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"buffer map read callback": {
|
"buffer map read callback": {
|
||||||
|
@ -267,10 +267,10 @@
|
||||||
"name": "copy buffer to buffer",
|
"name": "copy buffer to buffer",
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "source", "type": "buffer"},
|
{"name": "source", "type": "buffer"},
|
||||||
{"name": "source offset", "type": "uint32_t"},
|
{"name": "source offset", "type": "uint64_t"},
|
||||||
{"name": "destination", "type": "buffer"},
|
{"name": "destination", "type": "buffer"},
|
||||||
{"name": "destination offset", "type": "uint32_t"},
|
{"name": "destination offset", "type": "uint64_t"},
|
||||||
{"name": "size", "type": "uint32_t"}
|
{"name": "size", "type": "uint64_t"}
|
||||||
],
|
],
|
||||||
"TODO": [
|
"TODO": [
|
||||||
"Restrictions on the alignment of the copy? Cf Metal on OSX"
|
"Restrictions on the alignment of the copy? Cf Metal on OSX"
|
||||||
|
@ -359,7 +359,7 @@
|
||||||
{"name": "group index", "type": "uint32_t"},
|
{"name": "group index", "type": "uint32_t"},
|
||||||
{"name": "group", "type": "bind group"},
|
{"name": "group", "type": "bind group"},
|
||||||
{"name": "dynamic offset count", "type": "uint32_t"},
|
{"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": [
|
"members": [
|
||||||
{"name": "shader location", "type": "uint32_t"},
|
{"name": "shader location", "type": "uint32_t"},
|
||||||
{"name": "input slot", "type": "uint32_t"},
|
{"name": "input slot", "type": "uint32_t"},
|
||||||
{"name": "offset", "type": "uint32_t"},
|
{"name": "offset", "type": "uint64_t"},
|
||||||
{"name": "format", "type": "vertex format"}
|
{"name": "format", "type": "vertex format"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -582,7 +582,7 @@
|
||||||
"extensible": false,
|
"extensible": false,
|
||||||
"members": [
|
"members": [
|
||||||
{"name": "input slot", "type": "uint32_t"},
|
{"name": "input slot", "type": "uint32_t"},
|
||||||
{"name": "stride", "type": "uint32_t"},
|
{"name": "stride", "type": "uint64_t"},
|
||||||
{"name": "step mode", "type": "input step mode"}
|
{"name": "step mode", "type": "input step mode"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -741,7 +741,7 @@
|
||||||
{"name": "group index", "type": "uint32_t"},
|
{"name": "group index", "type": "uint32_t"},
|
||||||
{"name": "group", "type": "bind group"},
|
{"name": "group", "type": "bind group"},
|
||||||
{"name": "dynamic offset count", "type": "uint32_t"},
|
{"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": "start slot", "type": "uint32_t"},
|
||||||
{"name": "count", "type": "uint32_t"},
|
{"name": "count", "type": "uint32_t"},
|
||||||
{"name": "buffers", "type": "buffer", "annotation": "const*", "length": "count"},
|
{"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",
|
"name": "set index buffer",
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "buffer", "type": "buffer"},
|
{"name": "buffer", "type": "buffer"},
|
||||||
{"name": "offset", "type": "uint32_t"}
|
{"name": "offset", "type": "uint64_t"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,14 +35,14 @@
|
||||||
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
|
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
|
||||||
{ "name": "request serial", "type": "uint32_t" },
|
{ "name": "request serial", "type": "uint32_t" },
|
||||||
{ "name": "status", "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" }
|
{ "name": "data", "type": "uint8_t", "annotation": "const*", "length": "data length" }
|
||||||
],
|
],
|
||||||
"buffer map write async callback": [
|
"buffer map write async callback": [
|
||||||
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
|
{ "name": "buffer", "type": "ObjectHandle", "handle_type": "buffer" },
|
||||||
{ "name": "request serial", "type": "uint32_t" },
|
{ "name": "request serial", "type": "uint32_t" },
|
||||||
{ "name": "status", "type": "uint32_t" },
|
{ "name": "status", "type": "uint32_t" },
|
||||||
{ "name": "data length", "type": "uint32_t" }
|
{ "name": "data length", "type": "uint64_t" }
|
||||||
],
|
],
|
||||||
"device error callback": [
|
"device error callback": [
|
||||||
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
|
{ "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
|
||||||
|
|
|
@ -256,7 +256,7 @@ void initSim() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i) {
|
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];
|
auto& bufferDst = particleBuffers[(i + 1) % 2];
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void frame() {
|
||||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||||
depthStencilView);
|
depthStencilView);
|
||||||
|
|
||||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
static const uint64_t vertexBufferOffsets[1] = {0};
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||||
|
|
|
@ -249,7 +249,7 @@ void frame() {
|
||||||
s.a = (s.a + 1) % 256;
|
s.a = (s.a + 1) % 256;
|
||||||
s.b += 0.01f;
|
s.b += 0.01f;
|
||||||
if (s.b >= 1.0f) {s.b = 0.0f;}
|
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(
|
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))),
|
glm::vec3(8.f * std::sin(glm::radians(s.b * 360.f)), 2.f, 8.f * std::cos(glm::radians(s.b * 360.f))),
|
||||||
|
|
|
@ -523,7 +523,7 @@ namespace {
|
||||||
uint32_t slot = s.first;
|
uint32_t slot = s.first;
|
||||||
auto it = iPrim.attributes.find(s.second);
|
auto it = iPrim.attributes.find(s.second);
|
||||||
if (it == iPrim.attributes.end()) {
|
if (it == iPrim.attributes.end()) {
|
||||||
uint32_t zero = 0;
|
uint64_t zero = 0;
|
||||||
pass.SetVertexBuffers(slot, 1, &defaultBuffer, &zero);
|
pass.SetVertexBuffers(slot, 1, &defaultBuffer, &zero);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ namespace {
|
||||||
vertexCount = static_cast<uint32_t>(iAccessor.count);
|
vertexCount = static_cast<uint32_t>(iAccessor.count);
|
||||||
}
|
}
|
||||||
const auto& oBuffer = buffers.at(iAccessor.bufferView);
|
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);
|
pass.SetVertexBuffers(slot, 1, &oBuffer, &iBufferOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
// Custom types depending on the target language
|
// Custom types depending on the target language
|
||||||
typedef uint64_t DawnCallbackUserdata;
|
typedef uint64_t DawnCallbackUserdata;
|
||||||
typedef void (*DawnDeviceErrorCallback)(const char* message, DawnCallbackUserdata userdata);
|
typedef void (*DawnDeviceErrorCallback)(const char* message, DawnCallbackUserdata userdata);
|
||||||
typedef void (*DawnBufferMapReadCallback)(DawnBufferMapAsyncStatus status, const 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, uint32_t dataLength, DawnCallbackUserdata userdata);
|
typedef void (*DawnBufferMapWriteCallback)(DawnBufferMapAsyncStatus status, void* data, uint64_t dataLength, DawnCallbackUserdata userdata);
|
||||||
typedef void (*DawnFenceOnCompletionCallback)(DawnFenceCompletionStatus status,
|
typedef void (*DawnFenceOnCompletionCallback)(DawnFenceCompletionStatus status,
|
||||||
DawnCallbackUserdata userdata);
|
DawnCallbackUserdata userdata);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
DAWN_TRY(device->ValidateObject(binding.buffer));
|
DAWN_TRY(device->ValidateObject(binding.buffer));
|
||||||
|
|
||||||
uint32_t bufferSize = binding.buffer->GetSize();
|
uint64_t bufferSize = binding.buffer->GetSize();
|
||||||
if (binding.size > bufferSize) {
|
if (binding.size > bufferSize) {
|
||||||
return DAWN_VALIDATION_ERROR("Buffer binding size larger than the buffer");
|
return DAWN_VALIDATION_ERROR("Buffer binding size larger than the buffer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
struct BufferBinding {
|
struct BufferBinding {
|
||||||
BufferBase* buffer;
|
BufferBase* buffer;
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
uint32_t size;
|
uint64_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BindGroupBase : public ObjectBase {
|
class BindGroupBase : public ObjectBase {
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace dawn_native {
|
||||||
MaybeError ValidateUnmap() const;
|
MaybeError ValidateUnmap() const;
|
||||||
MaybeError ValidateDestroy() const;
|
MaybeError ValidateDestroy() const;
|
||||||
|
|
||||||
uint32_t mSize = 0;
|
uint64_t mSize = 0;
|
||||||
dawn::BufferUsageBit mUsage = dawn::BufferUsageBit::None;
|
dawn::BufferUsageBit mUsage = dawn::BufferUsageBit::None;
|
||||||
|
|
||||||
DawnBufferMapReadCallback mMapReadCallback = nullptr;
|
DawnBufferMapReadCallback mMapReadCallback = nullptr;
|
||||||
|
|
|
@ -62,12 +62,12 @@ namespace dawn_native {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FitsInBuffer(const BufferBase* buffer, uint32_t offset, uint32_t size) {
|
bool FitsInBuffer(const BufferBase* buffer, uint64_t offset, uint64_t size) {
|
||||||
uint32_t bufferSize = buffer->GetSize();
|
uint64_t bufferSize = buffer->GetSize();
|
||||||
return offset <= bufferSize && (size <= (bufferSize - offset));
|
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)) {
|
if (!FitsInBuffer(bufferCopy.buffer.Get(), bufferCopy.offset, dataSize)) {
|
||||||
return DAWN_VALIDATION_ERROR("Copy would overflow the buffer");
|
return DAWN_VALIDATION_ERROR("Copy would overflow the buffer");
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,9 @@ namespace dawn_native {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError ValidateB2BCopySizeAlignment(uint32_t dataSize,
|
MaybeError ValidateB2BCopySizeAlignment(uint64_t dataSize,
|
||||||
uint32_t srcOffset,
|
uint64_t srcOffset,
|
||||||
uint32_t dstOffset) {
|
uint64_t dstOffset) {
|
||||||
// Copy size must be a multiple of 4 bytes on macOS.
|
// Copy size must be a multiple of 4 bytes on macOS.
|
||||||
if (dataSize % 4 != 0) {
|
if (dataSize % 4 != 0) {
|
||||||
return DAWN_VALIDATION_ERROR("Copy size must be a multiple of 4 bytes");
|
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,
|
void CommandEncoderBase::CopyBufferToBuffer(BufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
if (ConsumedError(ValidateCanRecordTopLevelCommands())) {
|
if (ConsumedError(ValidateCanRecordTopLevelCommands())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1165,7 +1165,7 @@ namespace dawn_native {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
SetVertexBuffersCmd* cmd = mIterator.NextCommand<SetVertexBuffersCmd>();
|
SetVertexBuffersCmd* cmd = mIterator.NextCommand<SetVertexBuffersCmd>();
|
||||||
auto buffers = mIterator.NextData<Ref<BufferBase>>(cmd->count);
|
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) {
|
for (uint32_t i = 0; i < cmd->count; ++i) {
|
||||||
usageTracker.BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);
|
usageTracker.BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace dawn_native {
|
||||||
ComputePassEncoderBase* BeginComputePass();
|
ComputePassEncoderBase* BeginComputePass();
|
||||||
RenderPassEncoderBase* BeginRenderPass(const RenderPassDescriptor* info);
|
RenderPassEncoderBase* BeginRenderPass(const RenderPassDescriptor* info);
|
||||||
void CopyBufferToBuffer(BufferBase* source,
|
void CopyBufferToBuffer(BufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size);
|
uint64_t size);
|
||||||
void CopyBufferToTexture(const BufferCopyView* source,
|
void CopyBufferToTexture(const BufferCopyView* source,
|
||||||
const TextureCopyView* destination,
|
const TextureCopyView* destination,
|
||||||
const Extent3D* copySize);
|
const Extent3D* copySize);
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace dawn_native {
|
||||||
for (size_t i = 0; i < cmd->count; ++i) {
|
for (size_t i = 0; i < cmd->count; ++i) {
|
||||||
(&buffers[i])->~Ref<BufferBase>();
|
(&buffers[i])->~Ref<BufferBase>();
|
||||||
}
|
}
|
||||||
commands->NextData<uint32_t>(cmd->count);
|
commands->NextData<uint64_t>(cmd->count);
|
||||||
cmd->~SetVertexBuffersCmd();
|
cmd->~SetVertexBuffersCmd();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ namespace dawn_native {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
auto* cmd = commands->NextCommand<SetVertexBuffersCmd>();
|
auto* cmd = commands->NextCommand<SetVertexBuffersCmd>();
|
||||||
commands->NextData<Ref<BufferBase>>(cmd->count);
|
commands->NextData<Ref<BufferBase>>(cmd->count);
|
||||||
commands->NextData<uint32_t>(cmd->count);
|
commands->NextData<uint64_t>(cmd->count);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
struct BufferCopy {
|
struct BufferCopy {
|
||||||
Ref<BufferBase> buffer;
|
Ref<BufferBase> buffer;
|
||||||
uint32_t offset; // Bytes
|
uint64_t offset; // Bytes
|
||||||
uint32_t rowPitch; // Bytes
|
uint32_t rowPitch; // Bytes
|
||||||
uint32_t imageHeight; // Texels
|
uint32_t imageHeight; // Texels
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,7 @@ namespace dawn_native {
|
||||||
struct CopyBufferToBufferCmd {
|
struct CopyBufferToBufferCmd {
|
||||||
BufferCopy source;
|
BufferCopy source;
|
||||||
BufferCopy destination;
|
BufferCopy destination;
|
||||||
uint32_t size;
|
uint64_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CopyBufferToTextureCmd {
|
struct CopyBufferToTextureCmd {
|
||||||
|
@ -194,7 +194,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
struct SetIndexBufferCmd {
|
struct SetIndexBufferCmd {
|
||||||
Ref<BufferBase> buffer;
|
Ref<BufferBase> buffer;
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SetVertexBuffersCmd {
|
struct SetVertexBuffersCmd {
|
||||||
|
|
|
@ -108,10 +108,10 @@ namespace dawn_native {
|
||||||
virtual ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(
|
virtual ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(
|
||||||
size_t size) = 0;
|
size_t size) = 0;
|
||||||
virtual MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
virtual MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) = 0;
|
uint64_t size) = 0;
|
||||||
|
|
||||||
ResultOrError<DynamicUploader*> GetDynamicUploader() const;
|
ResultOrError<DynamicUploader*> GetDynamicUploader() const;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace dawn_native {
|
||||||
void ProgrammablePassEncoder::SetBindGroup(uint32_t groupIndex,
|
void ProgrammablePassEncoder::SetBindGroup(uint32_t groupIndex,
|
||||||
BindGroupBase* group,
|
BindGroupBase* group,
|
||||||
uint32_t dynamicOffsetCount,
|
uint32_t dynamicOffsetCount,
|
||||||
const uint32_t* dynamicOffsets) {
|
const uint64_t* dynamicOffsets) {
|
||||||
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
|
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
|
||||||
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(group))) {
|
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(group))) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native {
|
||||||
void SetBindGroup(uint32_t groupIndex,
|
void SetBindGroup(uint32_t groupIndex,
|
||||||
BindGroupBase* group,
|
BindGroupBase* group,
|
||||||
uint32_t dynamicOffsetCount,
|
uint32_t dynamicOffsetCount,
|
||||||
const uint32_t* dynamicOffsets);
|
const uint64_t* dynamicOffsets);
|
||||||
void SetPushConstants(dawn::ShaderStageBit stages,
|
void SetPushConstants(dawn::ShaderStageBit stages,
|
||||||
uint32_t offset,
|
uint32_t offset,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace dawn_native {
|
||||||
cmd->height = height;
|
cmd->height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoderBase::SetIndexBuffer(BufferBase* buffer, uint32_t offset) {
|
void RenderPassEncoderBase::SetIndexBuffer(BufferBase* buffer, uint64_t offset) {
|
||||||
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
|
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands()) ||
|
||||||
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(buffer))) {
|
mTopLevelEncoder->ConsumedError(GetDevice()->ValidateObject(buffer))) {
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +143,7 @@ namespace dawn_native {
|
||||||
void RenderPassEncoderBase::SetVertexBuffers(uint32_t startSlot,
|
void RenderPassEncoderBase::SetVertexBuffers(uint32_t startSlot,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
BufferBase* const* buffers,
|
BufferBase* const* buffers,
|
||||||
uint32_t const* offsets) {
|
uint64_t const* offsets) {
|
||||||
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
|
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,8 @@ namespace dawn_native {
|
||||||
new (&cmdBuffers[i]) Ref<BufferBase>(buffers[i]);
|
new (&cmdBuffers[i]) Ref<BufferBase>(buffers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t* cmdOffsets = mAllocator->AllocateData<uint32_t>(count);
|
uint64_t* cmdOffsets = mAllocator->AllocateData<uint64_t>(count);
|
||||||
memcpy(cmdOffsets, offsets, count * sizeof(uint32_t));
|
memcpy(cmdOffsets, offsets, count * sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace dawn_native {
|
||||||
void SetVertexBuffers(uint32_t startSlot,
|
void SetVertexBuffers(uint32_t startSlot,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
T* const* buffers,
|
T* const* buffers,
|
||||||
uint32_t const* offsets) {
|
uint64_t const* offsets) {
|
||||||
static_assert(std::is_base_of<BufferBase, T>::value, "");
|
static_assert(std::is_base_of<BufferBase, T>::value, "");
|
||||||
SetVertexBuffers(startSlot, count, reinterpret_cast<BufferBase* const*>(buffers),
|
SetVertexBuffers(startSlot, count, reinterpret_cast<BufferBase* const*>(buffers),
|
||||||
offsets);
|
offsets);
|
||||||
|
@ -61,8 +61,8 @@ namespace dawn_native {
|
||||||
void SetVertexBuffers(uint32_t startSlot,
|
void SetVertexBuffers(uint32_t startSlot,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
BufferBase* const* buffers,
|
BufferBase* const* buffers,
|
||||||
uint32_t const* offsets);
|
uint64_t const* offsets);
|
||||||
void SetIndexBuffer(BufferBase* buffer, uint32_t offset);
|
void SetIndexBuffer(BufferBase* buffer, uint64_t offset);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RenderPassEncoderBase(DeviceBase* device,
|
RenderPassEncoderBase(DeviceBase* device,
|
||||||
|
|
|
@ -861,7 +861,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
||||||
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
|
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 =
|
vertexBuffersInfo.startSlot =
|
||||||
std::min(vertexBuffersInfo.startSlot, cmd->startSlot);
|
std::min(vertexBuffersInfo.startSlot, cmd->startSlot);
|
||||||
|
|
|
@ -253,10 +253,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
ToBackend(destination)
|
ToBackend(destination)
|
||||||
->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::TransferDst);
|
->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||||
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) override;
|
uint64_t size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||||
|
|
|
@ -39,14 +39,15 @@ namespace dawn_native { namespace d3d12 {
|
||||||
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
|
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
|
||||||
Extent3D copySize,
|
Extent3D copySize,
|
||||||
uint32_t texelSize,
|
uint32_t texelSize,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t rowPitch,
|
uint32_t rowPitch,
|
||||||
uint32_t imageHeight) {
|
uint32_t imageHeight) {
|
||||||
TextureCopySplit copy;
|
TextureCopySplit copy;
|
||||||
|
|
||||||
ASSERT(rowPitch % texelSize == 0);
|
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;
|
copy.offset = alignedOffset;
|
||||||
if (offset == alignedOffset) {
|
if (offset == alignedOffset) {
|
||||||
|
@ -67,10 +68,11 @@ namespace dawn_native { namespace d3d12 {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(alignedOffset < offset);
|
ASSERT(alignedOffset < offset);
|
||||||
|
ASSERT(offset - alignedOffset < D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT);
|
||||||
|
|
||||||
Origin3D texelOffset;
|
Origin3D texelOffset;
|
||||||
ComputeTexelOffsets(offset - alignedOffset, rowPitch, rowPitch * imageHeight, texelSize,
|
ComputeTexelOffsets(static_cast<uint32_t>(offset - alignedOffset), rowPitch,
|
||||||
&texelOffset);
|
rowPitch * imageHeight, texelSize, &texelOffset);
|
||||||
|
|
||||||
uint32_t rowPitchInTexels = rowPitch / texelSize;
|
uint32_t rowPitchInTexels = rowPitch / texelSize;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
Extent3D copySize;
|
Extent3D copySize;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t offset = 0;
|
uint64_t offset = 0;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
std::array<CopyInfo, kMaxTextureCopyRegions> copies;
|
std::array<CopyInfo, kMaxTextureCopyRegions> copies;
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
|
TextureCopySplit ComputeTextureCopySplit(Origin3D origin,
|
||||||
Extent3D copySize,
|
Extent3D copySize,
|
||||||
uint32_t texelSize,
|
uint32_t texelSize,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t rowPitch,
|
uint32_t rowPitch,
|
||||||
uint32_t imageHeight);
|
uint32_t imageHeight);
|
||||||
}} // namespace dawn_native::d3d12
|
}} // namespace dawn_native::d3d12
|
||||||
|
|
|
@ -307,7 +307,7 @@ namespace dawn_native { namespace metal {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t offset = src.offset;
|
uint64_t offset = src.offset;
|
||||||
|
|
||||||
// Doing all the copy except the last image.
|
// Doing all the copy except the last image.
|
||||||
if (size.depth > 1) {
|
if (size.depth > 1) {
|
||||||
|
@ -419,7 +419,7 @@ namespace dawn_native { namespace metal {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t offset = dst.offset;
|
uint64_t offset = dst.offset;
|
||||||
|
|
||||||
// Doing all the copy except the last image.
|
// Doing all the copy except the last image.
|
||||||
if (size.depth > 1) {
|
if (size.depth > 1) {
|
||||||
|
@ -743,7 +743,7 @@ namespace dawn_native { namespace metal {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
||||||
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
|
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<id<MTLBuffer>, kMaxVertexInputs> mtlBuffers;
|
||||||
std::array<NSUInteger, kMaxVertexInputs> mtlOffsets;
|
std::array<NSUInteger, kMaxVertexInputs> mtlOffsets;
|
||||||
|
|
|
@ -58,10 +58,10 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||||
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) override;
|
uint64_t size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||||
|
|
|
@ -215,10 +215,10 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
id<MTLBuffer> uploadBuffer = ToBackend(source)->GetBufferHandle();
|
id<MTLBuffer> uploadBuffer = ToBackend(source)->GetBufferHandle();
|
||||||
id<MTLBuffer> buffer = ToBackend(destination)->GetMTLBuffer();
|
id<MTLBuffer> buffer = ToBackend(destination)->GetMTLBuffer();
|
||||||
id<MTLCommandBuffer> commandBuffer = GetPendingCommandBuffer();
|
id<MTLCommandBuffer> commandBuffer = GetPendingCommandBuffer();
|
||||||
|
|
|
@ -125,10 +125,10 @@ namespace dawn_native { namespace null {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
|
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ namespace dawn_native { namespace null {
|
||||||
|
|
||||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||||
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) override;
|
uint64_t size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace dawn_native { namespace opengl {
|
||||||
void OnSetVertexBuffers(uint32_t startSlot,
|
void OnSetVertexBuffers(uint32_t startSlot,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
Ref<BufferBase>* buffers,
|
Ref<BufferBase>* buffers,
|
||||||
uint32_t* offsets) {
|
uint64_t* offsets) {
|
||||||
for (uint32_t i = 0; i < count; ++i) {
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
uint32_t slot = startSlot + i;
|
uint32_t slot = startSlot + i;
|
||||||
mVertexBuffers[slot] = ToBackend(buffers[i].Get());
|
mVertexBuffers[slot] = ToBackend(buffers[i].Get());
|
||||||
|
@ -234,7 +234,7 @@ namespace dawn_native { namespace opengl {
|
||||||
auto attribute = mLastPipeline->GetAttribute(location);
|
auto attribute = mLastPipeline->GetAttribute(location);
|
||||||
|
|
||||||
GLuint buffer = mVertexBuffers[slot]->GetHandle();
|
GLuint buffer = mVertexBuffers[slot]->GetHandle();
|
||||||
uint32_t offset = mVertexBufferOffsets[slot];
|
uint64_t offset = mVertexBufferOffsets[slot];
|
||||||
|
|
||||||
auto input = mLastPipeline->GetInput(slot);
|
auto input = mLastPipeline->GetInput(slot);
|
||||||
auto components = VertexFormatNumComponents(attribute.format);
|
auto components = VertexFormatNumComponents(attribute.format);
|
||||||
|
@ -258,7 +258,7 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
std::bitset<kMaxVertexInputs> mDirtyVertexBuffers;
|
std::bitset<kMaxVertexInputs> mDirtyVertexBuffers;
|
||||||
std::array<Buffer*, kMaxVertexInputs> mVertexBuffers;
|
std::array<Buffer*, kMaxVertexInputs> mVertexBuffers;
|
||||||
std::array<uint32_t, kMaxVertexInputs> mVertexBufferOffsets;
|
std::array<uint64_t, kMaxVertexInputs> mVertexBufferOffsets;
|
||||||
|
|
||||||
RenderPipelineBase* mLastPipeline = nullptr;
|
RenderPipelineBase* mLastPipeline = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -692,7 +692,7 @@ namespace dawn_native { namespace opengl {
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderPipeline* lastPipeline = nullptr;
|
RenderPipeline* lastPipeline = nullptr;
|
||||||
uint32_t indexBufferBaseOffset = 0;
|
uint64_t indexBufferBaseOffset = 0;
|
||||||
|
|
||||||
PersistentPipelineState persistentPipelineState;
|
PersistentPipelineState persistentPipelineState;
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ namespace dawn_native { namespace opengl {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
||||||
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
|
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);
|
inputBuffers.OnSetVertexBuffers(cmd->startSlot, cmd->count, buffers, offsets);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -149,10 +149,10 @@ namespace dawn_native { namespace opengl {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
|
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,10 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||||
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) override;
|
uint64_t size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||||
|
|
|
@ -611,7 +611,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
SetVertexBuffersCmd* cmd = mCommands.NextCommand<SetVertexBuffersCmd>();
|
||||||
auto buffers = mCommands.NextData<Ref<BufferBase>>(cmd->count);
|
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<VkBuffer, kMaxVertexInputs> vkBuffers;
|
||||||
std::array<VkDeviceSize, kMaxVertexInputs> vkOffsets;
|
std::array<VkDeviceSize, kMaxVertexInputs> vkOffsets;
|
||||||
|
|
|
@ -502,10 +502,10 @@ namespace dawn_native { namespace vulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError Device::CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) {
|
uint64_t size) {
|
||||||
// Insert memory barrier to ensure host write operations are made visible before
|
// 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).
|
// copying from the staging buffer. However, this barrier can be removed (see note below).
|
||||||
//
|
//
|
||||||
|
|
|
@ -72,10 +72,11 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||||
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
||||||
uint32_t sourceOffset,
|
uint64_t sourceOffset,
|
||||||
BufferBase* destination,
|
BufferBase* destination,
|
||||||
uint32_t destinationOffset,
|
uint64_t destinationOffset,
|
||||||
uint32_t size) override;
|
uint64_t size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
||||||
const BindGroupDescriptor* descriptor) override;
|
const BindGroupDescriptor* descriptor) override;
|
||||||
|
|
|
@ -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
|
// Only one mapped pointer can be active at a time because Unmap clears all the in-flight
|
||||||
// requests.
|
// requests.
|
||||||
void* mappedData = nullptr;
|
void* mappedData = nullptr;
|
||||||
size_t mappedDataSize = 0;
|
uint64_t mappedDataSize = 0;
|
||||||
bool isWriteMapped = false;
|
bool isWriteMapped = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_wire { namespace client {
|
||||||
bool Client::DoBufferMapReadAsyncCallback(Buffer* buffer,
|
bool Client::DoBufferMapReadAsyncCallback(Buffer* buffer,
|
||||||
uint32_t requestSerial,
|
uint32_t requestSerial,
|
||||||
uint32_t status,
|
uint32_t status,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
const uint8_t* data) {
|
const uint8_t* data) {
|
||||||
// The buffer might have been deleted or recreated so this isn't an error.
|
// The buffer might have been deleted or recreated so this isn't an error.
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr) {
|
||||||
|
@ -77,7 +77,7 @@ namespace dawn_wire { namespace client {
|
||||||
bool Client::DoBufferMapWriteAsyncCallback(Buffer* buffer,
|
bool Client::DoBufferMapWriteAsyncCallback(Buffer* buffer,
|
||||||
uint32_t requestSerial,
|
uint32_t requestSerial,
|
||||||
uint32_t status,
|
uint32_t status,
|
||||||
uint32_t dataLength) {
|
uint64_t dataLength) {
|
||||||
// The buffer might have been deleted or recreated so this isn't an error.
|
// The buffer might have been deleted or recreated so this isn't an error.
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace dawn_wire { namespace server {
|
||||||
Server* server;
|
Server* server;
|
||||||
ObjectHandle buffer;
|
ObjectHandle buffer;
|
||||||
uint32_t requestSerial;
|
uint32_t requestSerial;
|
||||||
uint32_t size;
|
uint64_t size;
|
||||||
bool isWrite;
|
bool isWrite;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ namespace dawn_wire { namespace server {
|
||||||
static void ForwardDeviceError(const char* message, DawnCallbackUserdata userdata);
|
static void ForwardDeviceError(const char* message, DawnCallbackUserdata userdata);
|
||||||
static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata);
|
DawnCallbackUserdata userdata);
|
||||||
static void ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
|
static void ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata);
|
DawnCallbackUserdata userdata);
|
||||||
static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status,
|
static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status,
|
||||||
DawnCallbackUserdata userdata);
|
DawnCallbackUserdata userdata);
|
||||||
|
@ -64,11 +64,11 @@ namespace dawn_wire { namespace server {
|
||||||
void OnDeviceError(const char* message);
|
void OnDeviceError(const char* message);
|
||||||
void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
MapUserdata* userdata);
|
MapUserdata* userdata);
|
||||||
void OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
|
void OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
MapUserdata* userdata);
|
MapUserdata* userdata);
|
||||||
void OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status,
|
void OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status,
|
||||||
FenceCompletionUserdata* userdata);
|
FenceCompletionUserdata* userdata);
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace dawn_wire { namespace server {
|
||||||
|
|
||||||
void Server::ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
void Server::ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
|
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
|
||||||
data->server->OnBufferMapReadAsyncCallback(status, ptr, dataLength, data);
|
data->server->OnBufferMapReadAsyncCallback(status, ptr, dataLength, data);
|
||||||
|
@ -91,7 +91,7 @@ namespace dawn_wire { namespace server {
|
||||||
|
|
||||||
void Server::ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
|
void Server::ForwardBufferMapWriteAsync(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
|
auto data = reinterpret_cast<MapUserdata*>(static_cast<uintptr_t>(userdata));
|
||||||
data->server->OnBufferMapWriteAsyncCallback(status, ptr, dataLength, data);
|
data->server->OnBufferMapWriteAsyncCallback(status, ptr, dataLength, data);
|
||||||
|
@ -99,7 +99,7 @@ namespace dawn_wire { namespace server {
|
||||||
|
|
||||||
void Server::OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
void Server::OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
MapUserdata* userdata) {
|
MapUserdata* userdata) {
|
||||||
std::unique_ptr<MapUserdata> data(userdata);
|
std::unique_ptr<MapUserdata> data(userdata);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ namespace dawn_wire { namespace server {
|
||||||
|
|
||||||
void Server::OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
|
void Server::OnBufferMapWriteAsyncCallback(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
MapUserdata* userdata) {
|
MapUserdata* userdata) {
|
||||||
std::unique_ptr<MapUserdata> data(userdata);
|
std::unique_ptr<MapUserdata> data(userdata);
|
||||||
|
|
||||||
|
|
|
@ -345,8 +345,8 @@ void DawnTest::OnDeviceError(const char* message, DawnCallbackUserdata userdata)
|
||||||
std::ostringstream& DawnTest::AddBufferExpectation(const char* file,
|
std::ostringstream& DawnTest::AddBufferExpectation(const char* file,
|
||||||
int line,
|
int line,
|
||||||
const dawn::Buffer& buffer,
|
const dawn::Buffer& buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t size,
|
uint64_t size,
|
||||||
detail::Expectation* expectation) {
|
detail::Expectation* expectation) {
|
||||||
auto readback = ReserveReadback(size);
|
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
|
// For now create a new MapRead buffer for each readback
|
||||||
// TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly?
|
// TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly?
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
|
@ -483,7 +483,7 @@ void DawnTest::MapSlotsSynchronously() {
|
||||||
// static
|
// static
|
||||||
void DawnTest::SlotMapReadCallback(DawnBufferMapAsyncStatus status,
|
void DawnTest::SlotMapReadCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* data,
|
const void* data,
|
||||||
uint32_t,
|
uint64_t,
|
||||||
DawnCallbackUserdata userdata_) {
|
DawnCallbackUserdata userdata_) {
|
||||||
DAWN_ASSERT(status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS);
|
DAWN_ASSERT(status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,8 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
|
||||||
std::ostringstream& AddBufferExpectation(const char* file,
|
std::ostringstream& AddBufferExpectation(const char* file,
|
||||||
int line,
|
int line,
|
||||||
const dawn::Buffer& buffer,
|
const dawn::Buffer& buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t size,
|
uint64_t size,
|
||||||
detail::Expectation* expectation);
|
detail::Expectation* expectation);
|
||||||
std::ostringstream& AddTextureExpectation(const char* file,
|
std::ostringstream& AddTextureExpectation(const char* file,
|
||||||
int line,
|
int line,
|
||||||
|
@ -178,7 +178,7 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
|
||||||
// MapRead buffers used to get data for the expectations
|
// MapRead buffers used to get data for the expectations
|
||||||
struct ReadbackSlot {
|
struct ReadbackSlot {
|
||||||
dawn::Buffer buffer;
|
dawn::Buffer buffer;
|
||||||
uint32_t bufferSize;
|
uint64_t bufferSize;
|
||||||
const void* mappedData = nullptr;
|
const void* mappedData = nullptr;
|
||||||
};
|
};
|
||||||
std::vector<ReadbackSlot> mReadbackSlots;
|
std::vector<ReadbackSlot> mReadbackSlots;
|
||||||
|
@ -187,7 +187,7 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
|
||||||
void MapSlotsSynchronously();
|
void MapSlotsSynchronously();
|
||||||
static void SlotMapReadCallback(DawnBufferMapAsyncStatus status,
|
static void SlotMapReadCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* data,
|
const void* data,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata);
|
DawnCallbackUserdata userdata);
|
||||||
size_t mNumPendingMapOperations = 0;
|
size_t mNumPendingMapOperations = 0;
|
||||||
|
|
||||||
|
@ -195,16 +195,16 @@ class DawnTest : public ::testing::TestWithParam<dawn_native::BackendType> {
|
||||||
struct ReadbackReservation {
|
struct ReadbackReservation {
|
||||||
dawn::Buffer buffer;
|
dawn::Buffer buffer;
|
||||||
size_t slot;
|
size_t slot;
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
};
|
};
|
||||||
ReadbackReservation ReserveReadback(uint32_t readbackSize);
|
ReadbackReservation ReserveReadback(uint64_t readbackSize);
|
||||||
|
|
||||||
struct DeferredExpectation {
|
struct DeferredExpectation {
|
||||||
const char* file;
|
const char* file;
|
||||||
int line;
|
int line;
|
||||||
size_t readbackSlot;
|
size_t readbackSlot;
|
||||||
uint32_t readbackOffset;
|
uint64_t readbackOffset;
|
||||||
uint32_t size;
|
uint64_t size;
|
||||||
uint32_t rowBytes;
|
uint32_t rowBytes;
|
||||||
uint32_t rowPitch;
|
uint32_t rowPitch;
|
||||||
std::unique_ptr<detail::Expectation> expectation;
|
std::unique_ptr<detail::Expectation> expectation;
|
||||||
|
|
|
@ -20,7 +20,7 @@ class BufferMapReadTests : public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
static void MapReadCallback(DawnBufferMapAsyncStatus status,
|
static void MapReadCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* data,
|
const void* data,
|
||||||
uint32_t,
|
uint64_t,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
|
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
|
||||||
ASSERT_NE(nullptr, data);
|
ASSERT_NE(nullptr, data);
|
||||||
|
@ -87,7 +87,7 @@ class BufferMapWriteTests : public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
static void MapWriteCallback(DawnBufferMapAsyncStatus status,
|
static void MapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||||
void* data,
|
void* data,
|
||||||
uint32_t,
|
uint64_t,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
|
ASSERT_EQ(DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS, status);
|
||||||
ASSERT_NE(nullptr, data);
|
ASSERT_NE(nullptr, data);
|
||||||
|
@ -171,7 +171,7 @@ TEST_P(BufferSetSubDataTests, SmallDataAtOffset) {
|
||||||
descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||||
|
|
||||||
constexpr uint32_t kOffset = 2000;
|
constexpr uint64_t kOffset = 2000;
|
||||||
uint32_t value = 0x01020304;
|
uint32_t value = 0x01020304;
|
||||||
buffer.SetSubData(kOffset, sizeof(value), reinterpret_cast<uint8_t*>(&value));
|
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
|
// 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
|
// 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.
|
// 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;
|
constexpr uint32_t kElements = 500 * 500;
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = kSize;
|
descriptor.size = kSize;
|
||||||
|
@ -207,7 +207,7 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) {
|
||||||
|
|
||||||
// Test using SetSubData for lots of data
|
// Test using SetSubData for lots of data
|
||||||
TEST_P(BufferSetSubDataTests, LargeSetSubData) {
|
TEST_P(BufferSetSubDataTests, LargeSetSubData) {
|
||||||
constexpr uint32_t kSize = 4000 * 1000;
|
constexpr uint64_t kSize = 4000 * 1000;
|
||||||
constexpr uint32_t kElements = 1000 * 1000;
|
constexpr uint32_t kElements = 1000 * 1000;
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = kSize;
|
descriptor.size = kSize;
|
||||||
|
|
|
@ -35,8 +35,8 @@ class CopyTests : public DawnTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BufferSpec {
|
struct BufferSpec {
|
||||||
uint32_t size;
|
uint64_t size;
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
uint32_t rowPitch;
|
uint32_t rowPitch;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class CopyTests_T2B : public CopyTests {
|
||||||
std::vector<RGBA8> emptyData(bufferSpec.size / kBytesPerTexel * textureSpec.arraySize);
|
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()));
|
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) {
|
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`
|
// 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(
|
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||||
|
@ -463,7 +463,7 @@ TEST_P(CopyTests_T2B, OffsetBufferAligned) {
|
||||||
constexpr uint32_t kHeight = 128;
|
constexpr uint32_t kHeight = 128;
|
||||||
for (unsigned int i = 0; i < 3; ++i) {
|
for (unsigned int i = 0; i < 3; ++i) {
|
||||||
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
|
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
|
||||||
uint32_t offset = 512 * i;
|
uint64_t offset = 512 * i;
|
||||||
bufferSpec.size += offset;
|
bufferSpec.size += offset;
|
||||||
bufferSpec.offset += offset;
|
bufferSpec.offset += offset;
|
||||||
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);
|
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);
|
||||||
|
@ -627,7 +627,7 @@ TEST_P(CopyTests_B2T, OffsetBufferAligned) {
|
||||||
constexpr uint32_t kHeight = 128;
|
constexpr uint32_t kHeight = 128;
|
||||||
for (unsigned int i = 0; i < 3; ++i) {
|
for (unsigned int i = 0; i < 3; ++i) {
|
||||||
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
|
BufferSpec bufferSpec = MinimumBufferSpec(kWidth, kHeight);
|
||||||
uint32_t offset = 512 * i;
|
uint64_t offset = 512 * i;
|
||||||
bufferSpec.size += offset;
|
bufferSpec.size += offset;
|
||||||
bufferSpec.offset += offset;
|
bufferSpec.offset += offset;
|
||||||
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);
|
DoTest({ kWidth, kHeight, 0, 0, kWidth, kHeight, 0 }, bufferSpec);
|
||||||
|
|
|
@ -70,7 +70,7 @@ class DestroyTest : public DawnTest {
|
||||||
dawn::Buffer vertexBuffer;
|
dawn::Buffer vertexBuffer;
|
||||||
|
|
||||||
dawn::CommandBuffer CreateTriangleCommandBuffer() {
|
dawn::CommandBuffer CreateTriangleCommandBuffer() {
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
|
@ -80,7 +80,7 @@ class DrawIndexedTest : public DawnTest {
|
||||||
void Test(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex,
|
void Test(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex,
|
||||||
uint32_t baseVertex, uint32_t firstInstance, RGBA8 bottomLeftExpected,
|
uint32_t baseVertex, uint32_t firstInstance, RGBA8 bottomLeftExpected,
|
||||||
RGBA8 topRightExpected) {
|
RGBA8 topRightExpected) {
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(
|
||||||
|
|
|
@ -73,7 +73,7 @@ class DrawTest : public DawnTest {
|
||||||
uint32_t firstInstance,
|
uint32_t firstInstance,
|
||||||
RGBA8 bottomLeftExpected,
|
RGBA8 bottomLeftExpected,
|
||||||
RGBA8 topRightExpected) {
|
RGBA8 topRightExpected) {
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
|
@ -78,7 +78,7 @@ TEST_P(IndexFormatTest, Uint32) {
|
||||||
1, 2, 3
|
1, 2, 3
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
@ -109,7 +109,7 @@ TEST_P(IndexFormatTest, Uint16) {
|
||||||
1, 2, 0, 0, 0, 0
|
1, 2, 0, 0, 0, 0
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
@ -153,7 +153,7 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) {
|
||||||
0, 1, 2, 0xFFFFFFFFu, 3, 4, 2,
|
0, 1, 2, 0xFFFFFFFFu, 3, 4, 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
@ -189,7 +189,7 @@ TEST_P(IndexFormatTest, Uint16PrimitiveRestart) {
|
||||||
0xFFFFu,
|
0xFFFFu,
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
@ -228,7 +228,7 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) {
|
||||||
1, 2, 3
|
1, 2, 3
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
@ -263,7 +263,7 @@ TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) {
|
||||||
0, 1, 2
|
0, 1, 2
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
|
@ -134,13 +134,13 @@ class InputStateTest : public DawnTest {
|
||||||
|
|
||||||
struct InputSpec {
|
struct InputSpec {
|
||||||
uint32_t slot;
|
uint32_t slot;
|
||||||
uint32_t stride;
|
uint64_t stride;
|
||||||
InputStepMode step;
|
InputStepMode step;
|
||||||
};
|
};
|
||||||
struct AttributeSpec {
|
struct AttributeSpec {
|
||||||
uint32_t location;
|
uint32_t location;
|
||||||
uint32_t slot;
|
uint32_t slot;
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
VertexFormat format;
|
VertexFormat format;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class InputStateTest : public DawnTest {
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
pass.SetPipeline(pipeline);
|
pass.SetPipeline(pipeline);
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
for (const auto& buffer : vertexBuffers) {
|
for (const auto& buffer : vertexBuffers) {
|
||||||
pass.SetVertexBuffers(buffer.location, 1, buffer.buffer, &zeroOffset);
|
pass.SetVertexBuffers(buffer.location, 1, buffer.buffer, &zeroOffset);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ TEST_P(InputStateTest, UnusedVertexSlot) {
|
||||||
|
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
|
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
|
||||||
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);
|
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ TEST_P(InputStateTest, MultiplePipelinesMixedInputState) {
|
||||||
|
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
||||||
uint32_t zeroOffset = 0;
|
uint64_t zeroOffset = 0;
|
||||||
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
|
pass.SetVertexBuffers(0, 1, &buffer, &zeroOffset);
|
||||||
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);
|
pass.SetVertexBuffers(1, 1, &buffer, &zeroOffset);
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||||
|
|
||||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
static const uint32_t zeroOffset = 0;
|
static const uint64_t zeroOffset = 0;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BufferSpec {
|
struct BufferSpec {
|
||||||
uint32_t offset;
|
uint64_t offset;
|
||||||
uint32_t rowPitch;
|
uint32_t rowPitch;
|
||||||
uint32_t imageHeight;
|
uint32_t imageHeight;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,14 +25,14 @@ class MockBufferMapReadCallback {
|
||||||
MOCK_METHOD4(Call,
|
MOCK_METHOD4(Call,
|
||||||
void(DawnBufferMapAsyncStatus status,
|
void(DawnBufferMapAsyncStatus status,
|
||||||
const uint32_t* ptr,
|
const uint32_t* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata));
|
DawnCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unique_ptr<MockBufferMapReadCallback> mockBufferMapReadCallback;
|
static std::unique_ptr<MockBufferMapReadCallback> mockBufferMapReadCallback;
|
||||||
static void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
|
static void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), dataLength,
|
mockBufferMapReadCallback->Call(status, reinterpret_cast<const uint32_t*>(ptr), dataLength,
|
||||||
|
@ -44,14 +44,14 @@ class MockBufferMapWriteCallback {
|
||||||
MOCK_METHOD4(Call,
|
MOCK_METHOD4(Call,
|
||||||
void(DawnBufferMapAsyncStatus status,
|
void(DawnBufferMapAsyncStatus status,
|
||||||
uint32_t* ptr,
|
uint32_t* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata));
|
DawnCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unique_ptr<MockBufferMapWriteCallback> mockBufferMapWriteCallback;
|
static std::unique_ptr<MockBufferMapWriteCallback> mockBufferMapWriteCallback;
|
||||||
static void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
|
static void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
mockBufferMapWriteCallback->Call(status, reinterpret_cast<uint32_t*>(ptr), dataLength,
|
mockBufferMapWriteCallback->Call(status, reinterpret_cast<uint32_t*>(ptr), dataLength,
|
||||||
|
@ -60,21 +60,21 @@ static void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||||
|
|
||||||
class BufferValidationTest : public ValidationTest {
|
class BufferValidationTest : public ValidationTest {
|
||||||
protected:
|
protected:
|
||||||
dawn::Buffer CreateMapReadBuffer(uint32_t size) {
|
dawn::Buffer CreateMapReadBuffer(uint64_t size) {
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
descriptor.usage = dawn::BufferUsageBit::MapRead;
|
descriptor.usage = dawn::BufferUsageBit::MapRead;
|
||||||
|
|
||||||
return device.CreateBuffer(&descriptor);
|
return device.CreateBuffer(&descriptor);
|
||||||
}
|
}
|
||||||
dawn::Buffer CreateMapWriteBuffer(uint32_t size) {
|
dawn::Buffer CreateMapWriteBuffer(uint64_t size) {
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
descriptor.usage = dawn::BufferUsageBit::MapWrite;
|
descriptor.usage = dawn::BufferUsageBit::MapWrite;
|
||||||
|
|
||||||
return device.CreateBuffer(&descriptor);
|
return device.CreateBuffer(&descriptor);
|
||||||
}
|
}
|
||||||
dawn::Buffer CreateSetSubDataBuffer(uint32_t size) {
|
dawn::Buffer CreateSetSubDataBuffer(uint64_t size) {
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
descriptor.usage = dawn::BufferUsageBit::TransferDst;
|
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
|
// An offset that when added to "2" would overflow to be zero and pass validation without
|
||||||
// overflow checks.
|
// 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));
|
ASSERT_DEVICE_ERROR(buf.SetSubData(offset, 2, foo));
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ TEST_F(BufferValidationTest, SetSubDataWithUnalignedOffset) {
|
||||||
|
|
||||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||||
|
|
||||||
uint32_t kOffset = 2999;
|
uint64_t kOffset = 2999;
|
||||||
uint32_t value = 0x01020304;
|
uint32_t value = 0x01020304;
|
||||||
ASSERT_DEVICE_ERROR(buf.SetSubData(kOffset, sizeof(value), reinterpret_cast<uint8_t*>(&value)));
|
ASSERT_DEVICE_ERROR(buf.SetSubData(kOffset, sizeof(value), reinterpret_cast<uint8_t*>(&value)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
|
||||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||||
|
|
||||||
// Use the buffer as both index and vertex in the same pass
|
// 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();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
DummyRenderPass dummyRenderPass(device);
|
DummyRenderPass dummyRenderPass(device);
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
class CopyCommandTest : public ValidationTest {
|
class CopyCommandTest : public ValidationTest {
|
||||||
protected:
|
protected:
|
||||||
dawn::Buffer CreateBuffer(uint32_t size, dawn::BufferUsageBit usage) {
|
dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsageBit usage) {
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
descriptor.usage = usage;
|
descriptor.usage = usage;
|
||||||
|
@ -59,7 +59,7 @@ class CopyCommandTest : public ValidationTest {
|
||||||
|
|
||||||
void TestB2TCopy(utils::Expectation expectation,
|
void TestB2TCopy(utils::Expectation expectation,
|
||||||
dawn::Buffer srcBuffer,
|
dawn::Buffer srcBuffer,
|
||||||
uint32_t srcOffset,
|
uint64_t srcOffset,
|
||||||
uint32_t srcRowPitch,
|
uint32_t srcRowPitch,
|
||||||
uint32_t srcImageHeight,
|
uint32_t srcImageHeight,
|
||||||
dawn::Texture destTexture,
|
dawn::Texture destTexture,
|
||||||
|
@ -84,7 +84,7 @@ class CopyCommandTest : public ValidationTest {
|
||||||
uint32_t srcSlice,
|
uint32_t srcSlice,
|
||||||
dawn::Origin3D srcOrigin,
|
dawn::Origin3D srcOrigin,
|
||||||
dawn::Buffer destBuffer,
|
dawn::Buffer destBuffer,
|
||||||
uint32_t destOffset,
|
uint64_t destOffset,
|
||||||
uint32_t destRowPitch,
|
uint32_t destRowPitch,
|
||||||
uint32_t destImageHeight,
|
uint32_t destImageHeight,
|
||||||
dawn::Extent3D extent3D) {
|
dawn::Extent3D extent3D) {
|
||||||
|
@ -228,7 +228,7 @@ TEST_F(CopyCommandTest_B2B, BuffersInErrorState) {
|
||||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
|
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
|
||||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
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);
|
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ class CopyCommandTest_B2T : public CopyCommandTest {
|
||||||
|
|
||||||
// Test a successfull B2T copy
|
// Test a successfull B2T copy
|
||||||
TEST_F(CopyCommandTest_B2T, Success) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -302,7 +302,7 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
||||||
|
|
||||||
// Test OOB conditions on the buffer
|
// Test OOB conditions on the buffer
|
||||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -333,7 +333,7 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||||
|
|
||||||
// Test OOB conditions on the texture
|
// Test OOB conditions on the texture
|
||||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -393,7 +393,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -412,7 +412,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -436,7 +436,7 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||||
|
|
||||||
// Test B2T copies with incorrect buffer offset usage
|
// Test B2T copies with incorrect buffer offset usage
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
@ -458,7 +458,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||||
|
|
||||||
// Test multisampled textures cannot be used in B2T copies.
|
// Test multisampled textures cannot be used in B2T copies.
|
||||||
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst, 4);
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||||
|
@ -513,7 +513,7 @@ class CopyCommandTest_T2B : public CopyCommandTest {
|
||||||
|
|
||||||
// Test a successfull T2B copy
|
// Test a successfull T2B copy
|
||||||
TEST_F(CopyCommandTest_T2B, Success) {
|
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::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
@ -566,7 +566,7 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
||||||
|
|
||||||
// Test OOB conditions on the texture
|
// Test OOB conditions on the texture
|
||||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
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::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
@ -590,7 +590,7 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||||
|
|
||||||
// Test OOB conditions on the buffer
|
// Test OOB conditions on the buffer
|
||||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
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::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
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 that we force Z=0 and Depth=1 on copies from to 2D textures
|
||||||
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
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::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
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 T2B copies with incorrect buffer usage
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
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::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
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) {
|
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::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
@ -672,7 +672,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
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::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
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 T2B copies with incorrect buffer offset usage
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
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::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
@ -718,7 +718,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||||
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc, 4);
|
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);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
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};
|
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::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||||
|
|
|
@ -23,7 +23,7 @@ class QueueSubmitValidationTest : public ValidationTest {
|
||||||
|
|
||||||
static void StoreTrueMapWriteCallback(DawnBufferMapAsyncStatus status,
|
static void StoreTrueMapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||||
void*,
|
void*,
|
||||||
uint32_t,
|
uint64_t,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
bool* userdataPtr = reinterpret_cast<bool*>(static_cast<intptr_t>(userdata));
|
bool* userdataPtr = reinterpret_cast<bool*>(static_cast<intptr_t>(userdata));
|
||||||
*userdataPtr = true;
|
*userdataPtr = true;
|
||||||
|
|
|
@ -97,7 +97,7 @@ TEST_F(VertexBufferValidationTest, VertexInputsInheritedBetweenPipelines) {
|
||||||
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
|
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
|
||||||
|
|
||||||
auto vertexBuffers = MakeVertexBuffers<2>();
|
auto vertexBuffers = MakeVertexBuffers<2>();
|
||||||
uint32_t offsets[] = { 0, 0 };
|
uint64_t offsets[] = { 0, 0 };
|
||||||
|
|
||||||
// Check failure when vertex buffer is not set
|
// Check failure when vertex buffer is not set
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -132,7 +132,7 @@ TEST_F(VertexBufferValidationTest, VertexInputsNotInheritedBetweenRendePasses) {
|
||||||
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
|
auto pipeline1 = MakeRenderPipeline(vsModule1, 1);
|
||||||
|
|
||||||
auto vertexBuffers = MakeVertexBuffers<2>();
|
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
|
// Check success when vertex buffer is set for each render pass
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -25,14 +25,14 @@ namespace {
|
||||||
MOCK_METHOD4(Call,
|
MOCK_METHOD4(Call,
|
||||||
void(DawnBufferMapAsyncStatus status,
|
void(DawnBufferMapAsyncStatus status,
|
||||||
const uint32_t* ptr,
|
const uint32_t* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata));
|
DawnCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<StrictMock<MockBufferMapReadCallback>> mockBufferMapReadCallback;
|
std::unique_ptr<StrictMock<MockBufferMapReadCallback>> mockBufferMapReadCallback;
|
||||||
void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
|
void ToMockBufferMapReadCallback(DawnBufferMapAsyncStatus status,
|
||||||
const void* ptr,
|
const void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
mockBufferMapReadCallback->Call(status, static_cast<const uint32_t*>(ptr), dataLength,
|
mockBufferMapReadCallback->Call(status, static_cast<const uint32_t*>(ptr), dataLength,
|
||||||
|
@ -44,7 +44,7 @@ namespace {
|
||||||
MOCK_METHOD4(Call,
|
MOCK_METHOD4(Call,
|
||||||
void(DawnBufferMapAsyncStatus status,
|
void(DawnBufferMapAsyncStatus status,
|
||||||
uint32_t* ptr,
|
uint32_t* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata));
|
DawnCallbackUserdata userdata));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace {
|
||||||
uint32_t* lastMapWritePointer = nullptr;
|
uint32_t* lastMapWritePointer = nullptr;
|
||||||
void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
|
void ToMockBufferMapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||||
void* ptr,
|
void* ptr,
|
||||||
uint32_t dataLength,
|
uint64_t dataLength,
|
||||||
DawnCallbackUserdata userdata) {
|
DawnCallbackUserdata userdata) {
|
||||||
// Assume the data is uint32_t to make writing matchers easier
|
// Assume the data is uint32_t to make writing matchers easier
|
||||||
lastMapWritePointer = static_cast<uint32_t*>(ptr);
|
lastMapWritePointer = static_cast<uint32_t*>(ptr);
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace utils {
|
||||||
|
|
||||||
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
||||||
const void* data,
|
const void* data,
|
||||||
uint32_t size,
|
uint64_t size,
|
||||||
dawn::BufferUsageBit usage) {
|
dawn::BufferUsageBit usage) {
|
||||||
dawn::BufferDescriptor descriptor;
|
dawn::BufferDescriptor descriptor;
|
||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
|
@ -234,7 +234,7 @@ namespace utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
|
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t rowPitch,
|
uint32_t rowPitch,
|
||||||
uint32_t imageHeight) {
|
uint32_t imageHeight) {
|
||||||
dawn::BufferCopyView bufferCopyView;
|
dawn::BufferCopyView bufferCopyView;
|
||||||
|
@ -319,8 +319,8 @@ namespace utils {
|
||||||
|
|
||||||
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
|
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
|
||||||
const dawn::Buffer& buffer,
|
const dawn::Buffer& buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t size)
|
uint64_t size)
|
||||||
: binding(binding), buffer(buffer), offset(offset), size(size) {
|
: binding(binding), buffer(buffer), offset(offset), size(size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace utils {
|
||||||
|
|
||||||
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
|
||||||
const void* data,
|
const void* data,
|
||||||
uint32_t size,
|
uint64_t size,
|
||||||
dawn::BufferUsageBit usage);
|
dawn::BufferUsageBit usage);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -44,7 +44,7 @@ namespace utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
|
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t rowPitch,
|
uint32_t rowPitch,
|
||||||
uint32_t imageHeight);
|
uint32_t imageHeight);
|
||||||
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
|
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::TextureView& textureView);
|
||||||
BindingInitializationHelper(uint32_t binding,
|
BindingInitializationHelper(uint32_t binding,
|
||||||
const dawn::Buffer& buffer,
|
const dawn::Buffer& buffer,
|
||||||
uint32_t offset,
|
uint64_t offset,
|
||||||
uint32_t size);
|
uint64_t size);
|
||||||
|
|
||||||
dawn::BindGroupBinding GetAsBinding() const;
|
dawn::BindGroupBinding GetAsBinding() const;
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ namespace utils {
|
||||||
dawn::Sampler sampler;
|
dawn::Sampler sampler;
|
||||||
dawn::TextureView textureView;
|
dawn::TextureView textureView;
|
||||||
dawn::Buffer buffer;
|
dawn::Buffer buffer;
|
||||||
uint32_t offset = 0;
|
uint64_t offset = 0;
|
||||||
uint32_t size = 0;
|
uint64_t size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
dawn::BindGroup MakeBindGroup(
|
dawn::BindGroup MakeBindGroup(
|
||||||
|
|
Loading…
Reference in New Issue