wined3d: Add support for UAV reads.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
29aa581cdd
commit
0131d4e6d1
|
@ -2068,7 +2068,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||||
/* Declare images */
|
/* Declare images */
|
||||||
for (i = 0; i < ARRAY_SIZE(reg_maps->uav_resource_info); ++i)
|
for (i = 0; i < ARRAY_SIZE(reg_maps->uav_resource_info); ++i)
|
||||||
{
|
{
|
||||||
const char *image_type_prefix, *image_type;
|
const char *image_type_prefix, *image_type, *read_format;
|
||||||
|
|
||||||
if (!reg_maps->uav_resource_info[i].type)
|
if (!reg_maps->uav_resource_info[i].type)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2079,18 +2079,22 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||||
case WINED3D_DATA_UNORM:
|
case WINED3D_DATA_UNORM:
|
||||||
case WINED3D_DATA_SNORM:
|
case WINED3D_DATA_SNORM:
|
||||||
image_type_prefix = "";
|
image_type_prefix = "";
|
||||||
|
read_format = "r32f";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WINED3D_DATA_INT:
|
case WINED3D_DATA_INT:
|
||||||
image_type_prefix = "i";
|
image_type_prefix = "i";
|
||||||
|
read_format = "r32i";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WINED3D_DATA_UINT:
|
case WINED3D_DATA_UINT:
|
||||||
image_type_prefix = "u";
|
image_type_prefix = "u";
|
||||||
|
read_format = "r32ui";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
image_type_prefix = "";
|
image_type_prefix = "";
|
||||||
|
read_format = "";
|
||||||
ERR("Unhandled resource data type %#x.\n", reg_maps->uav_resource_info[i].data_type);
|
ERR("Unhandled resource data type %#x.\n", reg_maps->uav_resource_info[i].data_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2111,8 +2115,12 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_addline(buffer, "writeonly uniform %s%s %s_image%u;\n",
|
if (reg_maps->uav_read_mask & (1u << i))
|
||||||
image_type_prefix, image_type, prefix, i);
|
shader_addline(buffer, "layout(%s) uniform %s%s %s_image%u;\n",
|
||||||
|
read_format, image_type_prefix, image_type, prefix, i);
|
||||||
|
else
|
||||||
|
shader_addline(buffer, "writeonly uniform %s%s %s_image%u;\n",
|
||||||
|
image_type_prefix, image_type, prefix, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Declare uniforms for NP2 texcoord fixup:
|
/* Declare uniforms for NP2 texcoord fixup:
|
||||||
|
|
|
@ -1228,7 +1228,20 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ins.handler_idx == WINED3DSIH_NRM) reg_maps->usesnrm = 1;
|
if (ins.handler_idx == WINED3DSIH_ATOMIC_IADD)
|
||||||
|
{
|
||||||
|
unsigned int reg_idx = ins.dst[0].reg.idx[0].offset;
|
||||||
|
if (reg_idx >= MAX_UNORDERED_ACCESS_VIEWS)
|
||||||
|
{
|
||||||
|
ERR("Invalid UAV index %u.\n", reg_idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reg_maps->uav_read_mask |= (1u << reg_idx);
|
||||||
|
}
|
||||||
|
else if (ins.handler_idx == WINED3DSIH_NRM)
|
||||||
|
{
|
||||||
|
reg_maps->usesnrm = 1;
|
||||||
|
}
|
||||||
else if (ins.handler_idx == WINED3DSIH_DSY
|
else if (ins.handler_idx == WINED3DSIH_DSY
|
||||||
|| ins.handler_idx == WINED3DSIH_DSY_COARSE
|
|| ins.handler_idx == WINED3DSIH_DSY_COARSE
|
||||||
|| ins.handler_idx == WINED3DSIH_DSY_FINE)
|
|| ins.handler_idx == WINED3DSIH_DSY_FINE)
|
||||||
|
|
|
@ -839,6 +839,7 @@ struct wined3d_shader_reg_maps
|
||||||
BYTE bumpmat; /* MAX_TEXTURES, 8 */
|
BYTE bumpmat; /* MAX_TEXTURES, 8 */
|
||||||
BYTE luminanceparams; /* MAX_TEXTURES, 8 */
|
BYTE luminanceparams; /* MAX_TEXTURES, 8 */
|
||||||
struct wined3d_shader_resource_info uav_resource_info[MAX_UNORDERED_ACCESS_VIEWS];
|
struct wined3d_shader_resource_info uav_resource_info[MAX_UNORDERED_ACCESS_VIEWS];
|
||||||
|
DWORD uav_read_mask; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
|
||||||
|
|
||||||
WORD usesnrm : 1;
|
WORD usesnrm : 1;
|
||||||
WORD vpos : 1;
|
WORD vpos : 1;
|
||||||
|
|
Loading…
Reference in New Issue