wined3d: Generate GLSL declarations for UAVs.
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
e9011a011e
commit
7b770efe8c
|
@ -2040,6 +2040,56 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
sampler_type_prefix, sampler_type, prefix, entry->bind_idx);
|
||||
}
|
||||
|
||||
/* Declare images */
|
||||
for (i = 0; i < ARRAY_SIZE(reg_maps->uav_resource_info); ++i)
|
||||
{
|
||||
const char *image_type_prefix, *image_type;
|
||||
|
||||
if (!reg_maps->uav_resource_info[i].type)
|
||||
continue;
|
||||
|
||||
switch (reg_maps->uav_resource_info[i].data_type)
|
||||
{
|
||||
case WINED3D_DATA_FLOAT:
|
||||
case WINED3D_DATA_UNORM:
|
||||
case WINED3D_DATA_SNORM:
|
||||
image_type_prefix = "";
|
||||
break;
|
||||
|
||||
case WINED3D_DATA_INT:
|
||||
image_type_prefix = "i";
|
||||
break;
|
||||
|
||||
case WINED3D_DATA_UINT:
|
||||
image_type_prefix = "u";
|
||||
break;
|
||||
|
||||
default:
|
||||
image_type_prefix = "";
|
||||
ERR("Unhandled resource data type %#x.\n", reg_maps->uav_resource_info[i].data_type);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (reg_maps->uav_resource_info[i].type)
|
||||
{
|
||||
case WINED3D_SHADER_RESOURCE_TEXTURE_2D:
|
||||
image_type = "image2D";
|
||||
break;
|
||||
|
||||
case WINED3D_SHADER_RESOURCE_TEXTURE_3D:
|
||||
image_type = "image3D";
|
||||
break;
|
||||
|
||||
default:
|
||||
image_type = "unsupported_image";
|
||||
FIXME("Unhandled resource type %#x.\n", reg_maps->uav_resource_info[i].type);
|
||||
break;
|
||||
}
|
||||
|
||||
shader_addline(buffer, "writeonly uniform %s%s %s_image%u;\n",
|
||||
image_type_prefix, image_type, prefix, i);
|
||||
}
|
||||
|
||||
/* Declare uniforms for NP2 texcoord fixup:
|
||||
* This is NOT done inside the loop that declares the texture samplers
|
||||
* since the NP2 fixup code is currently only used for the GeforceFX
|
||||
|
@ -5879,6 +5929,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
|
|||
{
|
||||
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
|
||||
if (gl_info->supported[ARB_SHADER_IMAGE_LOAD_STORE])
|
||||
shader_addline(buffer, "#extension GL_ARB_shader_image_load_store : enable\n");
|
||||
if (gl_info->supported[ARB_TEXTURE_QUERY_LEVELS])
|
||||
shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n");
|
||||
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
||||
|
@ -8732,7 +8784,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
|
|||
/* WINED3DSIH_DCL_TGSM_RAW */ NULL,
|
||||
/* WINED3DSIH_DCL_TGSM_STRUCTURED */ NULL,
|
||||
/* WINED3DSIH_DCL_THREAD_GROUP */ NULL,
|
||||
/* WINED3DSIH_DCL_UAV_TYPED */ NULL,
|
||||
/* WINED3DSIH_DCL_UAV_TYPED */ shader_glsl_nop,
|
||||
/* WINED3DSIH_DCL_VERTICES_OUT */ shader_glsl_nop,
|
||||
/* WINED3DSIH_DEF */ shader_glsl_nop,
|
||||
/* WINED3DSIH_DEFAULT */ shader_glsl_default,
|
||||
|
|
|
@ -889,7 +889,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
}
|
||||
|
||||
/* Handle declarations. */
|
||||
if (ins.handler_idx == WINED3DSIH_DCL)
|
||||
if (ins.handler_idx == WINED3DSIH_DCL
|
||||
|| ins.handler_idx == WINED3DSIH_DCL_UAV_TYPED)
|
||||
{
|
||||
struct wined3d_shader_semantic *semantic = &ins.declaration.semantic;
|
||||
unsigned int reg_idx = semantic->reg.reg.idx[0].offset;
|
||||
|
@ -937,6 +938,16 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
reg_maps->resource_info[reg_idx].data_type = semantic->resource_data_type;
|
||||
break;
|
||||
|
||||
case WINED3DSPR_UAV:
|
||||
if (reg_idx >= ARRAY_SIZE(reg_maps->uav_resource_info))
|
||||
{
|
||||
ERR("Invalid UAV resource index %u.\n", reg_idx);
|
||||
break;
|
||||
}
|
||||
reg_maps->uav_resource_info[reg_idx].type = semantic->resource_type;
|
||||
reg_maps->uav_resource_info[reg_idx].data_type = semantic->resource_data_type;
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE("Not recording DCL register type %#x.\n", semantic->reg.reg.type);
|
||||
break;
|
||||
|
|
|
@ -184,6 +184,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
|||
#define MAX_CONSTANT_BUFFERS 15
|
||||
#define MAX_SAMPLER_OBJECTS 16
|
||||
#define MAX_SHADER_RESOURCE_VIEWS 128
|
||||
#define MAX_UNORDERED_ACCESS_VIEWS 8
|
||||
#define MAX_VERTEX_BLENDS 4
|
||||
#define MAX_MULTISAMPLE_TYPES 8
|
||||
|
||||
|
@ -836,6 +837,7 @@ struct wined3d_shader_reg_maps
|
|||
DWORD sampler_comparison_mode;
|
||||
BYTE bumpmat; /* MAX_TEXTURES, 8 */
|
||||
BYTE luminanceparams; /* MAX_TEXTURES, 8 */
|
||||
struct wined3d_shader_resource_info uav_resource_info[MAX_UNORDERED_ACCESS_VIEWS];
|
||||
|
||||
WORD usesnrm : 1;
|
||||
WORD vpos : 1;
|
||||
|
|
Loading…
Reference in New Issue