tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rrShaders.js (4511B)


      1 /*-------------------------------------------------------------------------
      2 * drawElements Quality Program OpenGL ES Utilities
      3 * ------------------------------------------------
      4 *
      5 * Copyright 2014 The Android Open Source Project
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *      http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 *
     19 */
     20 
     21 'use strict';
     22 goog.provide('framework.referencerenderer.rrShaders');
     23 goog.require('framework.common.tcuTexture');
     24 goog.require('framework.delibs.debase.deMath');
     25 goog.require('framework.referencerenderer.rrGenericVector');
     26 goog.require('framework.referencerenderer.rrShadingContext');
     27 goog.require('framework.referencerenderer.rrVertexAttrib');
     28 goog.require('framework.referencerenderer.rrVertexPacket');
     29 
     30 goog.scope(function() {
     31 
     32 var rrShaders = framework.referencerenderer.rrShaders;
     33 var tcuTexture = framework.common.tcuTexture;
     34 var deMath = framework.delibs.debase.deMath;
     35 var rrGenericVector = framework.referencerenderer.rrGenericVector;
     36 var rrShadingContext = framework.referencerenderer.rrShadingContext;
     37 var rrVertexAttrib = framework.referencerenderer.rrVertexAttrib;
     38 var rrVertexPacket = framework.referencerenderer.rrVertexPacket;
     39 
     40    /**
     41     * Vertex shader input information
     42     * @constructor
     43     */
     44    rrShaders.VertexInputInfo = function() {
     45        /** @type {rrGenericVector.GenericVecType} */ this.type;
     46    };
     47 
     48    /**
     49     * Shader varying information
     50     * @constructor
     51     */
     52    rrShaders.VertexVaryingInfo = function() {
     53        /** @type {rrGenericVector.GenericVecType} */ this.type;
     54        /** @type {boolean} */ var flatshade = false;
     55    };
     56 
     57    /**
     58     * Fragment shader output information
     59     * @constructor
     60     */
     61    rrShaders.FragmentOutputInfo = function() {
     62        //Sensible defaults
     63        /** @type {rrGenericVector.GenericVecType} */ this.type;
     64    };
     65 
     66    /**
     67     * Vertex shader interface
     68     *
     69     * Vertex shaders execute shading for set of vertex packets. See VertexPacket
     70     * documentation for more details on shading API.
     71     * @constructor
     72     * @param {number} numInputs
     73     * @param {number} numOutputs
     74     */
     75    rrShaders.VertexShader = function(numInputs, numOutputs) {
     76        /** @type {Array<rrShaders.VertexInputInfo>} */ this.m_inputs = [];
     77        for (var ndx = 0; ndx < numInputs; ndx++) this.m_inputs[ndx] = new rrShaders.VertexInputInfo();
     78        /** @type {Array<rrShaders.VertexVaryingInfo>} */ this.m_outputs = [];
     79        for (var ndx = 0; ndx < numOutputs; ndx++) this.m_outputs[ndx] = new rrShaders.VertexVaryingInfo();
     80    };
     81 
     82    /**
     83     * getInputs
     84     * @return {Array<rrShaders.VertexInputInfo>}
     85     */
     86    rrShaders.VertexShader.prototype.getInputs = function() {return this.m_inputs;};
     87 
     88    /**
     89     * getOutputs
     90     * @return {Array<rrShaders.VertexVaryingInfo>}
     91     */
     92    rrShaders.VertexShader.prototype.getOutputs = function() {return this.m_outputs;};
     93 
     94    /**
     95     * Fragment shader interface
     96     *
     97     * Fragment shader executes shading for list of fragment packets. See
     98     * FragmentPacket documentation for more details on shading API.
     99     * @constructor
    100     * @param {number} numInputs
    101     * @param {number} numOutputs
    102     */
    103    rrShaders.FragmentShader = function(numInputs, numOutputs) {
    104        /** @type {Array<rrShaders.VertexVaryingInfo>} */ this.m_inputs = [];
    105        for (var ndx = 0; ndx < numInputs; ndx++) this.m_inputs[ndx] = new rrShaders.VertexVaryingInfo();
    106        /** @type {Array<rrShaders.FragmentOutputInfo>} */ this.m_outputs = [];
    107        for (var ndx = 0; ndx < numOutputs; ndx++) this.m_outputs[ndx] = new rrShaders.FragmentOutputInfo();
    108        /** @type {*} */ this.m_container; // owner object
    109    };
    110 
    111    /**
    112     * getInputs
    113     * @return {Array<rrShaders.VertexVaryingInfo>}
    114     */
    115    rrShaders.FragmentShader.prototype.getInputs = function() {return this.m_inputs;};
    116 
    117    /**
    118     * getOutputs
    119     * @return {Array<rrShaders.FragmentOutputInfo>}
    120     */
    121    rrShaders.FragmentShader.prototype.getOutputs = function() {return this.m_outputs;};
    122 
    123 });