Commit 630c7bb7 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement sampleinfo for render targets.

parent 9f353bf1
......@@ -6027,38 +6027,64 @@ static void shader_glsl_sample_info(const struct wined3d_shader_instruction *ins
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
const struct wined3d_gl_info *gl_info = ins->ctx->gl_info;
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
const struct wined3d_shader_dst_param *dst = ins->dst;
const struct wined3d_shader_src_param *src = ins->src;
enum wined3d_shader_resource_type resource_type;
enum wined3d_data_type dst_data_type;
unsigned int resource_idx, bind_idx;
char dst_swizzle[6];
DWORD write_mask;
if (!gl_info->supported[ARB_SHADER_TEXTURE_IMAGE_SAMPLES])
{
FIXME("textureSamples() is not supported.\n");
return;
}
dst_data_type = ins->dst[0].reg.data_type;
dst_data_type = dst->reg.data_type;
if (ins->flags == WINED3DSI_SAMPLE_INFO_UINT)
dst_data_type = WINED3D_DATA_UINT;
else if (ins->flags)
FIXME("Unhandled flags %#x.\n", ins->flags);
resource_idx = ins->src[0].reg.idx[0].offset;
resource_type = reg_maps->resource_info[resource_idx].type;
if (resource_type >= ARRAY_SIZE(resource_type_info))
write_mask = shader_glsl_append_dst_ext(buffer, ins, dst, dst_data_type);
shader_glsl_get_swizzle(src, FALSE, write_mask, dst_swizzle);
if (dst_data_type == WINED3D_DATA_UINT)
shader_addline(buffer, "uvec4(");
else
shader_addline(buffer, "vec4(");
if (src->reg.type == WINED3DSPR_RASTERIZER)
{
ERR("Unexpected resource type %#x.\n", resource_type);
return;
if (gl_info->supported[ARB_SAMPLE_SHADING])
{
shader_addline(buffer, "gl_NumSamples");
}
else
{
FIXME("OpenGL implementation does not support ARB_sample_shading.\n");
shader_addline(buffer, "1");
}
}
bind_idx = shader_glsl_find_sampler(&reg_maps->sampler_map, resource_idx, WINED3D_SAMPLER_DEFAULT);
else
{
resource_idx = src->reg.idx[0].offset;
resource_type = reg_maps->resource_info[resource_idx].type;
if (resource_type >= ARRAY_SIZE(resource_type_info))
{
ERR("Unexpected resource type %#x.\n", resource_type);
return;
}
bind_idx = shader_glsl_find_sampler(&reg_maps->sampler_map, resource_idx, WINED3D_SAMPLER_DEFAULT);
write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], dst_data_type);
shader_glsl_get_swizzle(&ins->src[0], FALSE, write_mask, dst_swizzle);
shader_addline(buffer, "%s(textureSamples(%s_sampler%u), 0, 0, 0)%s);\n",
dst_data_type == WINED3D_DATA_UINT ? "uvec4" : "vec4",
shader_glsl_get_prefix(reg_maps->shader_version.type), bind_idx, dst_swizzle);
if (gl_info->supported[ARB_SHADER_TEXTURE_IMAGE_SAMPLES])
{
shader_addline(buffer, "textureSamples(%s_sampler%u)",
shader_glsl_get_prefix(reg_maps->shader_version.type), bind_idx);
}
else
{
FIXME("textureSamples() is not supported.\n");
shader_addline(buffer, "1");
}
}
shader_addline(buffer, ", 0, 0, 0)%s);\n", dst_swizzle);
}
static void shader_glsl_ld(const struct wined3d_shader_instruction *ins)
......
......@@ -1713,7 +1713,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
ins.src[3].reg.idx[0].offset, reg_maps->sampler_map.count);
}
else if ((ins.handler_idx == WINED3DSIH_BUFINFO && ins.src[0].reg.type == WINED3DSPR_RESOURCE)
|| ins.handler_idx == WINED3DSIH_SAMPLE_INFO)
|| (ins.handler_idx == WINED3DSIH_SAMPLE_INFO && ins.src[0].reg.type == WINED3DSPR_RESOURCE))
{
shader_record_sample(reg_maps, ins.src[0].reg.idx[0].offset,
WINED3D_SAMPLER_DEFAULT, reg_maps->sampler_map.count);
......@@ -2337,6 +2337,10 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
shader_addline(buffer, "null");
break;
case WINED3DSPR_RASTERIZER:
shader_addline(buffer, "rasterizer");
break;
case WINED3DSPR_RESOURCE:
shader_addline(buffer, "t");
break;
......
......@@ -318,6 +318,7 @@ enum wined3d_sm4_register_type
WINED3D_SM4_RT_PRIMID = 0x0b,
WINED3D_SM4_RT_DEPTHOUT = 0x0c,
WINED3D_SM4_RT_NULL = 0x0d,
WINED3D_SM4_RT_RASTERIZER = 0x0e,
WINED3D_SM4_RT_OMASK = 0x0f,
WINED3D_SM5_RT_STREAM = 0x10,
WINED3D_SM5_RT_FUNCTION_BODY = 0x11,
......@@ -1132,7 +1133,7 @@ static const enum wined3d_shader_register_type register_type_table[] =
/* WINED3D_SM4_RT_PRIMID */ WINED3DSPR_PRIMID,
/* WINED3D_SM4_RT_DEPTHOUT */ WINED3DSPR_DEPTHOUT,
/* WINED3D_SM4_RT_NULL */ WINED3DSPR_NULL,
/* UNKNOWN */ ~0u,
/* WINED3D_SM4_RT_RASTERIZER */ WINED3DSPR_RASTERIZER,
/* WINED3D_SM4_RT_OMASK */ WINED3DSPR_SAMPLEMASK,
/* WINED3D_SM5_RT_STREAM */ WINED3DSPR_STREAM,
/* WINED3D_SM5_RT_FUNCTION_BODY */ WINED3DSPR_FUNCTIONBODY,
......
......@@ -497,6 +497,7 @@ enum wined3d_shader_register_type
WINED3DSPR_GSINSTID,
WINED3DSPR_DEPTHOUTGE,
WINED3DSPR_DEPTHOUTLE,
WINED3DSPR_RASTERIZER,
};
enum wined3d_data_type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment