Skip to content

Support extension intrinsics on resources - #24

Merged
David Peixotto (dmpots) merged 1 commit into
microsoft:dxil-v1.0from
dmpots:ext_resource_v1.0
Jan 24, 2017
Merged

David Peixotto (dmpots) merged 1 commit into
microsoft:dxil-v1.0from
dmpots:ext_resource_v1.0

Conversation

@dmpots

Copy link
Copy Markdown
Contributor

This commit adds support for extension intrinsics that work as
methods on resources. For example, we could have an extension
on buffers called MyBufferOp

Buffer<float2> buf;
float2 val = buf.MyBufferOp(int2(1, 2))

To support extension methods we add a new resource lowering strategy
that does three transformations to the intrinsic call

  1. Expand vectors in place in the call arguments.
  2. Convert non-void return value to dx.types.ResRet.
  3. Convert resource parameter to dx.types.Handle value.

For example, assuming that MyBufferOp has opcode 138. The resource
lowering strategy would convert the call as HL-dxil to dxil as
follows

call <2 x float> MyBufferOp(i32 138, %class.Buffer %3, <2 x i32> <1 , 2> )
==>
call %dx.types.ResRet.f32 MyBufferOp(i32 138, %dx.types.Handle %buf, i32 1, i32 2 )

This commit adds support for extension intrinsics that work as
methods on resources. For example, we could have an extension
on buffers called `MyBufferOp`

    Buffer<float2> buf;
    float2 val = buf.MyBufferOp(int2(1, 2))

To support extension methods we add a new resource lowering strategy
that does three transformations to the intrinsic call

1. Expand vectors in place in the call arguments.
2. Convert non-void return value to dx.types.ResRet.
3. Convert resource parameter to dx.types.Handle value.

For example, assuming that MyBufferOp has opcode 138. The resource
lowering strategy would convert the call as HL-dxil to dxil as
follows

    call <2 x float> MyBufferOp(i32 138, %class.Buffer %3, <2 x i32> <1 , 2> )
    ==>
    call %dx.types.ResRet.f32 MyBufferOp(i32 138, %dx.types.Handle %buf, i32 1, i32 2 )
@msftclas

Hi David Peixotto (@dmpots), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (David Peixotto). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@dmpots
David Peixotto (dmpots) merged commit 0f3789f into microsoft:dxil-v1.0 Jan 24, 2017
@dmpots
David Peixotto (dmpots) deleted the ext_resource_v1.0 branch January 24, 2017 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants