mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
tests/shader-runner: Set the correct flag and format for raw UAVs.
This commit is contained in:
parent
2f88442d7d
commit
7534b88a15
Notes:
Henri Verbeet
2024-06-11 17:09:34 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/910
@ -2,8 +2,8 @@
|
||||
shader model >= 5.0
|
||||
|
||||
[uav 1]
|
||||
format r32 uint
|
||||
size (buffer, 4)
|
||||
format r32 typeless
|
||||
size (raw_buffer, 4)
|
||||
|
||||
1 0 0 0
|
||||
|
||||
@ -32,8 +32,8 @@ probe uav 1 (3) rui (99)
|
||||
|
||||
|
||||
[uav 1]
|
||||
format r32 sint
|
||||
size (buffer, 4)
|
||||
format r32 typeless
|
||||
size (raw_buffer, 4)
|
||||
|
||||
1 0 0 0
|
||||
|
||||
@ -136,8 +136,8 @@ probe uav 2 (7) ri (4)
|
||||
|
||||
|
||||
[uav 1]
|
||||
format r32 uint
|
||||
size (buffer, 1)
|
||||
format r32 typeless
|
||||
size (raw_buffer, 1)
|
||||
|
||||
0
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
shader model >= 5.0
|
||||
|
||||
[uav 1]
|
||||
format r32 float
|
||||
size (buffer, 4)
|
||||
format r32 typeless
|
||||
size (raw_buffer, 4)
|
||||
|
||||
0.1 0.2 0.3 0.4
|
||||
1 2 3 4
|
||||
|
||||
[pixel shader todo]
|
||||
RWByteAddressBuffer u : register(u1);
|
||||
|
@ -374,6 +374,7 @@ static DXGI_FORMAT parse_format(const char *line, enum texture_data_type *data_t
|
||||
{"r32 float", TEXTURE_DATA_FLOAT, 4, DXGI_FORMAT_R32_FLOAT},
|
||||
{"r32 sint", TEXTURE_DATA_SINT, 4, DXGI_FORMAT_R32_SINT},
|
||||
{"r32 uint", TEXTURE_DATA_UINT, 4, DXGI_FORMAT_R32_UINT},
|
||||
{"r32 typeless", TEXTURE_DATA_UINT, 4, DXGI_FORMAT_R32_TYPELESS},
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
@ -511,6 +512,12 @@ static void parse_resource_directive(struct resource_params *resource, const cha
|
||||
resource->dimension = RESOURCE_DIMENSION_BUFFER;
|
||||
resource->height = 1;
|
||||
}
|
||||
else if (sscanf(line, "( raw_buffer , %u ) ", &resource->width) == 1)
|
||||
{
|
||||
resource->dimension = RESOURCE_DIMENSION_BUFFER;
|
||||
resource->height = 1;
|
||||
resource->is_raw = true;
|
||||
}
|
||||
else if (sscanf(line, "( counter_buffer , %u ) ", &resource->width) == 1)
|
||||
{
|
||||
resource->dimension = RESOURCE_DIMENSION_BUFFER;
|
||||
|
@ -92,6 +92,7 @@ struct resource_params
|
||||
|
||||
DXGI_FORMAT format;
|
||||
bool is_shadow;
|
||||
bool is_raw;
|
||||
bool is_uav_counter;
|
||||
enum texture_data_type data_type;
|
||||
unsigned int texel_size;
|
||||
|
@ -333,7 +333,7 @@ static void destroy_test_context(struct d3d11_shader_runner *runner)
|
||||
}
|
||||
|
||||
static ID3D11Buffer *create_buffer(ID3D11Device *device, unsigned int bind_flags, unsigned int size,
|
||||
unsigned int stride, const void *data)
|
||||
bool is_raw, unsigned int stride, const void *data)
|
||||
{
|
||||
D3D11_SUBRESOURCE_DATA resource_data;
|
||||
D3D11_BUFFER_DESC buffer_desc;
|
||||
@ -344,7 +344,12 @@ static ID3D11Buffer *create_buffer(ID3D11Device *device, unsigned int bind_flags
|
||||
buffer_desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
buffer_desc.BindFlags = bind_flags;
|
||||
buffer_desc.CPUAccessFlags = 0;
|
||||
buffer_desc.MiscFlags = stride ? D3D11_RESOURCE_MISC_BUFFER_STRUCTURED : 0;
|
||||
if (is_raw)
|
||||
buffer_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
|
||||
else if (stride)
|
||||
buffer_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
else
|
||||
buffer_desc.MiscFlags = 0;
|
||||
buffer_desc.StructureByteStride = stride;
|
||||
|
||||
resource_data.pSysMem = data;
|
||||
@ -443,7 +448,8 @@ static void init_resource_srv_buffer(struct d3d11_shader_runner *runner, struct
|
||||
ID3D11Device *device = runner->device;
|
||||
HRESULT hr;
|
||||
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_SHADER_RESOURCE, params->data_size, params->stride, params->data);
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_SHADER_RESOURCE, params->data_size, params->is_raw,
|
||||
params->stride, params->data);
|
||||
resource->resource = (ID3D11Resource *)resource->buffer;
|
||||
|
||||
srv_desc.Format = params->format;
|
||||
@ -461,7 +467,8 @@ static void init_resource_uav_buffer(struct d3d11_shader_runner *runner, struct
|
||||
ID3D11Device *device = runner->device;
|
||||
HRESULT hr;
|
||||
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_UNORDERED_ACCESS, params->data_size, params->stride, params->data);
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_UNORDERED_ACCESS, params->data_size, params->is_raw,
|
||||
params->stride, params->data);
|
||||
resource->resource = (ID3D11Resource *)resource->buffer;
|
||||
resource->is_uav_counter = params->is_uav_counter;
|
||||
|
||||
@ -469,7 +476,12 @@ static void init_resource_uav_buffer(struct d3d11_shader_runner *runner, struct
|
||||
uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uav_desc.Buffer.FirstElement = 0;
|
||||
uav_desc.Buffer.NumElements = params->data_size / params->texel_size;
|
||||
uav_desc.Buffer.Flags = params->is_uav_counter ? D3D11_BUFFER_UAV_FLAG_COUNTER : 0;
|
||||
if (params->is_raw)
|
||||
uav_desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
|
||||
else if (params->is_uav_counter)
|
||||
uav_desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_COUNTER;
|
||||
else
|
||||
uav_desc.Buffer.Flags = 0;
|
||||
hr = ID3D11Device_CreateUnorderedAccessView(device, resource->resource, &uav_desc, &resource->uav);
|
||||
ok(hr == S_OK, "Failed to create view, hr %#lx.\n", hr);
|
||||
}
|
||||
@ -502,7 +514,8 @@ static struct resource *d3d11_runner_create_resource(struct shader_runner *r, co
|
||||
break;
|
||||
|
||||
case RESOURCE_TYPE_VERTEX_BUFFER:
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, params->data_size, params->stride, params->data);
|
||||
resource->buffer = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, params->data_size, params->is_raw,
|
||||
params->stride, params->data);
|
||||
resource->resource = (ID3D11Resource *)resource->buffer;
|
||||
break;
|
||||
}
|
||||
@ -568,7 +581,7 @@ static bool d3d11_runner_dispatch(struct shader_runner *r, unsigned int x, unsig
|
||||
ID3D11Buffer *cb;
|
||||
|
||||
cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER,
|
||||
runner->r.uniform_count * sizeof(*runner->r.uniforms), 0, runner->r.uniforms);
|
||||
runner->r.uniform_count * sizeof(*runner->r.uniforms), false, 0, runner->r.uniforms);
|
||||
ID3D11DeviceContext_CSSetConstantBuffers(context, 0, 1, &cb);
|
||||
ID3D11Buffer_Release(cb);
|
||||
}
|
||||
@ -730,7 +743,7 @@ static bool d3d11_runner_draw(struct shader_runner *r,
|
||||
if (runner->r.uniform_count)
|
||||
{
|
||||
cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER,
|
||||
runner->r.uniform_count * sizeof(*runner->r.uniforms), 0, runner->r.uniforms);
|
||||
runner->r.uniform_count * sizeof(*runner->r.uniforms), false, 0, runner->r.uniforms);
|
||||
ID3D11DeviceContext_VSSetConstantBuffers(context, 0, 1, &cb);
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(context, 0, 1, &cb);
|
||||
if (hs_code)
|
||||
|
@ -230,6 +230,7 @@ static struct resource *d3d12_runner_create_resource(struct shader_runner *r, co
|
||||
uav_desc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
|
||||
uav_desc.Buffer.NumElements = params->width * params->height;
|
||||
uav_desc.Buffer.StructureByteStride = params->stride;
|
||||
uav_desc.Buffer.Flags = params->is_raw ? D3D12_BUFFER_UAV_FLAG_RAW : 0;
|
||||
|
||||
ID3D12Device_CreateUnorderedAccessView(device, resource->resource,
|
||||
params->is_uav_counter ? resource->resource : NULL, &uav_desc,
|
||||
|
@ -341,6 +341,7 @@ static const struct format_info *get_format_info(enum DXGI_FORMAT format, bool i
|
||||
{DXGI_FORMAT_D32_FLOAT, 1, false, true, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT},
|
||||
{DXGI_FORMAT_R32_UINT, 1, true, false, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT},
|
||||
{DXGI_FORMAT_R32_SINT, 1, true, false, GL_R32I, GL_RED_INTEGER, GL_INT},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 1, true, false, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT},
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(format_info); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user