// // Copyright 2018 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. // // GLES1Shaders.inc: Defines GLES1 emulation shader. // // According to the GLES1 specification: // // We require simply that numbers' floating point parts contain enough bits and that their exponent // fields are large enough so that individual results of floating-point operations are accurate to // about 1 part in 10^5. The maximum representable magnitude of a floating-point number used to // represent positional or normal coordinates must be at least 2^32; the maximum representable // magnitude for colors or texture coordinates must be at least 2^10. The maximum representable // magnitude for all other floating-point values must be at least 2^32 . // // Internal computations can use either fixed-point or floating-point arithmetic. Fixed-point // computations must be accurate to within ±2^-15. The maximum representable magnitude for a // fixed-point number used to represent positional or normal coordinates must be at least 2^15; the // maximum representable magnitude for colors or texture coordinates must be at least 2^10. The // maximum representable magnitude for all other fixed-point values must be at least 2^15 // // Accordingly, ANGLE uses highp floats for position and normal data, mediump for color and texture // coordinates, and highp for everything else. // The following variables are added in GLES1Renderer::initializeRendererProgram // #define kTexUnits // bool clip_plane_enables // bool enable_alpha_test // bool enable_clip_planes // bool enable_color_material // bool enable_draw_texture // bool enable_fog // bool enable_lighting // bool enable_normalize // bool enable_rescale_normal // bool enable_texture_2d[kMaxTexUnits] // bool enable_texture_cube_map[kMaxTexUnits] // bool light_enables[kMaxLights] // bool light_model_two_sided // bool point_rasterization // bool point_sprite_coord_replace // bool point_sprite_enabled // bool shade_model_flat // uint texture_format[kMaxTexUnits]; // uint texture_env_mode[kMaxTexUnits]; // uint combine_rgb[kMaxTexUnits]; // uint combine_alpha[kMaxTexUnits]; // uint src0_rgb[kMaxTexUnits]; // uint src0_alpha[kMaxTexUnits]; // uint src1_rgb[kMaxTexUnits]; // uint src1_alpha[kMaxTexUnits]; // uint src2_rgb[kMaxTexUnits]; // uint src2_alpha[kMaxTexUnits]; // uint op0_rgb[kMaxTexUnits]; // uint op0_alpha[kMaxTexUnits]; // uint op1_rgb[kMaxTexUnits]; // uint op1_alpha[kMaxTexUnits]; // uint op2_rgb[kMaxTexUnits]; // uint op2_alpha[kMaxTexUnits]; // uint alpha_func; // uint fog_mode; constexpr char kGLES1TexUnitsDefine[] = …; constexpr char kGLES1DrawVShaderHeader[] = …; constexpr char kGLES1DrawVShader[] = …; constexpr char kGLES1DrawFShaderVersion[] = …; constexpr char kGLES1DrawFShaderHeader[] = …; constexpr char kGLES1DrawFShaderUniformDefs[] = …; constexpr char kGLES1DrawFShaderOutputDef[] = …; constexpr char kGLES1DrawFShaderFramebufferFetchOutputDef[] = …; constexpr char kGLES1DrawFShaderFramebufferFetchNonCoherentOutputDef[] = …; constexpr char kGLES1DrawFShaderFunctions[] = …; constexpr char kGLES1DrawFShaderLogicOpFramebufferFetchDisabled[] = …; // applyLogicOp takes logic-op information from a packed uniform and applies it to the color // attachment using framebuffer fetch. See the description of logic_op above for the format of the // uniform. // // In particular, 4 bits in logic_op (at offset 16) contain the packed logical operation (of // LogicalOperation type). Based on the selected operation, the formula specified in the spec is // applied (applied as bitwise operations on unorm values). constexpr char kGLES1DrawFShaderLogicOpFramebufferFetchEnabled[] = …; constexpr char kGLES1DrawFShaderMultitexturing[] = …; constexpr char kGLES1DrawFShaderMain[] = …;