mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Skip writing string default values.
This causes a crash in the native compiler, but can only happen in ps_5_0 were it is possible to declare structs that are both used in the shader and contain strings. struct { float a; string b; } apple = {1, "foobar"}; float4 main() : sv_target { return apple.a; } In our case, hlsl_type_get_component_offset() triggered an assertion failure because it does not expect the string type. So this is replaced by an hlsl_error().
This commit is contained in:
parent
094e298c1c
commit
355d4c4a86
Notes:
Henri Verbeet
2024-08-13 21:26:39 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/988
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hlsl.h"
|
#include "hlsl.h"
|
||||||
|
#include "vkd3d_shader_private.h"
|
||||||
|
|
||||||
#define SM4_MAX_SRC_COUNT 6
|
#define SM4_MAX_SRC_COUNT 6
|
||||||
#define SM4_MAX_DST_COUNT 2
|
#define SM4_MAX_DST_COUNT 2
|
||||||
@ -3600,6 +3601,13 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
|||||||
unsigned int comp_offset;
|
unsigned int comp_offset;
|
||||||
enum hlsl_regset regset;
|
enum hlsl_regset regset;
|
||||||
|
|
||||||
|
if (comp_type->class == HLSL_CLASS_STRING)
|
||||||
|
{
|
||||||
|
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||||
|
"Cannot write string default value.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
comp_offset = hlsl_type_get_component_offset(ctx, var->data_type, k, ®set);
|
comp_offset = hlsl_type_get_component_offset(ctx, var->data_type, k, ®set);
|
||||||
if (regset == HLSL_REGSET_NUMERIC)
|
if (regset == HLSL_REGSET_NUMERIC)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user