Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spirv-val: Make Constant evaluation consistent #5587

Merged

Conversation

spencer-lunarg
Copy link
Contributor

prequel for #5577

We currently have multiple ways to get the constant values, and one to create a single system. This also keeps things consistent to not grab the constant value from a OpSpecConstant* should not be used

if (!_.IsUnsignedIntScalarType(cluster_size_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "ClusterSize must be a scalar of integer type, whose "
"Signedness operand is 0.";
}

uint64_t cluster_size;
if (!_.GetConstantValUint64(cluster_size_op_id, &cluster_size)) {
if (!spvOpcodeIsConstant(cluster_size_inst->opcode())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here is an example were we using what I thought was a "get the constant value" but really here we want to check if it is any Op*Constant and not the value itself

Copy link
Contributor

@alan-baker alan-baker left a comment

Choose a reason for hiding this comment

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

Try rebasing this branch. It feels like the smoketest failures are because this hasn't integrated the latest header changes.

@@ -1374,22 +1374,18 @@ spv_result_t ValidateAccessChain(ValidationState_t& _,
case spv::Op::OpTypeStruct: {
// In case of structures, there is an additional constraint on the
// index: the index must be an OpConstant.
if (spv::Op::OpConstant != cur_word_instr->opcode()) {
int64_t cur_index;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is causing a build failure for android due to shortening later on.

@alan-baker alan-baker merged commit 1b643ea into KhronosGroup:main Feb 21, 2024
24 checks passed
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.

2 participants