Commit c0068b33 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d/glsl: Clamp ftou upper bound to UINT_MAX.

Ported from cc893a3368bd8a8a3f638ddde7b97d3819a6b43d in vkd3d.
parent 9921a236
......@@ -194,6 +194,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_EXT_polygon_offset_clamp", ARB_POLYGON_OFFSET_CLAMP },
{"GL_EXT_provoking_vertex", EXT_PROVOKING_VERTEX },
{"GL_EXT_secondary_color", EXT_SECONDARY_COLOR },
{"GL_EXT_shader_integer_mix", EXT_SHADER_INTEGER_MIX },
{"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE },
{"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP },
{"GL_EXT_texture3D", EXT_TEXTURE3D },
......@@ -3391,6 +3392,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter_gl *adapter_gl,
{ARB_DERIVATIVE_CONTROL, MAKEDWORD_VERSION(4, 5)},
{ARB_SHADER_TEXTURE_IMAGE_SAMPLES, MAKEDWORD_VERSION(4, 5)},
{ARB_TEXTURE_BARRIER, MAKEDWORD_VERSION(4, 5)},
{EXT_SHADER_INTEGER_MIX, MAKEDWORD_VERSION(4, 5)},
{ARB_PIPELINE_STATISTICS_QUERY, MAKEDWORD_VERSION(4, 6)},
{ARB_POLYGON_OFFSET_CLAMP, MAKEDWORD_VERSION(4, 6)},
......
......@@ -4338,9 +4338,11 @@ static void shader_glsl_to_uint(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src_param);
if (mask_size > 1)
shader_addline(buffer, "uvec%u(max(%s, vec%u(0.0))));\n", mask_size, src_param.param_str, mask_size);
shader_addline(buffer, "mix(uvec%u(max(%s, vec%u(0.0))), uvec%u(0xffffffffu), greaterThanEqual(%s, vec%u(4294967296.0))));\n",
mask_size, src_param.param_str, mask_size, mask_size, src_param.param_str, mask_size);
else
shader_addline(buffer, "uint(max(%s, 0)));\n", src_param.param_str);
shader_addline(buffer, "mix(uint(max(%s, 0.0)), 0xffffffffu, %s >= 4294967296.0));\n",
src_param.param_str, src_param.param_str);
}
static void shader_glsl_to_float(const struct wined3d_shader_instruction *ins)
......@@ -7564,6 +7566,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
shader_addline(buffer, "#extension GL_ARB_viewport_array : enable\n");
if (gl_info->supported[EXT_GPU_SHADER4])
shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n");
if (gl_info->supported[EXT_SHADER_INTEGER_MIX])
shader_addline(buffer, "#extension GL_EXT_shader_integer_mix : enable\n");
if (gl_info->supported[EXT_TEXTURE_ARRAY])
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
if (gl_info->supported[EXT_TEXTURE_SHADOW_LOD])
......@@ -11168,7 +11172,8 @@ static unsigned int shader_glsl_get_shader_model(const struct wined3d_gl_info *g
{
BOOL shader_model_4 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50)
&& gl_info->supported[ARB_SHADER_BIT_ENCODING]
&& gl_info->supported[ARB_TEXTURE_SWIZZLE];
&& gl_info->supported[ARB_TEXTURE_SWIZZLE]
&& gl_info->supported[EXT_SHADER_INTEGER_MIX];
if (shader_model_4
&& gl_info->supported[ARB_COMPUTE_SHADER]
......
......@@ -184,6 +184,7 @@ enum wined3d_gl_extension
EXT_POINT_PARAMETERS,
EXT_PROVOKING_VERTEX,
EXT_SECONDARY_COLOR,
EXT_SHADER_INTEGER_MIX,
EXT_STENCIL_TWO_SIDE,
EXT_STENCIL_WRAP,
EXT_TEXTURE3D,
......
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