mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Rename hlsl_reg.bind_count to hlsl_reg.allocation_size.
We have to distinguish between the "bind count" and the "allocation size" of variables. The "allocation size" affects the starting register id for the resource to be allocated next, while the "bind count" is determined by the last field actually used. The former may be larger than the latter. What we are currently calling hlsl_reg.bind_count is actually the "allocation size", so a rename is in order. The real "bind count", which will be introduced in following patches, is important because it is what should be shown in the RDEF table and some resource allocation rules depend on it. For instance, for this shader: texture2D texs[3]; texture2D tex; float4 main() : sv_target { return texs[0].Load(int3(0, 0, 0)) + tex.Load(int3(0, 0, 0)); } the variable "texs" has a "bind count" of 1, but an "allocation size" of 3: // Resource Bindings: // // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // texs texture float4 2d t0 1 // tex texture float4 2d t3 1
This commit is contained in:
committed by
Alexandre Julliard
parent
948c4145f5
commit
7eba063136
Notes:
Alexandre Julliard
2023-08-15 22:06:06 +02: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/299
@@ -3119,7 +3119,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
||||
regset = hlsl_type_get_regset(component_type);
|
||||
regset_offset = hlsl_type_get_component_offset(ctx, var->data_type, regset, k);
|
||||
|
||||
if (regset_offset > var->regs[regset].bind_count)
|
||||
if (regset_offset > var->regs[regset].allocation_size)
|
||||
continue;
|
||||
|
||||
if (var->objects_usage[regset][regset_offset].used)
|
||||
@@ -3192,7 +3192,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
||||
|
||||
extern_resources[*count].regset = regset;
|
||||
extern_resources[*count].id = var->regs[regset].id;
|
||||
extern_resources[*count].bind_count = var->regs[regset].bind_count;
|
||||
extern_resources[*count].bind_count = var->regs[regset].allocation_size;
|
||||
|
||||
++*count;
|
||||
}
|
||||
|
Reference in New Issue
Block a user