Ejemplo n.º 1
0
        /// <summary>
        /// Create a rendering engine to be used when the HLE modules have not yet
        /// been started.
        /// </summary>
        /// <returns> the initial rendering engine </returns>
        public static IRenderingEngine createInitialRenderingEngine()
        {
            IRenderingEngine re = RenderingEngineLwjgl.newInstance();

            if (enableDebugProxy)
            {
                re = new DebugProxy(re);
            }

            return(re);
        }
Ejemplo n.º 2
0
        private static IRenderingEngine createRenderingEngine(bool enableSoftwareRendering)
        {
            // Build the rendering pipeline, from the last entry to the first one.
            IRenderingEngine re;

            if (enableSoftwareRendering)
            {
                // RenderingEngine using a complete software implementation, i.e. not using the GPU
                re = new RESoftware();
            }
            else
            {
                // RenderingEngine performing the OpenGL calls by using the LWJGL library
                re = RenderingEngineLwjgl.newInstance();
            }

            if (enableCheckErrorsProxy)
            {
                re = new CheckErrorsProxy(re);
            }

            if (enableStatisticsProxy && DurationStatistics.collectStatistics)
            {
                // Proxy collecting statistics for all the calls (number of calls and execution time)
                re = new StatisticsProxy(re);
            }

            if (enableDebugProxy)
            {
                // Proxy logging the calls at the DEBUG level
                re = new DebugProxy(re);
            }

            if (!enableSoftwareRendering)
            {
                if (REShader.useShaders(re))
                {
                    // RenderingEngine using shaders
                    re = new REShader(re);
                }
                else
                {
                    // RenderingEngine using the OpenGL fixed-function pipeline (i.e. without shaders)
                    re = new REFixedFunction(re);
                }
            }

            // Proxy removing redundant calls.
            // E.g. calls setting multiple times the same value,
            // or calls with an invalid parameter (e.g. for unused shader uniforms).
            // In the rendering pipeline, the State Proxy has to be called after
            // the Anisotropic/Viewport filters. These are modifying some parameters
            // and the State Proxy has to use the sealed override parameter values.
            re = new StateProxy(re);

            // Proxy implementing a texture anisotropic filter
            re = new AnisotropicFilter(re);

            // Proxy implementing a viewport resizing filter
            re = new ViewportFilter(re);

            // Return the first entry in the pipeline
            return(re);
        }