mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Store state block on pass variables.
This commit is contained in:
parent
a99bcb1196
commit
ef9ae22ed0
Notes:
Alexandre Julliard
2024-04-11 17:02:42 -05:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/739
@ -115,6 +115,9 @@ static uint32_t write_string(const char *string, struct fx_write_context *fx)
|
|||||||
|
|
||||||
static void write_pass(struct hlsl_ir_var *var, struct fx_write_context *fx)
|
static void write_pass(struct hlsl_ir_var *var, struct fx_write_context *fx)
|
||||||
{
|
{
|
||||||
|
if (var->state_block_count)
|
||||||
|
hlsl_fixme(fx->ctx, &var->loc, "Write state block assignments.");
|
||||||
|
|
||||||
fx->ops->write_pass(var, fx);
|
fx->ops->write_pass(var, fx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +426,7 @@ struct hlsl_ir_var
|
|||||||
|
|
||||||
/* A dynamic array containing the state block on the variable's declaration, if any.
|
/* A dynamic array containing the state block on the variable's declaration, if any.
|
||||||
* An array variable may contain multiple state blocks.
|
* An array variable may contain multiple state blocks.
|
||||||
|
* A technique pass will always contain one.
|
||||||
* These are only really used for effect profiles. */
|
* These are only really used for effect profiles. */
|
||||||
struct hlsl_state_block **state_blocks;
|
struct hlsl_state_block **state_blocks;
|
||||||
unsigned int state_block_count;
|
unsigned int state_block_count;
|
||||||
|
@ -1117,7 +1117,7 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *annotations,
|
static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *annotations,
|
||||||
const struct vkd3d_shader_location *loc)
|
struct hlsl_state_block *state_block, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_var *var;
|
struct hlsl_ir_var *var;
|
||||||
struct hlsl_type *type;
|
struct hlsl_type *type;
|
||||||
@ -1127,6 +1127,11 @@ static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *
|
|||||||
return false;
|
return false;
|
||||||
var->annotations = annotations;
|
var->annotations = annotations;
|
||||||
|
|
||||||
|
var->state_blocks = hlsl_alloc(ctx, sizeof(*var->state_blocks));
|
||||||
|
var->state_blocks[0] = state_block;
|
||||||
|
var->state_block_count = 1;
|
||||||
|
var->state_block_capacity = 1;
|
||||||
|
|
||||||
if (!hlsl_add_var(ctx, var, false))
|
if (!hlsl_add_var(ctx, var, false))
|
||||||
{
|
{
|
||||||
struct hlsl_ir_var *old = hlsl_get_var(ctx->cur_scope, var->name);
|
struct hlsl_ir_var *old = hlsl_get_var(ctx->cur_scope, var->name);
|
||||||
@ -5592,9 +5597,9 @@ name_opt:
|
|||||||
| any_identifier
|
| any_identifier
|
||||||
|
|
||||||
pass:
|
pass:
|
||||||
KW_PASS name_opt annotations_opt '{' '}'
|
KW_PASS name_opt annotations_opt '{' state_block_start state_block '}'
|
||||||
{
|
{
|
||||||
if (!add_pass(ctx, $2, $3, &@1))
|
if (!add_pass(ctx, $2, $3, $6, &@1))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,14 @@ shader model < 6.0
|
|||||||
technique10 t1 < int a = 1; > {}
|
technique10 t1 < int a = 1; > {}
|
||||||
technique10 t2 < int a = 2; int t1 = 3; int t2 = 4; > {}
|
technique10 t2 < int a = 2; int t1 = 3; int t2 = 4; > {}
|
||||||
|
|
||||||
[effect]
|
[effect todo]
|
||||||
// Annotations on passes
|
// Annotations on passes
|
||||||
technique10 t1 < int a = 1; >
|
technique10 t1 < int a = 1; >
|
||||||
{
|
{
|
||||||
pass < int t1 = 2; > {}
|
pass < int t1 = 2; > {}
|
||||||
}
|
}
|
||||||
|
|
||||||
[effect]
|
[effect todo]
|
||||||
// Using names from the global scope
|
// Using names from the global scope
|
||||||
float a;
|
float a;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
% Test complex effect groups syntax
|
% Test complex effect groups syntax
|
||||||
[pixel shader fail(sm>=6) todo]
|
[pixel shader fail(sm>=6)]
|
||||||
fxgroup group1
|
fxgroup group1
|
||||||
{
|
{
|
||||||
technique10
|
technique10
|
||||||
|
Loading…
Reference in New Issue
Block a user