[Flint] adding compute resource layout lowering
This commit is contained in:
@@ -12,6 +12,7 @@ pub const Error = shared.Error || compute.Error || error{
|
||||
UnsupportedExecutionSize,
|
||||
UnsupportedDataType,
|
||||
InvalidPhysicalFlag,
|
||||
InvalidBindingTableIndex,
|
||||
InvalidPayloadLayout,
|
||||
};
|
||||
|
||||
@@ -54,10 +55,12 @@ fn validateInstruction(inst: instruction.Instruction) Error!void {
|
||||
switch (inst.operation) {
|
||||
.load_global_invocation_id => |op| try validateDestination(op.destination),
|
||||
.load_buffer => |op| {
|
||||
try validateBufferReference(op.buffer);
|
||||
try validateDestination(op.destination);
|
||||
try validateSource(op.byte_offset);
|
||||
},
|
||||
.store_buffer => |op| {
|
||||
try validateBufferReference(op.buffer);
|
||||
try validateSource(op.byte_offset);
|
||||
try validateSource(op.source);
|
||||
},
|
||||
@@ -88,6 +91,14 @@ fn validateInstruction(inst: instruction.Instruction) Error!void {
|
||||
}
|
||||
}
|
||||
|
||||
fn validateBufferReference(reference: instruction.BufferReference) Error!void {
|
||||
switch (reference) {
|
||||
.logical => {},
|
||||
.binding_table => |index| if (index >= compute.resource_layout.max_storage_buffers)
|
||||
return Error.InvalidBindingTableIndex,
|
||||
}
|
||||
}
|
||||
|
||||
fn validateSource(source: operand.Source) Error!void {
|
||||
try validateType(source.type);
|
||||
switch (source.register) {
|
||||
|
||||
Reference in New Issue
Block a user