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
Commits
9cc7aaf5
Commit
9cc7aaf5
authored
3 years ago
by
Elizabeth Figura
Committed by
Alexandre Julliard
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/hlsl: Forbid returning void expressions from void functions.
parent
b29d3489
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!47
hlsl: Function calls.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/vkd3d-shader/hlsl.y
+17
-9
17 additions, 9 deletions
libs/vkd3d-shader/hlsl.y
tests/hlsl-function.shader_test
+1
-1
1 addition, 1 deletion
tests/hlsl-function.shader_test
with
18 additions
and
10 deletions
libs/vkd3d-shader/hlsl.y
+
17
−
9
View file @
9cc7aaf5
...
...
@@ -599,21 +599,29 @@ static struct hlsl_ir_jump *add_return(struct hlsl_ctx *ctx, struct list *instrs
struct hlsl_type *return_type = ctx->cur_function->return_type;
struct hlsl_ir_jump *jump;
if (return_va
lue
)
if (
ctx->cur_function->
return_va
r
)
{
struct hlsl_ir_store *store;
if (return_value)
{
struct hlsl_ir_store *store;
if (!(return_value = add_implicit_conversion(ctx, instrs, return_value, return_type, &loc)))
return NULL;
if (!(return_value = add_implicit_conversion(ctx, instrs, return_value, return_type, &loc)))
return NULL;
if (!(store = hlsl_new_simple_store(ctx, ctx->cur_function->return_var, return_value)))
if (!(store = hlsl_new_simple_store(ctx, ctx->cur_function->return_var, return_value)))
return NULL;
list_add_after(&return_value->entry, &store->node.entry);
}
else
{
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Non-void functions must return a value.");
return NULL;
list_add_after(&return_value->entry, &store->node.entry);
}
}
else
if (ctx->cur_function->return_var)
else
{
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Non-void function must
return
a
value
.");
return NULL
;
if (
return
_
value
)
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Void functions cannot return a value.")
;
}
if (!(jump = hlsl_new_jump(ctx, HLSL_IR_JUMP_RETURN, loc)))
...
...
This diff is collapsed.
Click to expand it.
tests/hlsl-function.shader_test
+
1
−
1
View file @
9cc7aaf5
...
...
@@ -89,7 +89,7 @@ float4 main() : sv_target
return func();
}
[pixel shader fail
todo
]
[pixel shader fail]
void foo()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment