Skip to content

Add interpolate legalization pass - #4220

Merged
s-perron merged 1 commit into
KhronosGroup:masterfrom
greg-lunarg:interp1
Mar 31, 2021
Merged

s-perron merged 1 commit into
KhronosGroup:masterfrom
greg-lunarg:interp1

Conversation

@greg-lunarg

@greg-lunarg greg-lunarg commented Mar 29, 2021 •

Copy link
Copy Markdown
Contributor

This pass converts an internal form of GLSLstd450 InterpolateAt*
extended ops to the externally valid form. The external form takes
the lvalue of the interpolant operand. The internal form optionally
can take a load of the interpolant as the interpolant operand. This
pass removes that load, replacing it with the load's pointer. The
internal form is generated by glslang and possibly other frontends
for HLSL shaders. The new pass is called as part of HLSL legalization
after all propagation of interpolants is complete.

Also adds internal interpolate form to pre-legalization validation

@greg-lunarg

Copy link
Copy Markdown
Contributor Author

@s-perron or @jaebaek Could you please review?

@s-perron
s-perron self-requested a review March 29, 2021 23:31

@s-perron s-perron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally this looks great. I like the use of the instruction folder, it cuts away a lot of the clutter, and make it clear what the pass is doing.

My suggested changes are mostly about comments and variable/function names.

I would like to see this added to the set of legalization passes. Add it to the end. DXC will need this when it starts to handle these instructions.

Comment thread include/spirv-tools/optimizer.hpp Resolved
Comment thread include/spirv-tools/optimizer.hpp Resolved
Comment thread include/spirv-tools/optimizer.hpp Resolved
Comment thread include/spirv-tools/optimizer.hpp Resolved
Comment thread source/opt/interp_fixup_pass.cpp Resolved
Comment thread source/opt/interp_fixup_pass.cpp Resolved
Comment thread source/opt/optimizer.cpp Resolved
Comment thread test/val/val_ext_inst_test.cpp Resolved
@s-perron

Copy link
Copy Markdown
Collaborator

@greg-lunarg Looks like you will need to update the BUILD.gn file as well.

@greg-lunarg

Copy link
Copy Markdown
Contributor Author

I have updated BUILD.gn and added the new pass to legalization.

Thanks for the thorough review!

@s-perron s-perron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed a couple things in my first review.

Comment thread include/spirv-tools/libspirv.h Resolved
Comment thread include/spirv-tools/libspirv.hpp Resolved
Comment thread test/opt/interp_fixup_test.cpp Resolved
This pass converts an internal form of GLSLstd450 Interpolate ops
to the externally valid form. The external form takes the lvalue
of the interpolant. The internal form can do a load of the interpolant.
The pass replaces the load with its pointer. The internal form is
generated by glslang and possibly other frontends for HLSL shaders.
The new pass is called as part of HLSL legalization after all
propagation is complete.

Also adds internal interpolate form to pre-legalization validation
@jaebaek

jaebaek commented Mar 31, 2021

Copy link
Copy Markdown
Contributor

Sorry I did not see your message. Thank you for working on it!

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.

4 participants