// // Copyright 2020 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // ProgramExecutable.h: Collects the information and interfaces common to both Programs and // ProgramPipelines in order to execute/draw with either.
// This small structure encapsulates binding sampler uniforms to active GL textures. struct SamplerBinding
{
SamplerBinding(TextureType textureTypeIn,
GLenum samplerTypeIn,
SamplerFormat formatIn,
size_t elementCount);
SamplerBinding(const SamplerBinding &other);
~SamplerBinding();
// Necessary for retrieving active textures from the GL state.
TextureType textureType;
GLenum samplerType;
SamplerFormat format;
// List of all textures bound to this sampler, of type textureType. // Cropped by the amount of unused elements reported by the driver.
std::vector<GLuint> boundTextureUnits;
};
// Necessary for distinguishing between textures with images and texture buffers.
TextureType textureType;
// List of all textures bound. // Cropped by the amount of unused elements reported by the driver.
std::vector<GLuint> boundImageUnits;
};
// A varying with transform feedback enabled. If it's an array, either the whole array or one of its // elements specified by 'arrayIndex' can set to be enabled. struct TransformFeedbackVarying : public sh::ShaderVariable
{
TransformFeedbackVarying(const sh::ShaderVariable &varyingIn, GLuint arrayIndexIn)
: sh::ShaderVariable(varyingIn), arrayIndex(arrayIndexIn)
{
ASSERT(!isArrayOfArrays());
}
class ProgramExecutable final : public angle::Subject
{ public:
ProgramExecutable();
ProgramExecutable(const ProgramExecutable &other);
~ProgramExecutable() override;
// Count the number of uniform and storage buffer declarations, counting arrays as one.
size_t getTransformFeedbackBufferCount() const { return mTransformFeedbackStrides.size(); }
void resetCachedValidateSamplersResult() { mCachedValidateSamplersResult.reset(); } bool validateSamplers(InfoLog *infoLog, const Caps &caps) const
{ // Use the cache if: // - we aren't using an info log (which gives the full error). // - The sample mapping hasn't changed and we've already validated. if (infoLog == nullptr && mCachedValidateSamplersResult.valid())
{ return mCachedValidateSamplersResult.value();
}
// Scans the sampler bindings for type conflicts with sampler 'textureUnitIndex'. void setSamplerUniformTextureTypeAndFormat(size_t textureUnitIndex,
std::vector<SamplerBinding> &samplerBindings);
angle::BitSet<MAX_VERTEX_ATTRIBS> mActiveAttribLocationsMask; unsignedint mMaxActiveAttribLocation;
ComponentTypeMask mAttributesTypeMask; // mAttributesMask is identical to mActiveAttribLocationsMask with built-in attributes removed.
AttributesMask mAttributesMask;
// Cached mask of active samplers and sampler types.
ActiveTextureMask mActiveSamplersMask;
ActiveTextureArray<uint32_t> mActiveSamplerRefCounts;
ActiveTextureArray<TextureType> mActiveSamplerTypes;
ActiveTextureMask mActiveSamplerYUV;
ActiveTextureArray<SamplerFormat> mActiveSamplerFormats;
ActiveTextureArray<ShaderBitSet> mActiveSamplerShaderBits;
// Cached mask of active images.
ActiveTextureMask mActiveImagesMask;
ActiveTextureArray<ShaderBitSet> mActiveImageShaderBits;
bool mCanDrawWith;
// Names and mapped names of output variables that are arrays include [0] in the end, similarly // to uniforms.
std::vector<sh::ShaderVariable> mOutputVariables;
std::vector<VariableLocation> mOutputLocations;
DrawBufferMask mActiveOutputVariablesMask; // EXT_blend_func_extended secondary outputs (ones with index 1)
std::vector<VariableLocation> mSecondaryOutputLocations; bool mYUVOutput; // Vertex attributes, Fragment input varyings, etc.
std::vector<sh::ShaderVariable> mProgramInputs;
std::vector<TransformFeedbackVarying> mLinkedTransformFeedbackVaryings; // The size of the data written to each transform feedback buffer per vertex.
std::vector<GLsizei> mTransformFeedbackStrides;
GLenum mTransformFeedbackBufferMode; // Uniforms are sorted in order: // 1. Non-opaque uniforms // 2. Sampler uniforms // 3. Image uniforms // 4. Atomic counter uniforms // 5. Subpass Input uniforms (Only for Vulkan) // 6. Uniform block uniforms // This makes opaque uniform validation easier, since we don't need a separate list. // For generating the entries and naming them we follow the spec: GLES 3.1 November 2016 section // 7.3.1.1 Naming Active Resources. There's a separate entry for each struct member and each // inner array of an array of arrays. Names and mapped names of uniforms that are arrays include // [0] in the end. This makes implementation of queries simpler.
std::vector<LinkedUniform> mUniforms;
RangeUI mDefaultUniformRange;
RangeUI mSamplerUniformRange;
RangeUI mImageUniformRange;
RangeUI mAtomicCounterUniformRange;
std::vector<InterfaceBlock> mUniformBlocks;
// For faster iteration on the blocks currently being bound.
UniformBlockBindingMask mActiveUniformBlockBindings;
// GL_EXT_geometry_shader.
PrimitiveMode mGeometryShaderInputPrimitiveType;
PrimitiveMode mGeometryShaderOutputPrimitiveType; int mGeometryShaderInvocations; int mGeometryShaderMaxVertices;
// Fragment output variable base types: FLOAT, INT, or UINT. Ordered by location.
std::vector<GLenum> mOutputVariableTypes;
ComponentTypeMask mDrawBufferTypeMask;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.