Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Merge requests
!571
hlsl: More ternary fixes.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
hlsl: More ternary fixes.
zfigura/vkd3d:mr0
into
master
Overview
0
Commits
4
Pipelines
3
Changes
2
Merged
Elizabeth Figura
requested to merge
zfigura/vkd3d:mr0
into
master
1 year ago
Overview
0
Commits
4
Pipelines
3
Changes
2
Expand
Merge request reports
Compare
master
version 1
c2c2cab3
1 year ago
master (base)
and
latest version
latest version
9ad48f16
4 commits,
1 year ago
version 1
c2c2cab3
4 commits,
1 year ago
2 files
+
52
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
libs/vkd3d-shader/hlsl.y
+
40
−
0
Options
@@ -4089,14 +4089,54 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block,
struct hlsl_ir_node *cond, struct hlsl_ir_node *first, struct hlsl_ir_node *second)
{
struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
struct hlsl_type *cond_type = cond->data_type;
struct hlsl_type *common_type;
if (cond_type->class > HLSL_CLASS_LAST_NUMERIC)
{
struct vkd3d_string_buffer *string;
if ((string = hlsl_type_to_string(ctx, cond_type)))
hlsl_error(ctx, &cond->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Ternary condition type '%s' is not numeric.", string->buffer);
hlsl_release_string_buffer(ctx, string);
}
if (first->data_type->class <= HLSL_CLASS_LAST_NUMERIC
&& second->data_type->class <= HLSL_CLASS_LAST_NUMERIC)
{
if (!(common_type = get_common_numeric_type(ctx, first, second, &first->loc)))
return false;
if (cond_type->dimx == 1 && cond_type->dimy == 1)
{
cond_type = hlsl_get_numeric_type(ctx, common_type->class,
HLSL_TYPE_BOOL, common_type->dimx, common_type->dimy);
if (!(cond = add_implicit_conversion(ctx, block, cond, cond_type, &cond->loc)))
return false;
}
else if (common_type->dimx == 1 && common_type->dimy == 1)
{
common_type = hlsl_get_numeric_type(ctx, cond_type->class,
common_type->base_type, cond_type->dimx, cond_type->dimy);
}
else if (cond_type->dimx != common_type->dimx || cond_type->dimy != common_type->dimy)
{
/* This condition looks wrong but is correct.
* floatN is compatible with float1xN, but not with floatNx1. */
struct vkd3d_string_buffer *cond_string, *value_string;
cond_string = hlsl_type_to_string(ctx, cond_type);
value_string = hlsl_type_to_string(ctx, common_type);
if (cond_string && value_string)
hlsl_error(ctx, &first->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Ternary condition type '%s' is not compatible with value type '%s'.",
cond_string->buffer, value_string->buffer);
hlsl_release_string_buffer(ctx, cond_string);
hlsl_release_string_buffer(ctx, value_string);
}
if (!(first = add_implicit_conversion(ctx, block, first, common_type, &first->loc)))
return false;
Loading