Hash :
8ba04f1c
Author :
Date :
2023-08-05T00:48:35
Metal: disable fastmath less often. Stop disabling fastmath if atan is used in the shader. Application developers will surely prefer the significant performance improvement of the fastmath optimizations over corner-case differences in precision. Make disabling fastmath more precise: only if it's forcibly disabled as a driver bug workaround, or if the shader uses invariance and preserveInvariance is not available. Suppress the test: dEQP-GLES[23].functional.shaders.invariance.lowp.loop_2 which fails when fastmath is enabled for shaders using atan and invariance. Fixed: chromium:1320111 Change-Id: I6e33b14b1d05faedc15373f24af3e22a4074a35b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4754018 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Kenneth Russell <kbr@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//
// Copyright 2019 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.
//
// mtl_msl_utils.h: Utilities to manipulate MSL.
//
#ifndef mtl_msl_utils_h
#define mtl_msl_utils_h
#include "libANGLE/Context.h"
#include "libANGLE/renderer/ProgramImpl.h"
#include "libANGLE/renderer/metal/mtl_common.h"
namespace rx
{
namespace mtl
{
struct SamplerBinding
{
uint32_t textureBinding = 0;
uint32_t samplerBinding = 0;
};
struct TranslatedShaderInfo
{
void reset();
// Translated Metal source code
std::shared_ptr<const std::string> metalShaderSource;
// Metal library compiled from source code above. Used by ProgramMtl.
AutoObjCPtr<id<MTLLibrary>> metalLibrary;
std::array<SamplerBinding, kMaxGLSamplerBindings> actualSamplerBindings;
std::array<int, kMaxShaderImages> actualImageBindings;
std::array<uint32_t, kMaxGLUBOBindings> actualUBOBindings;
std::array<uint32_t, kMaxShaderXFBs> actualXFBBindings;
bool hasUBOArgumentBuffer;
bool hasInvariant;
};
void MSLGetShaderSource(const gl::Context *context,
const gl::ProgramState &programState,
const gl::ProgramLinkedResources &resources,
gl::ShaderMap<std::string> *shaderSourcesOut);
angle::Result MTLGetMSL(const gl::Context *glContext,
const gl::ProgramState &programState,
const gl::Caps &glCaps,
const gl::ShaderMap<std::string> &shaderSources,
gl::ShaderMap<TranslatedShaderInfo> *mslShaderInfoOut,
size_t xfbBufferCount);
// Get equivalent shadow compare mode that is used in translated msl shader.
uint MslGetShaderShadowCompareMode(GLenum mode, GLenum func);
} // namespace mtl
} // namespace rx
#endif /* mtl_msl_utils_h */