[PATCH 1/5] wined3d: Declare the correct number and type of fragment shader color outputs.

Henri Verbeet hverbeet at gmail.com
Wed Jun 6 10:00:02 CDT 2018


On 6 June 2018 at 00:32, Matteo Bruni <mbruni at codeweavers.com> wrote:
> +static void shader_glsl_generate_color_output(struct wined3d_string_buffer *buffer,
> +        const struct wined3d_gl_info *gl_info, const struct wined3d_shader *shader)
> +{
> +    const struct wined3d_shader_signature *output_signature = &shader->output_signature;
> +    unsigned int i;
> +
> +    if (output_signature->element_count)
> +    {
> +        for (i = 0; i < output_signature->element_count; ++i)
> +        {
> +            const struct wined3d_shader_signature_element *output = &output_signature->elements[i];
> +
> +            if (strncasecmp(output->semantic_name, "SV_Target", sizeof("SV_Target")))
> +                continue;
Should this really match against the "semantic_name" string, or does
the "sysval_semantic" field also contain that information?

> +            switch (output->component_type)
> +            {
> +                case WINED3D_TYPE_UINT:
> +                    shader_addline(buffer, "color_out%u = floatBitsToUint(ps_out[%u]);\n",
> +                            output->semantic_idx, output->semantic_idx);
> +                    break;
> +                case WINED3D_TYPE_INT:
> +                    shader_addline(buffer, "color_out%u = floatBitsToInt(ps_out[%u]);\n",
> +                            output->semantic_idx, output->semantic_idx);
> +                    break;
> +
> +                default:
> +                    FIXME("Unhandled type %#x.\n", output->component_type);
> +                    /* Fall through. */
> +                case WINED3D_TYPE_UNKNOWN:
> +                case WINED3D_TYPE_FLOAT:
> +                    shader_addline(buffer, "color_out%u = ps_out[%u];\n",
> +                            output->semantic_idx, output->semantic_idx);
> +            }
I think shader_glsl_sprintf_cast() with appropriate arguments could
also handle this.



More information about the wine-devel mailing list