зеркало из https://github.com/AvaloniaUI/angle.git
Metal backend skeleton implementation.
Bug: angleproject:2634 Change-Id: I34be82f4a80a6851fecb53a51e069b134d82613a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1849079 Commit-Queue: Le Hoang Quyen <le.hoang.q@gmail.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
aa292a59f9
Коммит
d200a77a22
19
BUILD.gn
19
BUILD.gn
|
@ -419,11 +419,20 @@ angle_static_library("translator") {
|
|||
defines += [ "ANGLE_ENABLE_HLSL" ]
|
||||
}
|
||||
|
||||
if (angle_enable_vulkan || use_fuzzing_engine) {
|
||||
if (angle_enable_vulkan || use_fuzzing_engine || angle_enable_metal) {
|
||||
# This translator is needed by metal backend also.
|
||||
sources += angle_translator_lib_vulkan_sources
|
||||
}
|
||||
|
||||
if (angle_enable_vulkan || use_fuzzing_engine) {
|
||||
defines += [ "ANGLE_ENABLE_VULKAN" ]
|
||||
}
|
||||
|
||||
if (angle_enable_metal) {
|
||||
sources += angle_translator_lib_metal_sources
|
||||
defines += [ "ANGLE_ENABLE_METAL" ]
|
||||
}
|
||||
|
||||
public_configs += [ ":external_config" ]
|
||||
|
||||
deps = [
|
||||
|
@ -524,6 +533,10 @@ config("angle_backend_config") {
|
|||
defines += [ "ANGLE_ENABLE_NULL" ]
|
||||
}
|
||||
|
||||
if (angle_enable_metal) {
|
||||
configs = [ "src/libANGLE/renderer/metal:angle_metal_backend_config" ]
|
||||
}
|
||||
|
||||
if (angle_enable_vulkan) {
|
||||
configs = [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
|
||||
}
|
||||
|
@ -592,6 +605,10 @@ angle_source_set("libANGLE_base") {
|
|||
public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
|
||||
}
|
||||
|
||||
if (angle_enable_metal) {
|
||||
public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
|
||||
}
|
||||
|
||||
# Enable extra Chromium style warnings for libANGLE.
|
||||
if (is_clang) {
|
||||
suppressed_configs -= [ "//build/config/clang:find_bad_constructs" ]
|
||||
|
|
|
@ -93,6 +93,9 @@ declare_args() {
|
|||
angle_enable_null = true
|
||||
angle_enable_essl = true
|
||||
angle_enable_glsl = true
|
||||
|
||||
# http://anglebug.com/2634
|
||||
angle_enable_metal = is_mac
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 216
|
||||
#define ANGLE_SH_VERSION 217
|
||||
|
||||
enum ShShaderSpec
|
||||
{
|
||||
|
@ -69,6 +69,10 @@ enum ShShaderOutput
|
|||
|
||||
// Output specialized GLSL to be fed to glslang for Vulkan SPIR.
|
||||
SH_GLSL_VULKAN_OUTPUT = 0x8B4B,
|
||||
|
||||
// Output specialized GLSL to be fed to glslang for Vulkan SPIR to be cross compiled to Metal
|
||||
// later.
|
||||
SH_GLSL_METAL_OUTPUT = 0x8B4C,
|
||||
};
|
||||
|
||||
// Compile options.
|
||||
|
|
|
@ -175,6 +175,7 @@ IGNORED_INCLUDES = {
|
|||
b'compiler/translator/TranslatorESSL.h',
|
||||
b'compiler/translator/TranslatorGLSL.h',
|
||||
b'compiler/translator/TranslatorHLSL.h',
|
||||
b'compiler/translator/TranslatorMetal.h',
|
||||
b'compiler/translator/TranslatorVulkan.h',
|
||||
b'libANGLE/renderer/d3d/DeviceD3D.h',
|
||||
b'libANGLE/renderer/d3d/DisplayD3D.h',
|
||||
|
@ -185,6 +186,7 @@ IGNORED_INCLUDES = {
|
|||
b'libANGLE/renderer/gl/egl/ozone/DisplayOzone.h',
|
||||
b'libANGLE/renderer/gl/egl/android/DisplayAndroid.h',
|
||||
b'libANGLE/renderer/gl/wgl/DisplayWGL.h',
|
||||
b'libANGLE/renderer/metal/DisplayMtl.h',
|
||||
b'libANGLE/renderer/null/DisplayNULL.h',
|
||||
b'libANGLE/renderer/vulkan/android/DisplayVkAndroid.h',
|
||||
b'libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h',
|
||||
|
|
|
@ -455,12 +455,12 @@ inline float float10ToFloat32(unsigned short fp11)
|
|||
|
||||
// Convers to and from float and 16.16 fixed point format.
|
||||
|
||||
inline float FixedToFloat(uint32_t fixedInput)
|
||||
inline float ConvertFixedToFloat(uint32_t fixedInput)
|
||||
{
|
||||
return static_cast<float>(fixedInput) / 65536.0f;
|
||||
}
|
||||
|
||||
inline uint32_t FloatToFixed(float floatInput)
|
||||
inline uint32_t ConvertFloatToFixed(float floatInput)
|
||||
{
|
||||
static constexpr uint32_t kHighest = 32767 * 65536 + 65535;
|
||||
static constexpr uint32_t kLowest = static_cast<uint32_t>(-32768 * 65536 + 65535);
|
||||
|
|
|
@ -310,6 +310,14 @@ if (is_android) {
|
|||
"src/compiler/translator/SymbolTable_autogen.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
angle_translator_lib_metal_sources = [
|
||||
"src/compiler/translator/OutputVulkanGLSLForMetal.mm",
|
||||
"src/compiler/translator/OutputVulkanGLSLForMetal.h",
|
||||
"src/compiler/translator/TranslatorMetal.cpp",
|
||||
"src/compiler/translator/TranslatorMetal.h",
|
||||
]
|
||||
|
||||
angle_preprocessor_sources = [
|
||||
"src/compiler/preprocessor/DiagnosticsBase.cpp",
|
||||
"src/compiler/preprocessor/DiagnosticsBase.h",
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
# include "compiler/translator/TranslatorVulkan.h"
|
||||
#endif // ANGLE_ENABLE_VULKAN
|
||||
|
||||
#ifdef ANGLE_ENABLE_METAL
|
||||
# include "compiler/translator/TranslatorMetal.h"
|
||||
#endif // ANGLE_ENABLE_METAL
|
||||
|
||||
#include "compiler/translator/util.h"
|
||||
|
||||
namespace sh
|
||||
|
@ -60,6 +64,13 @@ TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput
|
|||
}
|
||||
#endif // ANGLE_ENABLE_VULKAN
|
||||
|
||||
#ifdef ANGLE_ENABLE_METAL
|
||||
if (IsOutputMetal(output))
|
||||
{
|
||||
return new TranslatorMetal(type, spec);
|
||||
}
|
||||
#endif // ANGLE_ENABLE_METAL
|
||||
|
||||
// Unsupported compiler or unknown format. Return nullptr per the sh::ConstructCompiler API.
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
// TOutputVulkanGLSLForMetal:
|
||||
// This is a special version Vulkan GLSL output that will make some special
|
||||
// considerations for Metal backend limitations.
|
||||
//
|
||||
|
||||
#include "compiler/translator/OutputVulkanGLSL.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
class TOutputVulkanGLSLForMetal : public TOutputVulkanGLSL
|
||||
{
|
||||
public:
|
||||
TOutputVulkanGLSLForMetal(TInfoSinkBase &objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap &nameMap,
|
||||
TSymbolTable *symbolTable,
|
||||
sh::GLenum shaderType,
|
||||
int shaderVersion,
|
||||
ShShaderOutput output,
|
||||
ShCompileOptions compileOptions);
|
||||
};
|
||||
|
||||
} // namespace sh
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
// TOutputVulkanGLSLForMetal:
|
||||
// This is a special version Vulkan GLSL output that will make some special
|
||||
// considerations for Metal backend limitations.
|
||||
//
|
||||
|
||||
#include "compiler/translator/OutputVulkanGLSLForMetal.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
TOutputVulkanGLSLForMetal::TOutputVulkanGLSLForMetal(TInfoSinkBase &objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap &nameMap,
|
||||
TSymbolTable *symbolTable,
|
||||
sh::GLenum shaderType,
|
||||
int shaderVersion,
|
||||
ShShaderOutput output,
|
||||
ShCompileOptions compileOptions)
|
||||
: TOutputVulkanGLSL(objSink,
|
||||
clampingStrategy,
|
||||
hashFunction,
|
||||
nameMap,
|
||||
symbolTable,
|
||||
shaderType,
|
||||
shaderVersion,
|
||||
output,
|
||||
compileOptions)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
} // namespace sh
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
// TranslatorMetal:
|
||||
// Translator for Metal backend.
|
||||
//
|
||||
|
||||
#include "compiler/translator/TranslatorMetal.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "compiler/translator/OutputVulkanGLSLForMetal.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
TranslatorMetal::TranslatorMetal(sh::GLenum type, ShShaderSpec spec)
|
||||
: TCompiler(type, spec, SH_GLSL_450_CORE_OUTPUT)
|
||||
{}
|
||||
|
||||
bool TranslatorMetal::translate(TIntermBlock *root,
|
||||
ShCompileOptions compileOptions,
|
||||
PerformanceDiagnostics * /*perfDiagnostics*/)
|
||||
{
|
||||
TInfoSinkBase &sink = getInfoSink().obj;
|
||||
TOutputVulkanGLSLForMetal outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(),
|
||||
getNameMap(), &getSymbolTable(), getShaderType(),
|
||||
getShaderVersion(), getOutputType(), compileOptions);
|
||||
|
||||
UNIMPLEMENTED();
|
||||
|
||||
root->traverse(&outputGLSL);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TranslatorMetal::shouldFlattenPragmaStdglInvariantAll()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace sh
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
// TranslatorMetal:
|
||||
// Translator for Metal backend.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_
|
||||
|
||||
#include "compiler/translator/Compiler.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
class TranslatorMetal : public TCompiler
|
||||
{
|
||||
public:
|
||||
TranslatorMetal(sh::GLenum type, ShShaderSpec spec);
|
||||
|
||||
protected:
|
||||
ANGLE_NO_DISCARD bool translate(TIntermBlock *root,
|
||||
ShCompileOptions compileOptions,
|
||||
PerformanceDiagnostics *perfDiagnostics) override;
|
||||
|
||||
bool shouldFlattenPragmaStdglInvariantAll() override;
|
||||
};
|
||||
|
||||
} // namespace sh
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_TRANSLATORMETAL_H_ */
|
|
@ -757,6 +757,10 @@ bool IsOutputVulkan(ShShaderOutput output)
|
|||
{
|
||||
return output == SH_GLSL_VULKAN_OUTPUT;
|
||||
}
|
||||
bool IsOutputMetal(ShShaderOutput output)
|
||||
{
|
||||
return output == SH_GLSL_METAL_OUTPUT;
|
||||
}
|
||||
|
||||
bool IsInShaderStorageBlock(TIntermTyped *node)
|
||||
{
|
||||
|
|
|
@ -76,6 +76,7 @@ bool IsOutputESSL(ShShaderOutput output);
|
|||
bool IsOutputGLSL(ShShaderOutput output);
|
||||
bool IsOutputHLSL(ShShaderOutput output);
|
||||
bool IsOutputVulkan(ShShaderOutput output);
|
||||
bool IsOutputMetal(ShShaderOutput output);
|
||||
|
||||
bool IsInShaderStorageBlock(TIntermTyped *node);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ angle::Mat4 FixedMatrixToMat4(const GLfixed *m)
|
|||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
floatData[i] = gl::FixedToFloat(m[i]);
|
||||
floatData[i] = gl::ConvertFixedToFloat(m[i]);
|
||||
}
|
||||
|
||||
return matrixAsFloat;
|
||||
|
@ -43,7 +43,7 @@ void Context::alphaFunc(AlphaTestFunc func, GLfloat ref)
|
|||
|
||||
void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref)
|
||||
{
|
||||
mState.gles1().setAlphaFunc(func, FixedToFloat(ref));
|
||||
mState.gles1().setAlphaFunc(func, ConvertFixedToFloat(ref));
|
||||
}
|
||||
|
||||
void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
|
||||
|
@ -70,10 +70,10 @@ void Context::clipPlanef(GLenum p, const GLfloat *eqn)
|
|||
void Context::clipPlanex(GLenum plane, const GLfixed *equation)
|
||||
{
|
||||
const GLfloat equationf[4] = {
|
||||
FixedToFloat(equation[0]),
|
||||
FixedToFloat(equation[1]),
|
||||
FixedToFloat(equation[2]),
|
||||
FixedToFloat(equation[3]),
|
||||
ConvertFixedToFloat(equation[0]),
|
||||
ConvertFixedToFloat(equation[1]),
|
||||
ConvertFixedToFloat(equation[2]),
|
||||
ConvertFixedToFloat(equation[3]),
|
||||
};
|
||||
|
||||
mState.gles1().setClipPlane(plane - GL_CLIP_PLANE0, equationf);
|
||||
|
@ -93,8 +93,8 @@ void Context::color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
|
|||
|
||||
void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
|
||||
{
|
||||
mState.gles1().setCurrentColor(
|
||||
{FixedToFloat(red), FixedToFloat(green), FixedToFloat(blue), FixedToFloat(alpha)});
|
||||
mState.gles1().setCurrentColor({ConvertFixedToFloat(red), ConvertFixedToFloat(green),
|
||||
ConvertFixedToFloat(blue), ConvertFixedToFloat(alpha)});
|
||||
}
|
||||
|
||||
void Context::colorPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
|
||||
|
@ -136,7 +136,7 @@ void Context::fogx(GLenum pname, GLfixed param)
|
|||
{
|
||||
if (GetFogParameterCount(pname) == 1)
|
||||
{
|
||||
GLfloat paramf = pname == GL_FOG_MODE ? ConvertToGLenum(param) : FixedToFloat(param);
|
||||
GLfloat paramf = pname == GL_FOG_MODE ? ConvertToGLenum(param) : ConvertFixedToFloat(param);
|
||||
fogf(pname, paramf);
|
||||
}
|
||||
else
|
||||
|
@ -155,7 +155,7 @@ void Context::fogxv(GLenum pname, const GLfixed *params)
|
|||
for (int i = 0; i < paramCount; i++)
|
||||
{
|
||||
paramsf[i] =
|
||||
pname == GL_FOG_MODE ? ConvertToGLenum(params[i]) : FixedToFloat(params[i]);
|
||||
pname == GL_FOG_MODE ? ConvertToGLenum(params[i]) : ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
fogfv(pname, paramsf);
|
||||
}
|
||||
|
@ -172,9 +172,9 @@ void Context::frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GL
|
|||
|
||||
void Context::frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
|
||||
{
|
||||
mState.gles1().multMatrix(angle::Mat4::Frustum(FixedToFloat(l), FixedToFloat(r),
|
||||
FixedToFloat(b), FixedToFloat(t),
|
||||
FixedToFloat(n), FixedToFloat(f)));
|
||||
mState.gles1().multMatrix(angle::Mat4::Frustum(ConvertFixedToFloat(l), ConvertFixedToFloat(r),
|
||||
ConvertFixedToFloat(b), ConvertFixedToFloat(t),
|
||||
ConvertFixedToFloat(n), ConvertFixedToFloat(f)));
|
||||
}
|
||||
|
||||
void Context::getClipPlanef(GLenum plane, GLfloat *equation)
|
||||
|
@ -190,7 +190,7 @@ void Context::getClipPlanex(GLenum plane, GLfixed *equation)
|
|||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
equation[i] = FloatToFixed(equationf[i]);
|
||||
equation[i] = ConvertFloatToFixed(equationf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ void Context::getLightxv(GLenum light, LightParameter pname, GLfixed *params)
|
|||
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
params[i] = FloatToFixed(paramsf[i]);
|
||||
params[i] = ConvertFloatToFixed(paramsf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ void Context::getMaterialxv(GLenum face, MaterialParameter pname, GLfixed *param
|
|||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
params[i] = FloatToFixed(paramsf[i]);
|
||||
params[i] = ConvertFloatToFixed(paramsf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ void Context::lightModelfv(GLenum pname, const GLfloat *params)
|
|||
|
||||
void Context::lightModelx(GLenum pname, GLfixed param)
|
||||
{
|
||||
lightModelf(pname, FixedToFloat(param));
|
||||
lightModelf(pname, ConvertFixedToFloat(param));
|
||||
}
|
||||
|
||||
void Context::lightModelxv(GLenum pname, const GLfixed *param)
|
||||
|
@ -276,7 +276,7 @@ void Context::lightModelxv(GLenum pname, const GLfixed *param)
|
|||
|
||||
for (unsigned int i = 0; i < GetLightModelParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(param[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(param[i]);
|
||||
}
|
||||
|
||||
lightModelfv(pname, paramsf);
|
||||
|
@ -294,7 +294,7 @@ void Context::lightfv(GLenum light, LightParameter pname, const GLfloat *params)
|
|||
|
||||
void Context::lightx(GLenum light, LightParameter pname, GLfixed param)
|
||||
{
|
||||
lightf(light, pname, FixedToFloat(param));
|
||||
lightf(light, pname, ConvertFixedToFloat(param));
|
||||
}
|
||||
|
||||
void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
|
||||
|
@ -303,7 +303,7 @@ void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
|
|||
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
lightfv(light, pname, paramsf);
|
||||
|
@ -346,7 +346,7 @@ void Context::materialfv(GLenum face, MaterialParameter pname, const GLfloat *pa
|
|||
|
||||
void Context::materialx(GLenum face, MaterialParameter pname, GLfixed param)
|
||||
{
|
||||
materialf(face, pname, FixedToFloat(param));
|
||||
materialf(face, pname, ConvertFixedToFloat(param));
|
||||
}
|
||||
|
||||
void Context::materialxv(GLenum face, MaterialParameter pname, const GLfixed *param)
|
||||
|
@ -355,7 +355,7 @@ void Context::materialxv(GLenum face, MaterialParameter pname, const GLfixed *pa
|
|||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(param[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(param[i]);
|
||||
}
|
||||
|
||||
materialfv(face, pname, paramsf);
|
||||
|
@ -387,8 +387,8 @@ void Context::multiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GL
|
|||
{
|
||||
unsigned int unit = target - GL_TEXTURE0;
|
||||
ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits);
|
||||
mState.gles1().setCurrentTextureCoords(
|
||||
unit, {FixedToFloat(s), FixedToFloat(t), FixedToFloat(r), FixedToFloat(q)});
|
||||
mState.gles1().setCurrentTextureCoords(unit, {ConvertFixedToFloat(s), ConvertFixedToFloat(t),
|
||||
ConvertFixedToFloat(r), ConvertFixedToFloat(q)});
|
||||
}
|
||||
|
||||
void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
|
||||
|
@ -398,7 +398,8 @@ void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
|
|||
|
||||
void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
|
||||
{
|
||||
mState.gles1().setCurrentNormal({FixedToFloat(nx), FixedToFloat(ny), FixedToFloat(nz)});
|
||||
mState.gles1().setCurrentNormal(
|
||||
{ConvertFixedToFloat(nx), ConvertFixedToFloat(ny), ConvertFixedToFloat(nz)});
|
||||
}
|
||||
|
||||
void Context::normalPointer(VertexAttribType type, GLsizei stride, const void *ptr)
|
||||
|
@ -419,9 +420,9 @@ void Context::orthof(GLfloat left,
|
|||
|
||||
void Context::orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
|
||||
{
|
||||
mState.gles1().multMatrix(angle::Mat4::Ortho(FixedToFloat(l), FixedToFloat(r), FixedToFloat(b),
|
||||
FixedToFloat(t), FixedToFloat(n),
|
||||
FixedToFloat(f)));
|
||||
mState.gles1().multMatrix(angle::Mat4::Ortho(ConvertFixedToFloat(l), ConvertFixedToFloat(r),
|
||||
ConvertFixedToFloat(b), ConvertFixedToFloat(t),
|
||||
ConvertFixedToFloat(n), ConvertFixedToFloat(f)));
|
||||
}
|
||||
|
||||
void Context::pointParameterf(PointParameter pname, GLfloat param)
|
||||
|
@ -436,7 +437,7 @@ void Context::pointParameterfv(PointParameter pname, const GLfloat *params)
|
|||
|
||||
void Context::pointParameterx(PointParameter pname, GLfixed param)
|
||||
{
|
||||
GLfloat paramf = FixedToFloat(param);
|
||||
GLfloat paramf = ConvertFixedToFloat(param);
|
||||
SetPointParameter(&mState.gles1(), pname, ¶mf);
|
||||
}
|
||||
|
||||
|
@ -445,7 +446,7 @@ void Context::pointParameterxv(PointParameter pname, const GLfixed *params)
|
|||
GLfloat paramsf[4] = {};
|
||||
for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
SetPointParameter(&mState.gles1(), pname, paramsf);
|
||||
}
|
||||
|
@ -457,7 +458,7 @@ void Context::pointSize(GLfloat size)
|
|||
|
||||
void Context::pointSizex(GLfixed size)
|
||||
{
|
||||
SetPointSize(&mState.gles1(), FixedToFloat(size));
|
||||
SetPointSize(&mState.gles1(), ConvertFixedToFloat(size));
|
||||
}
|
||||
|
||||
void Context::polygonOffsetx(GLfixed factor, GLfixed units)
|
||||
|
@ -483,7 +484,8 @@ void Context::rotatef(float angle, float x, float y, float z)
|
|||
void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
|
||||
{
|
||||
mState.gles1().multMatrix(angle::Mat4::Rotate(
|
||||
FixedToFloat(angle), angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
|
||||
ConvertFixedToFloat(angle),
|
||||
angle::Vector3(ConvertFixedToFloat(x), ConvertFixedToFloat(y), ConvertFixedToFloat(z))));
|
||||
}
|
||||
|
||||
void Context::sampleCoveragex(GLclampx value, GLboolean invert)
|
||||
|
@ -498,8 +500,8 @@ void Context::scalef(float x, float y, float z)
|
|||
|
||||
void Context::scalex(GLfixed x, GLfixed y, GLfixed z)
|
||||
{
|
||||
mState.gles1().multMatrix(
|
||||
angle::Mat4::Scale(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
|
||||
mState.gles1().multMatrix(angle::Mat4::Scale(
|
||||
angle::Vector3(ConvertFixedToFloat(x), ConvertFixedToFloat(y), ConvertFixedToFloat(z))));
|
||||
}
|
||||
|
||||
void Context::shadeModel(ShadingModel model)
|
||||
|
@ -568,8 +570,8 @@ void Context::translatef(float x, float y, float z)
|
|||
|
||||
void Context::translatex(GLfixed x, GLfixed y, GLfixed z)
|
||||
{
|
||||
mState.gles1().multMatrix(
|
||||
angle::Mat4::Translate(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
|
||||
mState.gles1().multMatrix(angle::Mat4::Translate(
|
||||
angle::Vector3(ConvertFixedToFloat(x), ConvertFixedToFloat(y), ConvertFixedToFloat(z))));
|
||||
}
|
||||
|
||||
void Context::vertexPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
|
||||
|
@ -620,15 +622,16 @@ void Context::drawTexsv(const GLshort *coords)
|
|||
|
||||
void Context::drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
|
||||
{
|
||||
mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(x), FixedToFloat(y), FixedToFloat(z),
|
||||
FixedToFloat(width), FixedToFloat(height));
|
||||
mGLES1Renderer->drawTexture(this, &mState, ConvertFixedToFloat(x), ConvertFixedToFloat(y),
|
||||
ConvertFixedToFloat(z), ConvertFixedToFloat(width),
|
||||
ConvertFixedToFloat(height));
|
||||
}
|
||||
|
||||
void Context::drawTexxv(const GLfixed *coords)
|
||||
{
|
||||
mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(coords[0]), FixedToFloat(coords[1]),
|
||||
FixedToFloat(coords[2]), FixedToFloat(coords[3]),
|
||||
FixedToFloat(coords[4]));
|
||||
mGLES1Renderer->drawTexture(this, &mState, ConvertFixedToFloat(coords[0]),
|
||||
ConvertFixedToFloat(coords[1]), ConvertFixedToFloat(coords[2]),
|
||||
ConvertFixedToFloat(coords[3]), ConvertFixedToFloat(coords[4]));
|
||||
}
|
||||
|
||||
// GL_OES_matrix_palette
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
# endif
|
||||
#endif // defined(ANGLE_ENABLE_VULKAN)
|
||||
|
||||
#if defined(ANGLE_ENABLE_METAL)
|
||||
# include "libANGLE/renderer/metal/DisplayMtl.h"
|
||||
#endif // defined(ANGLE_ENABLE_METAL)
|
||||
|
||||
namespace egl
|
||||
{
|
||||
|
||||
|
@ -178,6 +182,14 @@ EGLAttrib GetDisplayTypeFromEnvironment()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_METAL)
|
||||
if (rx::DisplayMtl::IsMetalAvailable())
|
||||
{
|
||||
return EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE;
|
||||
}
|
||||
// else fallthrough to below
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_D3D11)
|
||||
return EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
|
||||
#elif defined(ANGLE_ENABLE_D3D9)
|
||||
|
@ -284,7 +296,17 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const D
|
|||
UNREACHABLE();
|
||||
#endif // defined(ANGLE_ENABLE_VULKAN)
|
||||
break;
|
||||
|
||||
case EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_METAL)
|
||||
if (rx::DisplayMtl::IsMetalAvailable())
|
||||
{
|
||||
impl = new rx::DisplayMtl(state);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// No display available
|
||||
UNREACHABLE();
|
||||
break;
|
||||
case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
|
||||
#if defined(ANGLE_ENABLE_NULL)
|
||||
impl = new rx::DisplayNULL(state);
|
||||
|
@ -1251,6 +1273,10 @@ static ClientExtensions GenerateClientExtensions()
|
|||
extensions.platformANGLEDeviceTypeSwiftShader = true;
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_METAL)
|
||||
extensions.platformANGLEMetal = true;
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_USE_X11)
|
||||
extensions.x11Visual = true;
|
||||
#endif
|
||||
|
|
|
@ -2430,12 +2430,12 @@ void ConvertTextureEnvFromFixed(TextureEnvParameter pname, const GLfixed *input,
|
|||
{
|
||||
case TextureEnvParameter::RgbScale:
|
||||
case TextureEnvParameter::AlphaScale:
|
||||
output[0] = FixedToFloat(input[0]);
|
||||
output[0] = ConvertFixedToFloat(input[0]);
|
||||
break;
|
||||
case TextureEnvParameter::Color:
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
output[i] = FixedToFloat(input[i]);
|
||||
output[i] = ConvertFixedToFloat(input[i]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2482,12 +2482,12 @@ void ConvertTextureEnvToFixed(TextureEnvParameter pname, const GLfloat *input, G
|
|||
{
|
||||
case TextureEnvParameter::RgbScale:
|
||||
case TextureEnvParameter::AlphaScale:
|
||||
output[0] = FloatToFixed(input[0]);
|
||||
output[0] = ConvertFloatToFixed(input[0]);
|
||||
break;
|
||||
case TextureEnvParameter::Color:
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
output[i] = FloatToFixed(input[i]);
|
||||
output[i] = ConvertFloatToFixed(input[i]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# 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.
|
||||
#
|
||||
# This file houses the build configuration for the ANGLE Metal back-end.
|
||||
|
||||
import("../../../../gni/angle.gni")
|
||||
|
||||
assert(angle_enable_metal)
|
||||
|
||||
_metal_backend_sources = [
|
||||
"BufferMtl.h",
|
||||
"BufferMtl.mm",
|
||||
"CompilerMtl.h",
|
||||
"CompilerMtl.mm",
|
||||
"ContextMtl.h",
|
||||
"ContextMtl.mm",
|
||||
"DisplayMtl.h",
|
||||
"DisplayMtl.mm",
|
||||
"FrameBufferMtl.h",
|
||||
"FrameBufferMtl.mm",
|
||||
"ProgramMtl.h",
|
||||
"ProgramMtl.mm",
|
||||
"RenderBufferMtl.h",
|
||||
"RenderBufferMtl.mm",
|
||||
"RendererMtl.h",
|
||||
"RendererMtl.mm",
|
||||
"ShaderMtl.h",
|
||||
"ShaderMtl.mm",
|
||||
"SurfaceMtl.h",
|
||||
"SurfaceMtl.mm",
|
||||
"TextureMtl.h",
|
||||
"TextureMtl.mm",
|
||||
"VertexArrayMtl.h",
|
||||
"VertexArrayMtl.mm",
|
||||
"mtl_common.h",
|
||||
"mtl_common.mm",
|
||||
]
|
||||
|
||||
config("angle_metal_backend_config") {
|
||||
defines = [ "ANGLE_ENABLE_METAL" ]
|
||||
}
|
||||
|
||||
angle_source_set("angle_metal_backend") {
|
||||
public_configs = [ ":angle_metal_backend_config" ]
|
||||
|
||||
sources = _metal_backend_sources
|
||||
|
||||
cflags = []
|
||||
cflags_cc = []
|
||||
cflags_objc = []
|
||||
cflags_objcc = []
|
||||
ldflags = []
|
||||
libs = []
|
||||
|
||||
public_deps = [
|
||||
"${angle_root}:libANGLE_headers",
|
||||
]
|
||||
|
||||
objc_flags = [
|
||||
"-Wno-nullability-completeness",
|
||||
"-Wno-unguarded-availability",
|
||||
"-fno-objc-arc",
|
||||
]
|
||||
cflags_objc += objc_flags
|
||||
cflags_objcc += objc_flags
|
||||
|
||||
libs += [ "Metal.framework" ]
|
||||
|
||||
if (is_mac) {
|
||||
libs += [
|
||||
"Cocoa.framework",
|
||||
"IOSurface.framework",
|
||||
"QuartzCore.framework",
|
||||
]
|
||||
}
|
||||
|
||||
# TODO(hqle): iOS support.
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// BufferMtl.h:
|
||||
// Defines the class interface for BufferMtl, implementing BufferImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_BUFFERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_BUFFERMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libANGLE/Buffer.h"
|
||||
#include "libANGLE/Observer.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
#include "libANGLE/renderer/BufferImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class BufferMtl : public BufferImpl
|
||||
{
|
||||
public:
|
||||
BufferMtl(const gl::BufferState &state);
|
||||
~BufferMtl() override;
|
||||
void destroy(const gl::Context *context) override;
|
||||
|
||||
angle::Result setData(const gl::Context *context,
|
||||
gl::BufferBinding target,
|
||||
const void *data,
|
||||
size_t size,
|
||||
gl::BufferUsage usage) override;
|
||||
angle::Result setSubData(const gl::Context *context,
|
||||
gl::BufferBinding target,
|
||||
const void *data,
|
||||
size_t size,
|
||||
size_t offset) override;
|
||||
angle::Result copySubData(const gl::Context *context,
|
||||
BufferImpl *source,
|
||||
GLintptr sourceOffset,
|
||||
GLintptr destOffset,
|
||||
GLsizeiptr size) override;
|
||||
angle::Result map(const gl::Context *context, GLenum access, void **mapPtr) override;
|
||||
angle::Result mapRange(const gl::Context *context,
|
||||
size_t offset,
|
||||
size_t length,
|
||||
GLbitfield access,
|
||||
void **mapPtr) override;
|
||||
angle::Result unmap(const gl::Context *context, GLboolean *result) override;
|
||||
|
||||
angle::Result getIndexRange(const gl::Context *context,
|
||||
gl::DrawElementsType type,
|
||||
size_t offset,
|
||||
size_t count,
|
||||
bool primitiveRestartEnabled,
|
||||
gl::IndexRange *outRange) override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_BUFFERMTL_H_ */
|
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// BufferMtl.mm:
|
||||
// Implements the class methods for BufferMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/BufferMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// BufferMtl implementation
|
||||
BufferMtl::BufferMtl(const gl::BufferState &state) : BufferImpl(state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
BufferMtl::~BufferMtl() {}
|
||||
|
||||
void BufferMtl::destroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::setData(const gl::Context *context,
|
||||
gl::BufferBinding target,
|
||||
const void *data,
|
||||
size_t size,
|
||||
gl::BufferUsage usage)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::setSubData(const gl::Context *context,
|
||||
gl::BufferBinding target,
|
||||
const void *data,
|
||||
size_t size,
|
||||
size_t offset)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::copySubData(const gl::Context *context,
|
||||
BufferImpl *source,
|
||||
GLintptr sourceOffset,
|
||||
GLintptr destOffset,
|
||||
GLsizeiptr size)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::map(const gl::Context *context, GLenum access, void **mapPtr)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::mapRange(const gl::Context *context,
|
||||
size_t offset,
|
||||
size_t length,
|
||||
GLbitfield access,
|
||||
void **mapPtr)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::unmap(const gl::Context *context, GLboolean *result)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result BufferMtl::getIndexRange(const gl::Context *context,
|
||||
gl::DrawElementsType type,
|
||||
size_t offset,
|
||||
size_t count,
|
||||
bool primitiveRestartEnabled,
|
||||
gl::IndexRange *outRange)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// CompilerMtl.h:
|
||||
// Defines the class interface for CompilerMtl, implementing CompilerImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_COMPILERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_COMPILERMTL_H_
|
||||
|
||||
#include "libANGLE/renderer/CompilerImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class CompilerMtl : public CompilerImpl
|
||||
{
|
||||
public:
|
||||
CompilerMtl();
|
||||
~CompilerMtl() override;
|
||||
|
||||
ShShaderOutput getTranslatorOutputType() const override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_COMPILERMTL_H_ */
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// CompilerMtl.mm:
|
||||
// Implements the class methods for CompilerMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/CompilerMtl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
CompilerMtl::CompilerMtl() : CompilerImpl() {}
|
||||
|
||||
CompilerMtl::~CompilerMtl() {}
|
||||
|
||||
ShShaderOutput CompilerMtl::getTranslatorOutputType() const
|
||||
{
|
||||
return SH_GLSL_METAL_OUTPUT;
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,199 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ContextMtl.h:
|
||||
// Defines the class interface for ContextMtl, implementing ContextImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_CONTEXTMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_CONTEXTMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include "common/Optional.h"
|
||||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/metal/mtl_common.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
class RendererMtl;
|
||||
class FramebufferMtl;
|
||||
class VertexArrayMtl;
|
||||
class ProgramMtl;
|
||||
|
||||
class ContextMtl : public ContextImpl, public mtl::Context
|
||||
{
|
||||
public:
|
||||
ContextMtl(const gl::State &state, gl::ErrorSet *errorSet, RendererMtl *renderer);
|
||||
~ContextMtl() override;
|
||||
|
||||
angle::Result initialize() override;
|
||||
|
||||
void onDestroy(const gl::Context *context) override;
|
||||
|
||||
// Flush and finish.
|
||||
angle::Result flush(const gl::Context *context) override;
|
||||
angle::Result finish(const gl::Context *context) override;
|
||||
|
||||
// Drawing methods.
|
||||
angle::Result drawArrays(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count) override;
|
||||
angle::Result drawArraysInstanced(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count,
|
||||
GLsizei instanceCount) override;
|
||||
angle::Result drawArraysInstancedBaseInstance(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count,
|
||||
GLsizei instanceCount,
|
||||
GLuint baseInstance) override;
|
||||
|
||||
angle::Result drawElements(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices) override;
|
||||
angle::Result drawElementsInstanced(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices,
|
||||
GLsizei instanceCount) override;
|
||||
angle::Result drawElementsInstancedBaseVertexBaseInstance(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices,
|
||||
GLsizei instances,
|
||||
GLint baseVertex,
|
||||
GLuint baseInstance) override;
|
||||
angle::Result drawRangeElements(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLuint start,
|
||||
GLuint end,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices) override;
|
||||
angle::Result drawArraysIndirect(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
const void *indirect) override;
|
||||
angle::Result drawElementsIndirect(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
gl::DrawElementsType type,
|
||||
const void *indirect) override;
|
||||
|
||||
// Device loss
|
||||
gl::GraphicsResetStatus getResetStatus() override;
|
||||
|
||||
// Vendor and description strings.
|
||||
std::string getVendorString() const override;
|
||||
std::string getRendererDescription() const override;
|
||||
|
||||
// EXT_debug_marker
|
||||
void insertEventMarker(GLsizei length, const char *marker) override;
|
||||
void pushGroupMarker(GLsizei length, const char *marker) override;
|
||||
void popGroupMarker() override;
|
||||
|
||||
// KHR_debug
|
||||
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
|
||||
void popDebugGroup() override;
|
||||
|
||||
// State sync with dirty bits.
|
||||
angle::Result syncState(const gl::Context *context,
|
||||
const gl::State::DirtyBits &dirtyBits,
|
||||
const gl::State::DirtyBits &bitMask) override;
|
||||
|
||||
// Disjoint timer queries
|
||||
GLint getGPUDisjoint() override;
|
||||
GLint64 getTimestamp() override;
|
||||
|
||||
// Context switching
|
||||
angle::Result onMakeCurrent(const gl::Context *context) override;
|
||||
angle::Result onUnMakeCurrent(const gl::Context *context) override;
|
||||
|
||||
// Native capabilities, unmodified by gl::Context.
|
||||
gl::Caps getNativeCaps() const override;
|
||||
const gl::TextureCapsMap &getNativeTextureCaps() const override;
|
||||
const gl::Extensions &getNativeExtensions() const override;
|
||||
const gl::Limitations &getNativeLimitations() const override;
|
||||
|
||||
// Shader creation
|
||||
CompilerImpl *createCompiler() override;
|
||||
ShaderImpl *createShader(const gl::ShaderState &state) override;
|
||||
ProgramImpl *createProgram(const gl::ProgramState &state) override;
|
||||
|
||||
// Framebuffer creation
|
||||
FramebufferImpl *createFramebuffer(const gl::FramebufferState &state) override;
|
||||
|
||||
// Texture creation
|
||||
TextureImpl *createTexture(const gl::TextureState &state) override;
|
||||
|
||||
// Renderbuffer creation
|
||||
RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) override;
|
||||
|
||||
// Buffer creation
|
||||
BufferImpl *createBuffer(const gl::BufferState &state) override;
|
||||
|
||||
// Vertex Array creation
|
||||
VertexArrayImpl *createVertexArray(const gl::VertexArrayState &state) override;
|
||||
|
||||
// Query and Fence creation
|
||||
QueryImpl *createQuery(gl::QueryType type) override;
|
||||
FenceNVImpl *createFenceNV() override;
|
||||
SyncImpl *createSync() override;
|
||||
|
||||
// Transform Feedback creation
|
||||
TransformFeedbackImpl *createTransformFeedback(
|
||||
const gl::TransformFeedbackState &state) override;
|
||||
|
||||
// Sampler object creation
|
||||
SamplerImpl *createSampler(const gl::SamplerState &state) override;
|
||||
|
||||
// Program Pipeline object creation
|
||||
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
|
||||
|
||||
// Path object creation
|
||||
std::vector<PathImpl *> createPaths(GLsizei) override;
|
||||
|
||||
// Memory object creation.
|
||||
MemoryObjectImpl *createMemoryObject() override;
|
||||
|
||||
// Semaphore creation.
|
||||
SemaphoreImpl *createSemaphore() override;
|
||||
|
||||
// Overlay creation.
|
||||
OverlayImpl *createOverlay(const gl::OverlayState &state) override;
|
||||
|
||||
angle::Result dispatchCompute(const gl::Context *context,
|
||||
GLuint numGroupsX,
|
||||
GLuint numGroupsY,
|
||||
GLuint numGroupsZ) override;
|
||||
angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) override;
|
||||
|
||||
angle::Result memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
|
||||
angle::Result memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
|
||||
|
||||
// override mtl::ErrorHandler
|
||||
void handleError(GLenum error,
|
||||
const char *file,
|
||||
const char *function,
|
||||
unsigned int line) override;
|
||||
|
||||
using ContextImpl::handleError;
|
||||
|
||||
private:
|
||||
gl::TextureCapsMap mNativeTextureCaps;
|
||||
gl::Extensions mNativeExtensions;
|
||||
gl::Caps mNativeCaps;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_CONTEXTMTL_H_ */
|
|
@ -0,0 +1,367 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ContextMtl.mm:
|
||||
// Implements the class methods for ContextMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "libANGLE/renderer/metal/BufferMtl.h"
|
||||
#include "libANGLE/renderer/metal/CompilerMtl.h"
|
||||
#include "libANGLE/renderer/metal/FrameBufferMtl.h"
|
||||
#include "libANGLE/renderer/metal/ProgramMtl.h"
|
||||
#include "libANGLE/renderer/metal/RenderBufferMtl.h"
|
||||
#include "libANGLE/renderer/metal/RendererMtl.h"
|
||||
#include "libANGLE/renderer/metal/ShaderMtl.h"
|
||||
#include "libANGLE/renderer/metal/TextureMtl.h"
|
||||
#include "libANGLE/renderer/metal/VertexArrayMtl.h"
|
||||
#include "libANGLE/renderer/metal/mtl_common.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
ContextMtl::ContextMtl(const gl::State &state, gl::ErrorSet *errorSet, RendererMtl *renderer)
|
||||
: ContextImpl(state, errorSet), mtl::Context(renderer)
|
||||
{}
|
||||
|
||||
ContextMtl::~ContextMtl() {}
|
||||
|
||||
angle::Result ContextMtl::initialize()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
void ContextMtl::onDestroy(const gl::Context *context) {}
|
||||
|
||||
// Flush and finish.
|
||||
angle::Result ContextMtl::flush(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
angle::Result ContextMtl::finish(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
// Drawing methods.
|
||||
angle::Result ContextMtl::drawArrays(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
angle::Result ContextMtl::drawArraysInstanced(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count,
|
||||
GLsizei instanceCount)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result ContextMtl::drawArraysInstancedBaseInstance(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLint first,
|
||||
GLsizei count,
|
||||
GLsizei instanceCount,
|
||||
GLuint baseInstance)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result ContextMtl::drawElements(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
angle::Result ContextMtl::drawElementsInstanced(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices,
|
||||
GLsizei instanceCount)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::drawElementsInstancedBaseVertexBaseInstance(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices,
|
||||
GLsizei instances,
|
||||
GLint baseVertex,
|
||||
GLuint baseInstance)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::drawRangeElements(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
GLuint start,
|
||||
GLuint end,
|
||||
GLsizei count,
|
||||
gl::DrawElementsType type,
|
||||
const void *indices)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::drawArraysIndirect(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
const void *indirect)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::drawElementsIndirect(const gl::Context *context,
|
||||
gl::PrimitiveMode mode,
|
||||
gl::DrawElementsType type,
|
||||
const void *indirect)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
// Device loss
|
||||
gl::GraphicsResetStatus ContextMtl::getResetStatus()
|
||||
{
|
||||
return gl::GraphicsResetStatus::NoError;
|
||||
}
|
||||
|
||||
// Vendor and description strings.
|
||||
std::string ContextMtl::getVendorString() const
|
||||
{
|
||||
return getRenderer()->getVendorString();
|
||||
}
|
||||
std::string ContextMtl::getRendererDescription() const
|
||||
{
|
||||
return getRenderer()->getRendererDescription();
|
||||
}
|
||||
|
||||
// EXT_debug_marker
|
||||
void ContextMtl::insertEventMarker(GLsizei length, const char *marker) {}
|
||||
void ContextMtl::pushGroupMarker(GLsizei length, const char *marker) {}
|
||||
void ContextMtl::popGroupMarker() {}
|
||||
|
||||
// KHR_debug
|
||||
void ContextMtl::pushDebugGroup(GLenum source, GLuint id, const std::string &message) {}
|
||||
void ContextMtl::popDebugGroup() {}
|
||||
|
||||
// State sync with dirty bits.
|
||||
angle::Result ContextMtl::syncState(const gl::Context *context,
|
||||
const gl::State::DirtyBits &dirtyBits,
|
||||
const gl::State::DirtyBits &bitMask)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
// Disjoint timer queries
|
||||
GLint ContextMtl::getGPUDisjoint()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
GLint64 ContextMtl::getTimestamp()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Context switching
|
||||
angle::Result ContextMtl::onMakeCurrent(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
angle::Result ContextMtl::onUnMakeCurrent(const gl::Context *context)
|
||||
{
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
// Native capabilities, unmodified by gl::Context.
|
||||
gl::Caps ContextMtl::getNativeCaps() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return mNativeCaps;
|
||||
}
|
||||
const gl::TextureCapsMap &ContextMtl::getNativeTextureCaps() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return mNativeTextureCaps;
|
||||
}
|
||||
const gl::Extensions &ContextMtl::getNativeExtensions() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return mNativeExtensions;
|
||||
}
|
||||
const gl::Limitations &ContextMtl::getNativeLimitations() const
|
||||
{
|
||||
return getRenderer()->getNativeLimitations();
|
||||
}
|
||||
|
||||
// Shader creation
|
||||
CompilerImpl *ContextMtl::createCompiler()
|
||||
{
|
||||
return new CompilerMtl();
|
||||
}
|
||||
ShaderImpl *ContextMtl::createShader(const gl::ShaderState &state)
|
||||
{
|
||||
return new ShaderMtl(state);
|
||||
}
|
||||
ProgramImpl *ContextMtl::createProgram(const gl::ProgramState &state)
|
||||
{
|
||||
return new ProgramMtl(state);
|
||||
}
|
||||
|
||||
// Framebuffer creation
|
||||
FramebufferImpl *ContextMtl::createFramebuffer(const gl::FramebufferState &state)
|
||||
{
|
||||
return new FramebufferMtl(state);
|
||||
}
|
||||
|
||||
// Texture creation
|
||||
TextureImpl *ContextMtl::createTexture(const gl::TextureState &state)
|
||||
{
|
||||
return new TextureMtl(state);
|
||||
}
|
||||
|
||||
// Renderbuffer creation
|
||||
RenderbufferImpl *ContextMtl::createRenderbuffer(const gl::RenderbufferState &state)
|
||||
{
|
||||
return new RenderbufferMtl(state);
|
||||
}
|
||||
|
||||
// Buffer creation
|
||||
BufferImpl *ContextMtl::createBuffer(const gl::BufferState &state)
|
||||
{
|
||||
return new BufferMtl(state);
|
||||
}
|
||||
|
||||
// Vertex Array creation
|
||||
VertexArrayImpl *ContextMtl::createVertexArray(const gl::VertexArrayState &state)
|
||||
{
|
||||
return new VertexArrayMtl(state);
|
||||
}
|
||||
|
||||
// Query and Fence creation
|
||||
QueryImpl *ContextMtl::createQuery(gl::QueryType type)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
FenceNVImpl *ContextMtl::createFenceNV()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
SyncImpl *ContextMtl::createSync()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Transform Feedback creation
|
||||
TransformFeedbackImpl *ContextMtl::createTransformFeedback(const gl::TransformFeedbackState &state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Sampler object creation
|
||||
SamplerImpl *ContextMtl::createSampler(const gl::SamplerState &state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Program Pipeline object creation
|
||||
ProgramPipelineImpl *ContextMtl::createProgramPipeline(const gl::ProgramPipelineState &data)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Path object creation
|
||||
std::vector<PathImpl *> ContextMtl::createPaths(GLsizei)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return std::vector<PathImpl *>();
|
||||
}
|
||||
|
||||
// Memory object creation.
|
||||
MemoryObjectImpl *ContextMtl::createMemoryObject()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Semaphore creation.
|
||||
SemaphoreImpl *ContextMtl::createSemaphore()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OverlayImpl *ContextMtl::createOverlay(const gl::OverlayState &state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
angle::Result ContextMtl::dispatchCompute(const gl::Context *context,
|
||||
GLuint numGroupsX,
|
||||
GLuint numGroupsY,
|
||||
GLuint numGroupsZ)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result ContextMtl::memoryBarrier(const gl::Context *context, GLbitfield barriers)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result ContextMtl::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
// override mtl::ErrorHandler
|
||||
void ContextMtl::handleError(GLenum glErrorCode,
|
||||
const char *file,
|
||||
const char *function,
|
||||
unsigned int line)
|
||||
{
|
||||
std::stringstream errorStream;
|
||||
errorStream << "Metal backend encountered an error. Code=" << glErrorCode << ".";
|
||||
|
||||
mErrors->handleError(glErrorCode, errorStream.str().c_str(), file, function, line);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// DisplayMtl.h:
|
||||
// Defines the class interface for DisplayMtl, implementing DisplayImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_DISPLAYMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_DISPLAYMTL_H_
|
||||
|
||||
#include "libANGLE/renderer/DisplayImpl.h"
|
||||
|
||||
namespace egl
|
||||
{
|
||||
class Surface;
|
||||
}
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class RendererMtl;
|
||||
|
||||
class DisplayMtl : public DisplayImpl
|
||||
{
|
||||
public:
|
||||
// Check whether minimum required Metal version is available on the host platform.
|
||||
static bool IsMetalAvailable();
|
||||
|
||||
DisplayMtl(const egl::DisplayState &state);
|
||||
~DisplayMtl() override;
|
||||
|
||||
egl::Error initialize(egl::Display *display) override;
|
||||
void terminate() override;
|
||||
|
||||
bool testDeviceLost() override;
|
||||
egl::Error restoreLostDevice(const egl::Display *display) override;
|
||||
|
||||
std::string getVendorString() const override;
|
||||
|
||||
DeviceImpl *createDevice() override;
|
||||
|
||||
egl::Error waitClient(const gl::Context *context) override;
|
||||
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
|
||||
|
||||
SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
|
||||
EGLenum buftype,
|
||||
EGLClientBuffer clientBuffer,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
|
||||
NativePixmapType nativePixmap,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
|
||||
ImageImpl *createImage(const egl::ImageState &state,
|
||||
const gl::Context *context,
|
||||
EGLenum target,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
|
||||
ContextImpl *createContext(const gl::State &state,
|
||||
gl::ErrorSet *errorSet,
|
||||
const egl::Config *configuration,
|
||||
const gl::Context *shareContext,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
|
||||
StreamProducerImpl *createStreamProducerD3DTexture(egl::Stream::ConsumerType consumerType,
|
||||
const egl::AttributeMap &attribs) override;
|
||||
|
||||
gl::Version getMaxSupportedESVersion() const override;
|
||||
gl::Version getMaxConformantESVersion() const override;
|
||||
|
||||
EGLSyncImpl *createSync(const egl::AttributeMap &attribs) override;
|
||||
|
||||
egl::Error makeCurrent(egl::Surface *drawSurface,
|
||||
egl::Surface *readSurface,
|
||||
gl::Context *context) override;
|
||||
|
||||
void populateFeatureList(angle::FeatureList *features) override;
|
||||
|
||||
bool isValidNativeWindow(EGLNativeWindowType window) const override;
|
||||
|
||||
egl::ConfigSet generateConfigs() override;
|
||||
|
||||
RendererMtl *getRenderer() { return mRenderer.get(); }
|
||||
|
||||
protected:
|
||||
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
|
||||
void generateCaps(egl::Caps *outCaps) const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<RendererMtl> mRenderer;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_DISPLAYMTL_H_ */
|
|
@ -0,0 +1,198 @@
|
|||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
|
||||
// DisplayMtl.mm: Metal implementation of DisplayImpl
|
||||
|
||||
#include "libANGLE/renderer/metal/DisplayMtl.h"
|
||||
|
||||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/Display.h"
|
||||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
#include "libANGLE/renderer/metal/RendererMtl.h"
|
||||
#include "libANGLE/renderer/metal/SurfaceMtl.h"
|
||||
|
||||
#include "EGL/eglext.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
bool DisplayMtl::IsMetalAvailable()
|
||||
{
|
||||
// We only support macos 10.13+ and iOS 11 for now. Since they are requirements for Metal 2.0.
|
||||
if (@available(macOS 10.13, iOS 11, *))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DisplayMtl::DisplayMtl(const egl::DisplayState &state)
|
||||
: DisplayImpl(state), mRenderer(new RendererMtl())
|
||||
{}
|
||||
|
||||
DisplayMtl::~DisplayMtl() {}
|
||||
|
||||
egl::Error DisplayMtl::initialize(egl::Display *display)
|
||||
{
|
||||
ASSERT(IsMetalAvailable());
|
||||
|
||||
angle::Result result = mRenderer->initialize(display);
|
||||
if (result != angle::Result::Continue)
|
||||
{
|
||||
return egl::EglNotInitialized();
|
||||
}
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
void DisplayMtl::terminate()
|
||||
{
|
||||
mRenderer->onDestroy();
|
||||
}
|
||||
|
||||
bool DisplayMtl::testDeviceLost()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
egl::Error DisplayMtl::restoreLostDevice(const egl::Display *display)
|
||||
{
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
std::string DisplayMtl::getVendorString() const
|
||||
{
|
||||
return mRenderer->getVendorString();
|
||||
}
|
||||
|
||||
DeviceImpl *DisplayMtl::createDevice()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
egl::Error DisplayMtl::waitClient(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
egl::Error DisplayMtl::waitNative(const gl::Context *context, EGLint engine)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
SurfaceImpl *DisplayMtl::createWindowSurface(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
|
||||
EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
|
||||
|
||||
return new SurfaceMtl(state, window, width, height);
|
||||
}
|
||||
|
||||
SurfaceImpl *DisplayMtl::createPbufferSurface(const egl::SurfaceState &state,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return static_cast<SurfaceImpl *>(0);
|
||||
}
|
||||
|
||||
SurfaceImpl *DisplayMtl::createPbufferFromClientBuffer(const egl::SurfaceState &state,
|
||||
EGLenum buftype,
|
||||
EGLClientBuffer clientBuffer,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return static_cast<SurfaceImpl *>(0);
|
||||
}
|
||||
|
||||
SurfaceImpl *DisplayMtl::createPixmapSurface(const egl::SurfaceState &state,
|
||||
NativePixmapType nativePixmap,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return static_cast<SurfaceImpl *>(0);
|
||||
}
|
||||
|
||||
ImageImpl *DisplayMtl::createImage(const egl::ImageState &state,
|
||||
const gl::Context *context,
|
||||
EGLenum target,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rx::ContextImpl *DisplayMtl::createContext(const gl::State &state,
|
||||
gl::ErrorSet *errorSet,
|
||||
const egl::Config *configuration,
|
||||
const gl::Context *shareContext,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
return new ContextMtl(state, errorSet, mRenderer.get());
|
||||
}
|
||||
|
||||
StreamProducerImpl *DisplayMtl::createStreamProducerD3DTexture(
|
||||
egl::Stream::ConsumerType consumerType,
|
||||
const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gl::Version DisplayMtl::getMaxSupportedESVersion() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return gl::Version(1, 0);
|
||||
}
|
||||
|
||||
gl::Version DisplayMtl::getMaxConformantESVersion() const
|
||||
{
|
||||
return std::min(getMaxSupportedESVersion(), gl::Version(2, 0));
|
||||
}
|
||||
|
||||
EGLSyncImpl *DisplayMtl::createSync(const egl::AttributeMap &attribs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
egl::Error DisplayMtl::makeCurrent(egl::Surface *drawSurface,
|
||||
egl::Surface *readSurface,
|
||||
gl::Context *context)
|
||||
{
|
||||
if (!context)
|
||||
{
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
void DisplayMtl::generateExtensions(egl::DisplayExtensions *outExtensions) const {}
|
||||
|
||||
void DisplayMtl::generateCaps(egl::Caps *outCaps) const {}
|
||||
|
||||
void DisplayMtl::populateFeatureList(angle::FeatureList *features) {}
|
||||
|
||||
egl::ConfigSet DisplayMtl::generateConfigs()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
egl::ConfigSet configs;
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
bool DisplayMtl::isValidNativeWindow(EGLNativeWindowType window) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,82 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// FrameBufferMtl.h:
|
||||
// Defines the class interface for FrameBufferMtl, implementing FrameBufferImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_FRAMEBUFFERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_FRAMEBUFFERMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include "libANGLE/renderer/FramebufferImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class FramebufferMtl : public FramebufferImpl
|
||||
{
|
||||
public:
|
||||
explicit FramebufferMtl(const gl::FramebufferState &state);
|
||||
~FramebufferMtl() override;
|
||||
void destroy(const gl::Context *context) override;
|
||||
|
||||
angle::Result discard(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments) override;
|
||||
angle::Result invalidate(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments) override;
|
||||
angle::Result invalidateSub(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments,
|
||||
const gl::Rectangle &area) override;
|
||||
|
||||
angle::Result clear(const gl::Context *context, GLbitfield mask) override;
|
||||
angle::Result clearBufferfv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values) override;
|
||||
angle::Result clearBufferuiv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values) override;
|
||||
angle::Result clearBufferiv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values) override;
|
||||
angle::Result clearBufferfi(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
GLint stencil) override;
|
||||
|
||||
GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
|
||||
GLenum getImplementationColorReadType(const gl::Context *context) const override;
|
||||
angle::Result readPixels(const gl::Context *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
void *pixels) override;
|
||||
|
||||
angle::Result blit(const gl::Context *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter) override;
|
||||
|
||||
bool checkStatus(const gl::Context *context) const override;
|
||||
|
||||
angle::Result syncState(const gl::Context *context,
|
||||
const gl::Framebuffer::DirtyBits &dirtyBits) override;
|
||||
|
||||
angle::Result getSamplePosition(const gl::Context *context,
|
||||
size_t index,
|
||||
GLfloat *xy) const override;
|
||||
};
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_FRAMEBUFFERMTL_H */
|
|
@ -0,0 +1,148 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// FramebufferMtl.mm:
|
||||
// Implements the class methods for FramebufferMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "common/debug.h"
|
||||
#include "libANGLE/renderer/metal/FrameBufferMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// FramebufferMtl implementation
|
||||
FramebufferMtl::FramebufferMtl(const gl::FramebufferState &state) : FramebufferImpl(state) {}
|
||||
|
||||
FramebufferMtl::~FramebufferMtl() {}
|
||||
|
||||
void FramebufferMtl::destroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::discard(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::invalidate(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::invalidateSub(const gl::Context *context,
|
||||
size_t count,
|
||||
const GLenum *attachments,
|
||||
const gl::Rectangle &area)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::clear(const gl::Context *context, GLbitfield mask)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::clearBufferfv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result FramebufferMtl::clearBufferuiv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result FramebufferMtl::clearBufferiv(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
angle::Result FramebufferMtl::clearBufferfi(const gl::Context *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
GLint stencil)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
GLenum FramebufferMtl::getImplementationColorReadFormat(const gl::Context *context) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
GLenum FramebufferMtl::getImplementationColorReadType(const gl::Context *context) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::readPixels(const gl::Context *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
void *pixels)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::blit(const gl::Context *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
bool FramebufferMtl::checkStatus(const gl::Context *context) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::syncState(const gl::Context *context,
|
||||
const gl::Framebuffer::DirtyBits &dirtyBits)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result FramebufferMtl::getSamplePosition(const gl::Context *context,
|
||||
size_t index,
|
||||
GLfloat *xy) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ProgramMtl.h:
|
||||
// Defines the class interface for ProgramMtl, implementing ProgramImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_PROGRAMMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_PROGRAMMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include "libANGLE/renderer/ProgramImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class ProgramMtl : public ProgramImpl
|
||||
{
|
||||
public:
|
||||
ProgramMtl(const gl::ProgramState &state);
|
||||
~ProgramMtl() override;
|
||||
|
||||
void destroy(const gl::Context *context) override;
|
||||
|
||||
std::unique_ptr<LinkEvent> load(const gl::Context *context,
|
||||
gl::BinaryInputStream *stream,
|
||||
gl::InfoLog &infoLog) override;
|
||||
void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
|
||||
void setBinaryRetrievableHint(bool retrievable) override;
|
||||
void setSeparable(bool separable) override;
|
||||
|
||||
std::unique_ptr<LinkEvent> link(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog) override;
|
||||
GLboolean validate(const gl::Caps &caps, gl::InfoLog *infoLog) override;
|
||||
|
||||
void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) override;
|
||||
void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) override;
|
||||
void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) override;
|
||||
void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) override;
|
||||
void setUniform1iv(GLint location, GLsizei count, const GLint *v) override;
|
||||
void setUniform2iv(GLint location, GLsizei count, const GLint *v) override;
|
||||
void setUniform3iv(GLint location, GLsizei count, const GLint *v) override;
|
||||
void setUniform4iv(GLint location, GLsizei count, const GLint *v) override;
|
||||
void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) override;
|
||||
void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) override;
|
||||
void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) override;
|
||||
void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) override;
|
||||
void setUniformMatrix2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix2x3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix3x2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix2x4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix4x2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix3x4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
void setUniformMatrix4x3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value) override;
|
||||
|
||||
void getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const override;
|
||||
void getUniformiv(const gl::Context *context, GLint location, GLint *params) const override;
|
||||
void getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const override;
|
||||
|
||||
void setPathFragmentInputGen(const std::string &inputName,
|
||||
GLenum genMode,
|
||||
GLint components,
|
||||
const GLfloat *coeffs) override;
|
||||
|
||||
private:
|
||||
template <int cols, int rows>
|
||||
void setUniformMatrixfv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
template <class T>
|
||||
void getUniformImpl(GLint location, T *v, GLenum entryPointType) const;
|
||||
|
||||
template <typename T>
|
||||
void setUniformImpl(GLint location, GLsizei count, const T *v, GLenum entryPointType);
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_PROGRAMMTL_H_ */
|
|
@ -0,0 +1,244 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ProgramMtl.mm:
|
||||
// Implements the class methods for ProgramMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/ProgramMtl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/ProgramLinkedResources.h"
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// ProgramMtl implementation
|
||||
|
||||
ProgramMtl::ProgramMtl(const gl::ProgramState &state) : ProgramImpl(state) {}
|
||||
|
||||
ProgramMtl::~ProgramMtl() {}
|
||||
|
||||
void ProgramMtl::destroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::unique_ptr<rx::LinkEvent> ProgramMtl::load(const gl::Context *context,
|
||||
gl::BinaryInputStream *stream,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return std::make_unique<LinkEventDone>(angle::Result::Stop);
|
||||
}
|
||||
|
||||
void ProgramMtl::save(const gl::Context *context, gl::BinaryOutputStream *stream)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ProgramMtl::setBinaryRetrievableHint(bool retrievable)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ProgramMtl::setSeparable(bool separable)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::unique_ptr<LinkEvent> ProgramMtl::link(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GLboolean ProgramMtl::validate(const gl::Caps &caps, gl::InfoLog *infoLog)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ProgramMtl::setUniformImpl(GLint location, GLsizei count, const T *v, GLenum entryPointType)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ProgramMtl::getUniformImpl(GLint location, T *v, GLenum entryPointType) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_FLOAT);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_FLOAT_VEC2);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_FLOAT_VEC3);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_FLOAT_VEC4);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform1iv(GLint startLocation, GLsizei count, const GLint *v)
|
||||
{
|
||||
setUniformImpl(startLocation, count, v, GL_INT);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform2iv(GLint location, GLsizei count, const GLint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_INT_VEC2);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform3iv(GLint location, GLsizei count, const GLint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_INT_VEC3);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform4iv(GLint location, GLsizei count, const GLint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_INT_VEC4);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_UNSIGNED_INT);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_UNSIGNED_INT_VEC2);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_UNSIGNED_INT_VEC3);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
|
||||
{
|
||||
setUniformImpl(location, count, v, GL_UNSIGNED_INT_VEC4);
|
||||
}
|
||||
|
||||
template <int cols, int rows>
|
||||
void ProgramMtl::setUniformMatrixfv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<2, 2>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<3, 3>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<4, 4>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix2x3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<2, 3>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix3x2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<3, 2>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix2x4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<2, 4>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix4x2fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<4, 2>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix3x4fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<3, 4>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setUniformMatrix4x3fv(GLint location,
|
||||
GLsizei count,
|
||||
GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
setUniformMatrixfv<4, 3>(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void ProgramMtl::setPathFragmentInputGen(const std::string &inputName,
|
||||
GLenum genMode,
|
||||
GLint components,
|
||||
const GLfloat *coeffs)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ProgramMtl::getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const
|
||||
{
|
||||
getUniformImpl(location, params, GL_FLOAT);
|
||||
}
|
||||
|
||||
void ProgramMtl::getUniformiv(const gl::Context *context, GLint location, GLint *params) const
|
||||
{
|
||||
getUniformImpl(location, params, GL_INT);
|
||||
}
|
||||
|
||||
void ProgramMtl::getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const
|
||||
{
|
||||
getUniformImpl(location, params, GL_UNSIGNED_INT);
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// RenderBufferMtl.h:
|
||||
// Defines the class interface for RenderBufferMtl, implementing RenderBufferImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_
|
||||
|
||||
#include "libANGLE/renderer/RenderbufferImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class RenderbufferMtl : public RenderbufferImpl
|
||||
{
|
||||
public:
|
||||
RenderbufferMtl(const gl::RenderbufferState &state);
|
||||
~RenderbufferMtl() override;
|
||||
|
||||
void onDestroy(const gl::Context *context) override;
|
||||
|
||||
angle::Result setStorage(const gl::Context *context,
|
||||
GLenum internalformat,
|
||||
size_t width,
|
||||
size_t height) override;
|
||||
angle::Result setStorageMultisample(const gl::Context *context,
|
||||
size_t samples,
|
||||
GLenum internalformat,
|
||||
size_t width,
|
||||
size_t height) override;
|
||||
angle::Result setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) override;
|
||||
|
||||
angle::Result getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut) override;
|
||||
|
||||
angle::Result initializeContents(const gl::Context *context,
|
||||
const gl::ImageIndex &imageIndex) override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_ */
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// RenderBufferMtl.mm:
|
||||
// Implements the class methods for RenderBufferMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/RenderBufferMtl.h"
|
||||
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
RenderbufferMtl::RenderbufferMtl(const gl::RenderbufferState &state) : RenderbufferImpl(state) {}
|
||||
|
||||
RenderbufferMtl::~RenderbufferMtl() {}
|
||||
|
||||
void RenderbufferMtl::onDestroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
angle::Result RenderbufferMtl::setStorage(const gl::Context *context,
|
||||
GLenum internalformat,
|
||||
size_t width,
|
||||
size_t height)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result RenderbufferMtl::setStorageMultisample(const gl::Context *context,
|
||||
size_t samples,
|
||||
GLenum internalformat,
|
||||
size_t width,
|
||||
size_t height)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result RenderbufferMtl::setStorageEGLImageTarget(const gl::Context *context,
|
||||
egl::Image *image)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result RenderbufferMtl::getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result RenderbufferMtl::initializeContents(const gl::Context *context,
|
||||
const gl::ImageIndex &imageIndex)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// RendererMtl.h:
|
||||
// Defines class interface for RendererMtl.
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_RENDERERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_RENDERERMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include "common/PackedEnums.h"
|
||||
#include "libANGLE/Caps.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
|
||||
namespace egl
|
||||
{
|
||||
class Display;
|
||||
}
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class ContextMtl;
|
||||
|
||||
class RendererMtl final : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
RendererMtl();
|
||||
~RendererMtl();
|
||||
|
||||
angle::Result initialize(egl::Display *display);
|
||||
void onDestroy();
|
||||
|
||||
std::string getVendorString() const;
|
||||
std::string getRendererDescription() const;
|
||||
const gl::Limitations &getNativeLimitations() const;
|
||||
|
||||
id<MTLDevice> getMetalDevice() const { return nil; }
|
||||
|
||||
private:
|
||||
gl::Limitations mNativeLimitations;
|
||||
};
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_RENDERERMTL_H_ */
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// RendererMtl.mm:
|
||||
// Implements the class methods for RendererMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/RendererMtl.h"
|
||||
|
||||
#include "libANGLE/renderer/metal/mtl_common.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
RendererMtl::RendererMtl() {}
|
||||
|
||||
RendererMtl::~RendererMtl() {}
|
||||
|
||||
angle::Result RendererMtl::initialize(egl::Display *display)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
void RendererMtl::onDestroy()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::string RendererMtl::getVendorString() const
|
||||
{
|
||||
std::string vendorString = "Google Inc.";
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return vendorString;
|
||||
}
|
||||
|
||||
std::string RendererMtl::getRendererDescription() const
|
||||
{
|
||||
std::string desc = "Metal Renderer";
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
const gl::Limitations &RendererMtl::getNativeLimitations() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return mNativeLimitations;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ShaderMtl.h:
|
||||
// Defines the class interface for ShaderMtl, implementing ShaderImpl.
|
||||
//
|
||||
#ifndef LIBANGLE_RENDERER_METAL_SHADERMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_SHADERMTL_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "libANGLE/renderer/ShaderImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class ShaderMtl : public ShaderImpl
|
||||
{
|
||||
public:
|
||||
ShaderMtl(const gl::ShaderState &data);
|
||||
~ShaderMtl() override;
|
||||
|
||||
std::shared_ptr<WaitableCompileEvent> compile(const gl::Context *context,
|
||||
gl::ShCompilerInstance *compilerInstance,
|
||||
ShCompileOptions options) override;
|
||||
|
||||
std::string getDebugInfo() const override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_SHADERMTL_H_ */
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// ShaderMtl.mm:
|
||||
// Implements the class methods for ShaderMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/ShaderMtl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/renderer/metal/ContextMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
ShaderMtl::ShaderMtl(const gl::ShaderState &data) : ShaderImpl(data) {}
|
||||
|
||||
ShaderMtl::~ShaderMtl() {}
|
||||
|
||||
std::shared_ptr<WaitableCompileEvent> ShaderMtl::compile(const gl::Context *context,
|
||||
gl::ShCompilerInstance *compilerInstance,
|
||||
ShCompileOptions options)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return compileImpl(context, compilerInstance, mData.getSource(), options);
|
||||
}
|
||||
|
||||
std::string ShaderMtl::getDebugInfo() const
|
||||
{
|
||||
return mData.getTranslatedSource();
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,69 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// SurfaceMtl.h: Defines the class interface for Metal Surface.
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_SURFACEMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_SURFACEMTL_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
#import <QuartzCore/CALayer.h>
|
||||
|
||||
#include "libANGLE/renderer/SurfaceImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class SurfaceMtl : public SurfaceImpl
|
||||
{
|
||||
public:
|
||||
SurfaceMtl(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window,
|
||||
EGLint width,
|
||||
EGLint height);
|
||||
~SurfaceMtl() override;
|
||||
|
||||
void destroy(const egl::Display *display) override;
|
||||
|
||||
egl::Error initialize(const egl::Display *display) override;
|
||||
FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
|
||||
const gl::FramebufferState &state) override;
|
||||
|
||||
egl::Error makeCurrent(const gl::Context *context) override;
|
||||
egl::Error unMakeCurrent(const gl::Context *context) override;
|
||||
egl::Error swap(const gl::Context *context) override;
|
||||
egl::Error postSubBuffer(const gl::Context *context,
|
||||
EGLint x,
|
||||
EGLint y,
|
||||
EGLint width,
|
||||
EGLint height) override;
|
||||
|
||||
egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
|
||||
egl::Error bindTexImage(const gl::Context *context,
|
||||
gl::Texture *texture,
|
||||
EGLint buffer) override;
|
||||
egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
|
||||
egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
|
||||
void setSwapInterval(EGLint interval) override;
|
||||
void setFixedWidth(EGLint width) override;
|
||||
void setFixedHeight(EGLint height) override;
|
||||
|
||||
// width and height can change with client window resizing
|
||||
EGLint getWidth() const override;
|
||||
EGLint getHeight() const override;
|
||||
|
||||
EGLint isPostSubBufferSupported() const override;
|
||||
EGLint getSwapBehavior() const override;
|
||||
|
||||
angle::Result getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut) override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_SURFACEMTL_H_ */
|
|
@ -0,0 +1,144 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// SurfaceMtl.mm:
|
||||
// Implements the class methods for SurfaceMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/SurfaceMtl.h"
|
||||
|
||||
#include "libANGLE/renderer/metal/FrameBufferMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
SurfaceMtl::SurfaceMtl(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window,
|
||||
EGLint width,
|
||||
EGLint height)
|
||||
: SurfaceImpl(state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
SurfaceMtl::~SurfaceMtl() {}
|
||||
|
||||
void SurfaceMtl::destroy(const egl::Display *display)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::initialize(const egl::Display *display)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
FramebufferImpl *SurfaceMtl::createDefaultFramebuffer(const gl::Context *context,
|
||||
const gl::FramebufferState &state)
|
||||
{
|
||||
auto fbo = new FramebufferMtl(state);
|
||||
|
||||
return fbo;
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::makeCurrent(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::unMakeCurrent(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::swap(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::NoError();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::postSubBuffer(const gl::Context *context,
|
||||
EGLint x,
|
||||
EGLint y,
|
||||
EGLint width,
|
||||
EGLint height)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::querySurfacePointerANGLE(EGLint attribute, void **value)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::bindTexImage(const gl::Context *context, gl::Texture *texture, EGLint buffer)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::releaseTexImage(const gl::Context *context, EGLint buffer)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
egl::Error SurfaceMtl::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return egl::EglBadAccess();
|
||||
}
|
||||
|
||||
void SurfaceMtl::setSwapInterval(EGLint interval) {}
|
||||
|
||||
void SurfaceMtl::setFixedWidth(EGLint width)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void SurfaceMtl::setFixedHeight(EGLint height)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
// width and height can change with client window resizing
|
||||
EGLint SurfaceMtl::getWidth() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
EGLint SurfaceMtl::getHeight() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
EGLint SurfaceMtl::isPostSubBufferSupported() const
|
||||
{
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
EGLint SurfaceMtl::getSwapBehavior() const
|
||||
{
|
||||
return EGL_BUFFER_DESTROYED;
|
||||
}
|
||||
|
||||
angle::Result SurfaceMtl::getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// TextureMtl.h:
|
||||
// Defines the class interface for TextureMtl, implementing TextureImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_TEXTUREMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_TEXTUREMTL_H_
|
||||
|
||||
#include "common/PackedEnums.h"
|
||||
#include "libANGLE/renderer/TextureImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class TextureMtl : public TextureImpl
|
||||
{
|
||||
public:
|
||||
TextureMtl(const gl::TextureState &state);
|
||||
~TextureMtl() override;
|
||||
void onDestroy(const gl::Context *context) override;
|
||||
|
||||
angle::Result setImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
const uint8_t *pixels) override;
|
||||
angle::Result setSubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Box &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
gl::Buffer *unpackBuffer,
|
||||
const uint8_t *pixels) override;
|
||||
|
||||
angle::Result setCompressedImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
size_t imageSize,
|
||||
const uint8_t *pixels) override;
|
||||
angle::Result setCompressedSubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Box &area,
|
||||
GLenum format,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
size_t imageSize,
|
||||
const uint8_t *pixels) override;
|
||||
|
||||
angle::Result copyImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Rectangle &sourceArea,
|
||||
GLenum internalFormat,
|
||||
gl::Framebuffer *source) override;
|
||||
angle::Result copySubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
const gl::Rectangle &sourceArea,
|
||||
gl::Framebuffer *source) override;
|
||||
|
||||
angle::Result copyTexture(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
GLenum type,
|
||||
size_t sourceLevel,
|
||||
bool unpackFlipY,
|
||||
bool unpackPremultiplyAlpha,
|
||||
bool unpackUnmultiplyAlpha,
|
||||
const gl::Texture *source) override;
|
||||
angle::Result copySubTexture(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
size_t sourceLevel,
|
||||
const gl::Box &sourceBox,
|
||||
bool unpackFlipY,
|
||||
bool unpackPremultiplyAlpha,
|
||||
bool unpackUnmultiplyAlpha,
|
||||
const gl::Texture *source) override;
|
||||
|
||||
angle::Result copyCompressedTexture(const gl::Context *context,
|
||||
const gl::Texture *source) override;
|
||||
|
||||
angle::Result setStorage(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
size_t levels,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size) override;
|
||||
|
||||
angle::Result setStorageExternalMemory(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
size_t levels,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
gl::MemoryObject *memoryObject,
|
||||
GLuint64 offset) override;
|
||||
|
||||
angle::Result setEGLImageTarget(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
egl::Image *image) override;
|
||||
|
||||
angle::Result setImageExternal(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
egl::Stream *stream,
|
||||
const egl::Stream::GLTextureDescription &desc) override;
|
||||
|
||||
angle::Result generateMipmap(const gl::Context *context) override;
|
||||
|
||||
angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
|
||||
|
||||
angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
|
||||
angle::Result releaseTexImage(const gl::Context *context) override;
|
||||
|
||||
angle::Result getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut) override;
|
||||
|
||||
angle::Result syncState(const gl::Context *context,
|
||||
const gl::Texture::DirtyBits &dirtyBits) override;
|
||||
|
||||
angle::Result setStorageMultisample(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
GLsizei samples,
|
||||
GLint internalformat,
|
||||
const gl::Extents &size,
|
||||
bool fixedSampleLocations) override;
|
||||
|
||||
angle::Result initializeContents(const gl::Context *context,
|
||||
const gl::ImageIndex &imageIndex) override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_TEXTUREMTL_H_ */
|
|
@ -0,0 +1,239 @@
|
|||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// TextureMtl.mm:
|
||||
// Implements the class methods for TextureMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/TextureMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// TextureMtl implementation
|
||||
TextureMtl::TextureMtl(const gl::TextureState &state) : TextureImpl(state) {}
|
||||
|
||||
TextureMtl::~TextureMtl() = default;
|
||||
|
||||
void TextureMtl::onDestroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
const uint8_t *pixels)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setSubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Box &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
gl::Buffer *unpackBuffer,
|
||||
const uint8_t *pixels)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setCompressedImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
size_t imageSize,
|
||||
const uint8_t *pixels)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setCompressedSubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Box &area,
|
||||
GLenum format,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
size_t imageSize,
|
||||
const uint8_t *pixels)
|
||||
{
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::copyImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Rectangle &sourceArea,
|
||||
GLenum internalFormat,
|
||||
gl::Framebuffer *source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::copySubImage(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
const gl::Rectangle &sourceArea,
|
||||
gl::Framebuffer *source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::copyTexture(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
GLenum internalFormat,
|
||||
GLenum type,
|
||||
size_t sourceLevel,
|
||||
bool unpackFlipY,
|
||||
bool unpackPremultiplyAlpha,
|
||||
bool unpackUnmultiplyAlpha,
|
||||
const gl::Texture *source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::copySubTexture(const gl::Context *context,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
size_t sourceLevel,
|
||||
const gl::Box &sourceBox,
|
||||
bool unpackFlipY,
|
||||
bool unpackPremultiplyAlpha,
|
||||
bool unpackUnmultiplyAlpha,
|
||||
const gl::Texture *source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::copyCompressedTexture(const gl::Context *context,
|
||||
const gl::Texture *source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setStorage(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
size_t mipmaps,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setStorageExternalMemory(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
size_t levels,
|
||||
GLenum internalFormat,
|
||||
const gl::Extents &size,
|
||||
gl::MemoryObject *memoryObject,
|
||||
GLuint64 offset)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setStorageMultisample(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
GLsizei samples,
|
||||
GLint internalformat,
|
||||
const gl::Extents &size,
|
||||
bool fixedSampleLocations)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setEGLImageTarget(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
egl::Image *image)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setImageExternal(const gl::Context *context,
|
||||
gl::TextureType type,
|
||||
egl::Stream *stream,
|
||||
const egl::Stream::GLTextureDescription &desc)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::generateMipmap(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::setBaseLevel(const gl::Context *context, GLuint baseLevel)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::bindTexImage(const gl::Context *context, egl::Surface *surface)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::releaseTexImage(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::getAttachmentRenderTarget(const gl::Context *context,
|
||||
GLenum binding,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
GLsizei samples,
|
||||
FramebufferAttachmentRenderTarget **rtOut)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Stop;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::syncState(const gl::Context *context,
|
||||
const gl::Texture::DirtyBits &dirtyBits)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
angle::Result TextureMtl::initializeContents(const gl::Context *context,
|
||||
const gl::ImageIndex &imageIndex)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// VertexArrayMtl.h:
|
||||
// Defines the class interface for VertexArrayMtl, implementing VertexArrayImpl.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_VERTEXARRAYMTL_H_
|
||||
#define LIBANGLE_RENDERER_METAL_VERTEXARRAYMTL_H_
|
||||
|
||||
#include "libANGLE/renderer/VertexArrayImpl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
class ContextMtl;
|
||||
|
||||
class VertexArrayMtl : public VertexArrayImpl
|
||||
{
|
||||
public:
|
||||
VertexArrayMtl(const gl::VertexArrayState &state);
|
||||
~VertexArrayMtl() override;
|
||||
|
||||
void destroy(const gl::Context *context) override;
|
||||
|
||||
angle::Result syncState(const gl::Context *context,
|
||||
const gl::VertexArray::DirtyBits &dirtyBits,
|
||||
gl::VertexArray::DirtyAttribBitsArray *attribBits,
|
||||
gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
|
||||
};
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_VERTEXARRAYMTL_H_ */
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// VertexArrayMtl.mm:
|
||||
// Implements the class methods for VertexArrayMtl.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/VertexArrayMtl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// VertexArrayMtl implementation
|
||||
VertexArrayMtl::VertexArrayMtl(const gl::VertexArrayState &state) : VertexArrayImpl(state)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
VertexArrayMtl::~VertexArrayMtl() {}
|
||||
|
||||
void VertexArrayMtl::destroy(const gl::Context *context)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
angle::Result VertexArrayMtl::syncState(const gl::Context *context,
|
||||
const gl::VertexArray::DirtyBits &dirtyBits,
|
||||
gl::VertexArray::DirtyAttribBitsArray *attribBits,
|
||||
gl::VertexArray::DirtyBindingBitsArray *bindingBits)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// 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_common.h:
|
||||
// Declares common constants, template classes, and mtl::Context - the MTLDevice container &
|
||||
// error handler base class.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_METAL_MTL_COMMON_H_
|
||||
#define LIBANGLE_RENDERER_METAL_MTL_COMMON_H_
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/Optional.h"
|
||||
#include "common/PackedEnums.h"
|
||||
#include "common/angleutils.h"
|
||||
#include "libANGLE/Constants.h"
|
||||
#include "libANGLE/Version.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
class RendererMtl;
|
||||
|
||||
namespace mtl
|
||||
{
|
||||
|
||||
class ErrorHandler
|
||||
{
|
||||
public:
|
||||
virtual ~ErrorHandler() {}
|
||||
|
||||
virtual void handleError(GLenum error,
|
||||
const char *file,
|
||||
const char *function,
|
||||
unsigned int line) = 0;
|
||||
};
|
||||
|
||||
class Context : public ErrorHandler
|
||||
{
|
||||
public:
|
||||
Context(RendererMtl *rendererMtl);
|
||||
_Nullable id<MTLDevice> getMetalDevice() const;
|
||||
|
||||
RendererMtl *getRenderer() const { return mRendererMtl; }
|
||||
|
||||
protected:
|
||||
RendererMtl *mRendererMtl;
|
||||
};
|
||||
|
||||
#define ANGLE_MTL_CHECK(context, test, error) \
|
||||
do \
|
||||
{ \
|
||||
if (ANGLE_UNLIKELY(!test)) \
|
||||
{ \
|
||||
context->handleError(error, __FILE__, ANGLE_FUNCTION, __LINE__); \
|
||||
return angle::Result::Stop; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ANGLE_MTL_TRY(context, test) ANGLE_MTL_CHECK(context, test, GL_INVALID_OPERATION)
|
||||
|
||||
} // namespace mtl
|
||||
} // namespace rx
|
||||
|
||||
#endif /* LIBANGLE_RENDERER_METAL_MTL_COMMON_H_ */
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// 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_common.mm:
|
||||
// Implementation of mtl::Context, the MTLDevice container & error handler class.
|
||||
//
|
||||
|
||||
#include "libANGLE/renderer/metal/mtl_common.h"
|
||||
|
||||
#include <dispatch/dispatch.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "libANGLE/angletypes.h"
|
||||
#include "libANGLE/renderer/metal/RendererMtl.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
namespace mtl
|
||||
{
|
||||
|
||||
Context::Context(RendererMtl *rendererMtl) : mRendererMtl(rendererMtl) {}
|
||||
|
||||
id<MTLDevice> Context::getMetalDevice() const
|
||||
{
|
||||
return mRendererMtl->getMetalDevice();
|
||||
}
|
||||
|
||||
} // namespace mtl
|
||||
} // namespace rx
|
|
@ -740,7 +740,7 @@ bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
|
|||
|
||||
bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
|
||||
{
|
||||
GLfloat asFloat = FixedToFloat(param);
|
||||
GLfloat asFloat = ConvertFixedToFloat(param);
|
||||
return ValidateFogCommon(context, pname, &asFloat);
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
|
|||
|
||||
for (unsigned int i = 0; i < paramCount; i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
return ValidateFogCommon(context, pname, paramsf);
|
||||
|
@ -901,7 +901,7 @@ bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const
|
|||
|
||||
bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
|
||||
{
|
||||
return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
|
||||
return ValidateLightSingleComponent(context, light, pname, ConvertFixedToFloat(param));
|
||||
}
|
||||
|
||||
bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
|
||||
|
@ -909,7 +909,7 @@ bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const
|
|||
GLfloat paramsf[4];
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
return ValidateLightCommon(context, light, pname, paramsf);
|
||||
|
@ -982,7 +982,7 @@ bool ValidateMaterialfv(Context *context,
|
|||
|
||||
bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
|
||||
{
|
||||
return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
|
||||
return ValidateMaterialSingleComponent(context, face, pname, ConvertFixedToFloat(param));
|
||||
}
|
||||
|
||||
bool ValidateMaterialxv(Context *context,
|
||||
|
@ -994,7 +994,7 @@ bool ValidateMaterialxv(Context *context,
|
|||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
return ValidateMaterialSetting(context, face, pname, paramsf);
|
||||
|
@ -1128,7 +1128,7 @@ bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed par
|
|||
return false;
|
||||
}
|
||||
|
||||
GLfloat paramf = FixedToFloat(param);
|
||||
GLfloat paramf = ConvertFixedToFloat(param);
|
||||
return ValidatePointParameterCommon(context, pname, ¶mf);
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfi
|
|||
GLfloat paramsf[4] = {};
|
||||
for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
return ValidatePointParameterCommon(context, pname, paramsf);
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ bool ValidatePointSize(Context *context, GLfloat size)
|
|||
|
||||
bool ValidatePointSizex(Context *context, GLfixed size)
|
||||
{
|
||||
return ValidatePointSizeCommon(context, FixedToFloat(size));
|
||||
return ValidatePointSizeCommon(context, ConvertFixedToFloat(size));
|
||||
}
|
||||
|
||||
bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
|
||||
|
@ -1299,7 +1299,7 @@ bool ValidateTexEnvxv(Context *context,
|
|||
bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
|
||||
{
|
||||
ANGLE_VALIDATE_IS_GLES1(context);
|
||||
GLfloat paramf = FixedToFloat(param);
|
||||
GLfloat paramf = ConvertFixedToFloat(param);
|
||||
return ValidateTexParameterBase(context, target, pname, -1, false, ¶mf);
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ bool ValidateTexParameterxv(Context *context,
|
|||
GLfloat paramsf[4] = {};
|
||||
for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
paramsf[i] = ConvertFixedToFloat(params[i]);
|
||||
}
|
||||
return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
|
||||
}
|
||||
|
@ -1390,12 +1390,13 @@ bool ValidateDrawTexxOES(Context *context,
|
|||
GLfixed width,
|
||||
GLfixed height)
|
||||
{
|
||||
return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
|
||||
return ValidateDrawTexCommon(context, ConvertFixedToFloat(width), ConvertFixedToFloat(height));
|
||||
}
|
||||
|
||||
bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
|
||||
{
|
||||
return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
|
||||
return ValidateDrawTexCommon(context, ConvertFixedToFloat(coords[3]),
|
||||
ConvertFixedToFloat(coords[4]));
|
||||
}
|
||||
|
||||
bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
|
||||
|
|
Загрузка…
Ссылка в новой задаче