DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

DXIL Validator doesn't notice obviously bad indices in the createHandleFromBinding op

Open bogner opened this issue 1 year ago • 0 comments

Description Giving the CreateHandle operation an index that is less-than the binding lower bound fails validation:

Function: main: error: Constant values must be in-range for operation.
note: at '%0 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 1, i32 1, i32 0, i1 false)' in block 'entry' of function 'main'.

However, this passes the validator if we have the same error but are using DXIL 1.6+'s CreateHandleFromBinding.

Steps to Reproduce Craft a resource binding with a lower bound greater than zero and then index it at 0.

; call has binding info starting at 1 but index at 0:
call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 1, i32 1, i32 4, i8 1 }, i32 0, i1 false)
; metadata for the same binding:
!{i32 1, %"class.RWBuffer<vector<float, 4> >"* undef, !"", i32 4, i32 1, i32 1, i32 10, i1 false, i1 false, i1 false, !7}

Environment

  • DXC version: dxcompiler.dll: 1.8 - 1.8.0.14766 (main, ac36a797d); dxil.dll: 1.8(1.8.0.14766)

bogner avatar Nov 22 '24 18:11 bogner