Commit a33d3ad4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add support for SV_InstanceID.

parent f9fafb36
......@@ -1182,11 +1182,14 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
if (version->type == WINED3D_SHADER_TYPE_VERTEX)
{
/* Declare attributes. */
for (i = 0, map = reg_maps->input_registers; map; map >>= 1, ++i)
for (i = 0; i < shader->input_signature.element_count; ++i)
{
if (map & 1)
shader_addline(buffer, "attribute vec4 %s_in%u;\n", prefix, i);
const struct wined3d_shader_signature_element *e = &shader->input_signature.elements[i];
if (e->sysval_semantic == WINED3D_SV_INSTANCEID)
shader_addline(buffer, "vec4 %s_in%u = vec4(intBitsToFloat(gl_InstanceID), 0.0, 0.0, 0.0);\n",
prefix, e->register_idx);
else
shader_addline(buffer, "attribute vec4 %s_in%u;\n", prefix, e->register_idx);
}
shader_addline(buffer, "uniform vec4 posFixup;\n");
......@@ -4588,6 +4591,8 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
shader_addline(buffer, "#version 120\n");
if (gl_info->supported[ARB_DRAW_INSTANCED])
shader_addline(buffer, "#extension GL_ARB_draw_instanced : enable\n");
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n");
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
......
......@@ -768,6 +768,7 @@ enum wined3d_decl_usage
enum wined3d_sysval_semantic
{
WINED3D_SV_POSITION = 1,
WINED3D_SV_INSTANCEID = 8,
WINED3D_SV_DEPTH = 0xffffffff,
WINED3D_SV_TARGET0 = 0,
......
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