VirtualBox

Ignore:
Timestamp:
Feb 19, 2016 3:11:35 PM (9 years ago)
Author:
vboxsync
Message:

SVGA3d: Applied patch for supporting pretransformed vertices (SVGA3D_DECLUSAGE_POSITIONT) from trivirt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c

    r54765 r59741  
    42624262}
    42634263
     4264#ifdef VBOX_WITH_VMSVGA
     4265static GLhandleARB generate_passthrough_vshader(const struct wined3d_gl_info *gl_info)
     4266{
     4267    GLhandleARB ret = 0;
     4268    static const char *passthrough_vshader[] =
     4269    {
     4270        "#version 120\n"
     4271        "vec4 R0;\n"
     4272        "void main(void)\n"
     4273        "{\n"
     4274        "    R0   = gl_Vertex;\n"
     4275        "    R0.w = 1.0;\n"
     4276        "    R0.z = 0.0;\n"
     4277        "    gl_Position   = gl_ModelViewProjectionMatrix * R0;\n"
     4278        "}\n"
     4279    };
     4280
     4281    ret = GL_EXTCALL(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB));
     4282    checkGLcall("glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB)");
     4283    GL_EXTCALL(glShaderSourceARB(ret, 1, passthrough_vshader, NULL));
     4284    checkGLcall("glShaderSourceARB(ret, 1, passthrough_vshader, NULL)");
     4285    GL_EXTCALL(glCompileShaderARB(ret));
     4286    checkGLcall("glCompileShaderARB(ret)");
     4287    shader_glsl_validate_compile_link(gl_info, ret, FALSE);
     4288
     4289    return ret;
     4290}
     4291
     4292#endif
     4293
    42644294/* GL locking is done by the caller */
    42654295static void hardcode_local_constants(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info,
     
    47104740        list_add_head(&((IWineD3DBaseShaderImpl *)vshader)->baseShader.linked_programs, &entry->vshader_entry);
    47114741    }
     4742#ifdef VBOX_WITH_VMSVGA
     4743    else
     4744    if (device->strided_streams.position_transformed)
     4745    {
     4746        GLhandleARB passthrough_vshader_id;
     4747
     4748        passthrough_vshader_id = generate_passthrough_vshader(gl_info);
     4749        TRACE("Attaching GLSL shader object %p to program %p\n", (void *)(uintptr_t)passthrough_vshader_id, (void *)(uintptr_t)programId);
     4750        GL_EXTCALL(glAttachObjectARB(programId, passthrough_vshader_id));
     4751        checkGLcall("glAttachObjectARB");
     4752        /* Flag the reorder function for deletion, then it will be freed automatically when the program
     4753         * is destroyed
     4754         */
     4755        GL_EXTCALL(glDeleteObjectARB(passthrough_vshader_id));
     4756    }
     4757#endif
     4758
    47124759
    47134760    /* Attach GLSL pshader */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette