Commit 77abad8d by Jamie Madill Committed by Commit Bot

Remove Context::gatherParams.

This won't be used in the future. It saves a few instructions on each entry point. Also refactors a bit of touched code. Also adds in a missed entry point: "glTexStorage2DMultisampleANGLE". Removes related code and moves remaining helper code in params.h into a new file entry_point_utils.h. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ifb49564597cde6ba82dfc3e185227619fdc62612 Reviewed-on: https://chromium-review.googlesource.com/c/1299478Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 1f056bec
...@@ -191,8 +191,6 @@ template_entry_point_def = """{return_type}GL_APIENTRY {name}{explicit_context_s ...@@ -191,8 +191,6 @@ template_entry_point_def = """{return_type}GL_APIENTRY {name}{explicit_context_s
Context *context = {context_getter}; Context *context = {context_getter};
if (context) if (context)
{{{assert_explicit_context}{packed_gl_enum_conversions} {{{assert_explicit_context}{packed_gl_enum_conversions}
context->gatherParams<EntryPoint::{name}>({internal_params});
if (context->skipValidation() || Validate{name}({validate_params})) if (context->skipValidation() || Validate{name}({validate_params}))
{{ {{
{return_if_needed}context->{name_lower_no_suffix}({internal_params}); {return_if_needed}context->{name_lower_no_suffix}({internal_params});
...@@ -679,6 +677,7 @@ template_sources_includes = """#include "libGLESv2/entry_points_gles_{}_autogen. ...@@ -679,6 +677,7 @@ template_sources_includes = """#include "libGLESv2/entry_points_gles_{}_autogen.
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/validationES{}{}.h" #include "libANGLE/validationES{}{}.h"
#include "libGLESv2/entry_points_utils.h"
#include "libGLESv2/global_state.h" #include "libGLESv2/global_state.h"
""" """
...@@ -904,7 +903,7 @@ entry_points_enum = template_entry_points_enum_header.format( ...@@ -904,7 +903,7 @@ entry_points_enum = template_entry_points_enum_header.format(
year = date.today().year, year = date.today().year,
entry_points_list = ",\n".join([" " + cmd for cmd in sorted_cmd_names])) entry_points_list = ",\n".join([" " + cmd for cmd in sorted_cmd_names]))
entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h") entry_points_enum_header_path = path_to("libGLESv2", "entry_points_enum_autogen.h")
with open(entry_points_enum_header_path, "w") as out: with open(entry_points_enum_header_path, "w") as out:
out.write(entry_points_enum) out.write(entry_points_enum)
out.close() out.close()
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
"GL entry point:scripts/entry_point_packed_gl_enums.json": "GL entry point:scripts/entry_point_packed_gl_enums.json":
"cc1985ce86341a3ff0f5a278eae0fa8f", "cc1985ce86341a3ff0f5a278eae0fa8f",
"GL entry point:scripts/generate_entry_points.py": "GL entry point:scripts/generate_entry_points.py":
"9f2dda92feb508e98c62931a0466f5cd", "24661bb77e40e05ae8de8459e350d373",
"GL entry point:scripts/gl.xml": "GL entry point:scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708", "b470cb06b06cbbe7adb2c8129ec85708",
"GL format map:src/libANGLE/es3_format_type_combinations.json": "GL format map:src/libANGLE/es3_format_type_combinations.json":
......
...@@ -336,7 +336,6 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -336,7 +336,6 @@ Context::Context(rx::EGLImplFactory *implFactory,
mLimitations), mLimitations),
mSkipValidation(GetNoError(attribs)), mSkipValidation(GetNoError(attribs)),
mDisplayTextureShareGroup(shareTextures != nullptr), mDisplayTextureShareGroup(shareTextures != nullptr),
mSavedArgsType(nullptr),
mImplementation(implFactory->createContext(mState, config, shareContext, attribs)), mImplementation(implFactory->createContext(mState, config, shareContext, attribs)),
mLabel(nullptr), mLabel(nullptr),
mCompiler(), mCompiler(),
...@@ -368,10 +367,6 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -368,10 +367,6 @@ Context::Context(rx::EGLImplFactory *implFactory,
mZeroFilledBuffer(1000u), mZeroFilledBuffer(1000u),
mThreadPool(nullptr) mThreadPool(nullptr)
{ {
// Needed to solve a Clang warning of unused variables.
ANGLE_UNUSED_VARIABLE(mSavedArgsType);
ANGLE_UNUSED_VARIABLE(mParamsBuffer);
for (angle::SubjectIndex uboIndex = kUniformBuffer0SubjectIndex; for (angle::SubjectIndex uboIndex = kUniformBuffer0SubjectIndex;
uboIndex < kUniformBufferMaxSubjectIndex; ++uboIndex) uboIndex < kUniformBufferMaxSubjectIndex; ++uboIndex)
{ {
......
...@@ -1622,9 +1622,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1622,9 +1622,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; } MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
template <EntryPoint EP, typename... ParamsT>
void gatherParams(ParamsT &&... params);
// Notification for a state change in a Texture. // Notification for a state change in a Texture.
void onTextureChange(const Texture *texture); void onTextureChange(const Texture *texture);
...@@ -1693,9 +1690,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1693,9 +1690,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
bool isWebGL() const { return mState.isWebGL(); } bool isWebGL() const { return mState.isWebGL(); }
bool isWebGL1() const { return mState.isWebGL1(); } bool isWebGL1() const { return mState.isWebGL1(); }
template <typename T>
const T &getParams() const;
bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; } bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; }
// GLES1 emulation: Renderer level (for validation) // GLES1 emulation: Renderer level (for validation)
...@@ -1766,11 +1760,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1766,11 +1760,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
// Stores for each buffer binding type whether is it allowed to be used in this context. // Stores for each buffer binding type whether is it allowed to be used in this context.
angle::PackedEnumBitSet<BufferBinding> mValidBufferBindings; angle::PackedEnumBitSet<BufferBinding> mValidBufferBindings;
// Caches entry point parameters and values re-used between layers.
mutable const ParamTypeInfo *mSavedArgsType;
static constexpr size_t kParamsBufferSize = 128u;
mutable std::array<uint8_t, kParamsBufferSize> mParamsBuffer;
std::unique_ptr<rx::ContextImpl> mImplementation; std::unique_ptr<rx::ContextImpl> mImplementation;
EGLLabelKHR mLabel; EGLLabelKHR mLabel;
...@@ -1868,34 +1857,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -1868,34 +1857,6 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
std::shared_ptr<angle::WorkerThreadPool> mThreadPool; std::shared_ptr<angle::WorkerThreadPool> mThreadPool;
}; };
template <typename T>
const T &Context::getParams() const
{
const T *params = reinterpret_cast<T *>(mParamsBuffer.data());
ASSERT(mSavedArgsType->hasDynamicType(T::TypeInfo));
return *params;
}
template <EntryPoint EP, typename... ArgsT>
ANGLE_INLINE void Context::gatherParams(ArgsT &&... args)
{
static_assert(sizeof(EntryPointParamType<EP>) <= kParamsBufferSize,
"Params struct too large, please increase kParamsBufferSize.");
mSavedArgsType = &EntryPointParamType<EP>::TypeInfo;
// Skip doing any work for ParamsBase/Invalid type.
if (!EntryPointParamType<EP>::TypeInfo.isValid())
{
return;
}
EntryPointParamType<EP> *objBuffer =
reinterpret_cast<EntryPointParamType<EP> *>(mParamsBuffer.data());
EntryPointParamType<EP>::template Factory<EP>(objBuffer, this, std::forward<ArgsT>(args)...);
}
} // namespace gl } // namespace gl
#endif // LIBANGLE_CONTEXT_H_ #endif // LIBANGLE_CONTEXT_H_
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "libANGLE/State.h" #include "libANGLE/State.h"
#include "libANGLE/Version.h" #include "libANGLE/Version.h"
#include "libANGLE/WorkerThread.h" #include "libANGLE/WorkerThread.h"
#include "libANGLE/params.h"
namespace gl namespace gl
{ {
......
...@@ -990,12 +990,10 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -990,12 +990,10 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
if (mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE) if (mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE)
{ {
Error err = syncState(context); angle::Result err = syncState(context);
if (err.isError()) if (err != angle::Result::Continue())
{ {
// TODO(jmadill): Remove when refactor complete. http://anglebug.com/2491 return 0;
const_cast<Context *>(context)->handleError(err);
return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatus, GLenum>();
} }
if (!mImpl->checkStatus(context)) if (!mImpl->checkStatus(context))
{ {
......
...@@ -458,7 +458,6 @@ void GLES1Renderer::drawTexture(Context *context, ...@@ -458,7 +458,6 @@ void GLES1Renderer::drawTexture(Context *context,
setAttributesEnabled(context, glState, AttributesMask()); setAttributesEnabled(context, glState, AttributesMask());
context->gatherParams<EntryPoint::DrawArrays>(PrimitiveMode::Triangles, 0, 6);
context->drawArrays(PrimitiveMode::Triangles, 0, 6); context->drawArrays(PrimitiveMode::Triangles, 0, 6);
setAttributesEnabled(context, glState, prevAttributesMask); setAttributesEnabled(context, glState, prevAttributesMask);
......
//
// Copyright 2017 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.
//
// params:
// Parameter wrapper structs for OpenGL ES. These helpers cache re-used values
// in entry point routines.
#include "libANGLE/params.h"
#include "common/utilities.h"
#include "libANGLE/Context.h"
#include "libANGLE/VertexArray.h"
namespace gl
{
// static
constexpr ParamTypeInfo ParamsBase::TypeInfo;
} // namespace gl
...@@ -1399,8 +1399,8 @@ void GenerateCaps(ID3D11Device *device, ...@@ -1399,8 +1399,8 @@ void GenerateCaps(ID3D11Device *device,
// No specific limits on render target size, maximum 2D texture size is equivalent // No specific limits on render target size, maximum 2D texture size is equivalent
caps->maxRenderbufferSize = caps->max2DTextureSize; caps->maxRenderbufferSize = caps->max2DTextureSize;
// Maximum draw buffers and color attachments are the same, max color attachments could eventually be // Maximum draw buffers and color attachments are the same, max color attachments could
// increased to 16 // eventually be increased to 16
caps->maxDrawBuffers = static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel)); caps->maxDrawBuffers = static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
caps->maxColorAttachments = caps->maxColorAttachments =
static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel)); static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
...@@ -1502,7 +1502,8 @@ void GenerateCaps(ID3D11Device *device, ...@@ -1502,7 +1502,8 @@ void GenerateCaps(ID3D11Device *device,
// TODO(oetuaho): Get a more accurate limit. For now using the minimum requirement for GLES 3.1. // TODO(oetuaho): Get a more accurate limit. For now using the minimum requirement for GLES 3.1.
caps->maxUniformLocations = 1024; caps->maxUniformLocations = 1024;
// With DirectX 11.1, constant buffer offset and size must be a multiple of 16 constants of 16 bytes each. // With DirectX 11.1, constant buffer offset and size must be a multiple of 16 constants of 16
// bytes each.
// https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
// With DirectX 11.0, we emulate UBO offsets using copies of ranges of the UBO however // With DirectX 11.0, we emulate UBO offsets using copies of ranges of the UBO however
// we still keep the same alignment as 11.1 for consistency. // we still keep the same alignment as 11.1 for consistency.
...@@ -1623,11 +1624,14 @@ void GenerateCaps(ID3D11Device *device, ...@@ -1623,11 +1624,14 @@ void GenerateCaps(ID3D11Device *device,
extensions->textureBorderClamp = true; extensions->textureBorderClamp = true;
// D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing. // D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing.
// D3D11 Feature Level 9_3 doesn't support SV_IsFrontFace, and has no equivalent, so can't support gl_FrontFacing. // D3D11 Feature Level 9_3 doesn't support SV_IsFrontFace, and has no equivalent, so can't
limitations->noFrontFacingSupport = (renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3); // support gl_FrontFacing.
limitations->noFrontFacingSupport =
(renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
// D3D11 Feature Level 9_3 doesn't support alpha-to-coverage // D3D11 Feature Level 9_3 doesn't support alpha-to-coverage
limitations->noSampleAlphaToCoverageSupport = (renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3); limitations->noSampleAlphaToCoverageSupport =
(renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
// D3D11 Feature Levels 9_3 and below do not support non-constant loop indexing and require // D3D11 Feature Levels 9_3 and below do not support non-constant loop indexing and require
// additional // additional
...@@ -1643,9 +1647,10 @@ void GenerateCaps(ID3D11Device *device, ...@@ -1643,9 +1647,10 @@ void GenerateCaps(ID3D11Device *device,
limitations->noSimultaneousConstantColorAndAlphaBlendFunc = true; limitations->noSimultaneousConstantColorAndAlphaBlendFunc = true;
#ifdef ANGLE_ENABLE_WINDOWS_STORE #ifdef ANGLE_ENABLE_WINDOWS_STORE
// Setting a non-zero divisor on attribute zero doesn't work on certain Windows Phone 8-era devices. // Setting a non-zero divisor on attribute zero doesn't work on certain Windows Phone 8-era
// We should prevent developers from doing this on ALL Windows Store devices. This will maintain consistency across all Windows devices. // devices. We should prevent developers from doing this on ALL Windows Store devices. This will
// We allow non-zero divisors on attribute zero if the Client Version >= 3, since devices affected by this issue don't support ES3+. // maintain consistency across all Windows devices. We allow non-zero divisors on attribute zero
// if the Client Version >= 3, since devices affected by this issue don't support ES3+.
limitations->attributeZeroRequiresZeroDivisorInEXT = true; limitations->attributeZeroRequiresZeroDivisorInEXT = true;
#endif #endif
} }
...@@ -2070,7 +2075,11 @@ ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device) ...@@ -2070,7 +2075,11 @@ ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device)
return retDeviceType; return retDeviceType;
} }
void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset) void MakeValidSize(bool isImage,
DXGI_FORMAT format,
GLsizei *requestWidth,
GLsizei *requestHeight,
int *levelOffset)
{ {
const DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(format); const DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(format);
...@@ -2079,7 +2088,8 @@ void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsi ...@@ -2079,7 +2088,8 @@ void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsi
if (isImage || *requestWidth < static_cast<GLsizei>(dxgiFormatInfo.blockWidth) || if (isImage || *requestWidth < static_cast<GLsizei>(dxgiFormatInfo.blockWidth) ||
*requestHeight < static_cast<GLsizei>(dxgiFormatInfo.blockHeight)) *requestHeight < static_cast<GLsizei>(dxgiFormatInfo.blockHeight))
{ {
while (*requestWidth % dxgiFormatInfo.blockWidth != 0 || *requestHeight % dxgiFormatInfo.blockHeight != 0) while (*requestWidth % dxgiFormatInfo.blockWidth != 0 ||
*requestHeight % dxgiFormatInfo.blockHeight != 0)
{ {
*requestWidth <<= 1; *requestWidth <<= 1;
*requestHeight <<= 1; *requestHeight <<= 1;
...@@ -2140,7 +2150,7 @@ UINT GetPrimitiveRestartIndex() ...@@ -2140,7 +2150,7 @@ UINT GetPrimitiveRestartIndex()
return std::numeric_limits<UINT>::max(); return std::numeric_limits<UINT>::max();
} }
void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v) void SetPositionTexCoordVertex(PositionTexCoordVertex *vertex, float x, float y, float u, float v)
{ {
vertex->x = x; vertex->x = x;
vertex->y = y; vertex->y = y;
...@@ -2148,8 +2158,13 @@ void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, ...@@ -2148,8 +2158,13 @@ void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y,
vertex->v = v; vertex->v = v;
} }
void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y, void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex *vertex,
unsigned int layer, float u, float v, float s) float x,
float y,
unsigned int layer,
float u,
float v,
float s)
{ {
vertex->x = x; vertex->x = x;
vertex->y = y; vertex->y = y;
......
...@@ -50,7 +50,10 @@ D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled); ...@@ -50,7 +50,10 @@ D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
UINT8 ConvertStencilMask(GLuint stencilmask); UINT8 ConvertStencilMask(GLuint stencilmask);
D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp); D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode); D3D11_FILTER ConvertFilter(GLenum minFilter,
GLenum magFilter,
float maxAnisotropy,
GLenum comparisonMode);
D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap); D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel); UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel);
...@@ -96,7 +99,11 @@ enum ANGLED3D11DeviceType ...@@ -96,7 +99,11 @@ enum ANGLED3D11DeviceType
ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device); ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device);
void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset); void MakeValidSize(bool isImage,
DXGI_FORMAT format,
GLsizei *requestWidth,
GLsizei *requestHeight,
int *levelOffset);
angle::Result GenerateInitialTextureData( angle::Result GenerateInitialTextureData(
const gl::Context *context, const gl::Context *context,
...@@ -115,7 +122,7 @@ struct PositionTexCoordVertex ...@@ -115,7 +122,7 @@ struct PositionTexCoordVertex
float x, y; float x, y;
float u, v; float u, v;
}; };
void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v); void SetPositionTexCoordVertex(PositionTexCoordVertex *vertex, float x, float y, float u, float v);
struct PositionLayerTexCoord3DVertex struct PositionLayerTexCoord3DVertex
{ {
...@@ -123,8 +130,13 @@ struct PositionLayerTexCoord3DVertex ...@@ -123,8 +130,13 @@ struct PositionLayerTexCoord3DVertex
unsigned int l; unsigned int l;
float u, v, s; float u, v, s;
}; };
void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y, void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex *vertex,
unsigned int layer, float u, float v, float s); float x,
float y,
unsigned int layer,
float u,
float v,
float s);
struct PositionVertex struct PositionVertex
{ {
...@@ -162,10 +174,11 @@ bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b); ...@@ -162,10 +174,11 @@ bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b);
bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b); bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b);
template <typename outType> template <typename outType>
outType* DynamicCastComObject(IUnknown* object) outType *DynamicCastComObject(IUnknown *object)
{ {
outType *outObject = nullptr; outType *outObject = nullptr;
HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast<void**>(&outObject)); HRESULT result =
object->QueryInterface(__uuidof(outType), reinterpret_cast<void **>(&outObject));
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
return outObject; return outObject;
......
...@@ -236,10 +236,8 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -236,10 +236,8 @@ class ContextVk : public ContextImpl, public vk::Context
angle::Result handleDirtyDefaultAttribs(const gl::Context *context, angle::Result handleDirtyDefaultAttribs(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyPipeline(const gl::Context *context, angle::Result handleDirtyPipeline(const gl::Context *context, vk::CommandBuffer *commandBuffer);
vk::CommandBuffer *commandBuffer); angle::Result handleDirtyTextures(const gl::Context *context, vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyTextures(const gl::Context *context,
vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyVertexBuffers(const gl::Context *context, angle::Result handleDirtyVertexBuffers(const gl::Context *context,
vk::CommandBuffer *commandBuffer); vk::CommandBuffer *commandBuffer);
angle::Result handleDirtyIndexBuffer(const gl::Context *context, angle::Result handleDirtyIndexBuffer(const gl::Context *context,
......
...@@ -105,8 +105,7 @@ class ProgramVk : public ProgramImpl ...@@ -105,8 +105,7 @@ class ProgramVk : public ProgramImpl
angle::Result updateUniforms(ContextVk *contextVk); angle::Result updateUniforms(ContextVk *contextVk);
angle::Result updateTexturesDescriptorSet(ContextVk *contextVk); angle::Result updateTexturesDescriptorSet(ContextVk *contextVk);
angle::Result updateDescriptorSets(ContextVk *contextVk, angle::Result updateDescriptorSets(ContextVk *contextVk, vk::CommandBuffer *commandBuffer);
vk::CommandBuffer *commandBuffer);
// For testing only. // For testing only.
void setDefaultUniformBlocksMinSizeForTesting(size_t minSize); void setDefaultUniformBlocksMinSizeForTesting(size_t minSize);
......
...@@ -222,15 +222,12 @@ libangle_sources = [ ...@@ -222,15 +222,12 @@ libangle_sources = [
"src/libANGLE/angletypes.cpp", "src/libANGLE/angletypes.cpp",
"src/libANGLE/angletypes.h", "src/libANGLE/angletypes.h",
"src/libANGLE/angletypes.inl", "src/libANGLE/angletypes.inl",
"src/libANGLE/entry_points_enum_autogen.h",
"src/libANGLE/es3_copy_conversion_table_autogen.cpp", "src/libANGLE/es3_copy_conversion_table_autogen.cpp",
"src/libANGLE/features.h", "src/libANGLE/features.h",
"src/libANGLE/format_map_autogen.cpp", "src/libANGLE/format_map_autogen.cpp",
"src/libANGLE/formatutils.cpp", "src/libANGLE/formatutils.cpp",
"src/libANGLE/formatutils.h", "src/libANGLE/formatutils.h",
"src/libANGLE/histogram_macros.h", "src/libANGLE/histogram_macros.h",
"src/libANGLE/params.cpp",
"src/libANGLE/params.h",
"src/libANGLE/queryconversions.cpp", "src/libANGLE/queryconversions.cpp",
"src/libANGLE/queryconversions.h", "src/libANGLE/queryconversions.h",
"src/libANGLE/queryutils.cpp", "src/libANGLE/queryutils.cpp",
...@@ -867,6 +864,7 @@ libglesv2_sources = [ ...@@ -867,6 +864,7 @@ libglesv2_sources = [
"src/libGLESv2/entry_points_egl.h", "src/libGLESv2/entry_points_egl.h",
"src/libGLESv2/entry_points_egl_ext.cpp", "src/libGLESv2/entry_points_egl_ext.cpp",
"src/libGLESv2/entry_points_egl_ext.h", "src/libGLESv2/entry_points_egl_ext.h",
"src/libGLESv2/entry_points_enum_autogen.h",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp", "src/libGLESv2/entry_points_gles_1_0_autogen.cpp",
"src/libGLESv2/entry_points_gles_1_0_autogen.h", "src/libGLESv2/entry_points_gles_1_0_autogen.h",
"src/libGLESv2/entry_points_gles_2_0_autogen.cpp", "src/libGLESv2/entry_points_gles_2_0_autogen.cpp",
...@@ -877,6 +875,7 @@ libglesv2_sources = [ ...@@ -877,6 +875,7 @@ libglesv2_sources = [
"src/libGLESv2/entry_points_gles_3_1_autogen.h", "src/libGLESv2/entry_points_gles_3_1_autogen.h",
"src/libGLESv2/entry_points_gles_ext_autogen.cpp", "src/libGLESv2/entry_points_gles_ext_autogen.cpp",
"src/libGLESv2/entry_points_gles_ext_autogen.h", "src/libGLESv2/entry_points_gles_ext_autogen.h",
"src/libGLESv2/entry_points_utils.h",
"src/libGLESv2/global_state.cpp", "src/libGLESv2/global_state.cpp",
"src/libGLESv2/global_state.h", "src/libGLESv2/global_state.h",
"src/libGLESv2/libGLESv2_autogen.cpp", "src/libGLESv2/libGLESv2_autogen.cpp",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
// //
// Copyright 2017 The ANGLE Project Authors. All rights reserved. // Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// params: // entry_point_utils:
// Parameter wrapper structs for OpenGL ES. These helpers cache re-used values // These helpers are used in GLES entry point routines.
// in entry point routines.
#ifndef LIBANGLE_PARAMS_H_ #ifndef LIBGLESV2_ENTRY_POINT_UTILS_H_
#define LIBANGLE_PARAMS_H_ #define LIBGLESV2_ENTRY_POINT_UTILS_H_
#include "angle_gl.h" #include "angle_gl.h"
#include "common/Optional.h" #include "common/Optional.h"
#include "common/PackedEnums.h" #include "common/PackedEnums.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/mathutil.h" #include "common/mathutil.h"
#include "libANGLE/Error.h" #include "libGLESv2/entry_points_enum_autogen.h"
#include "libANGLE/entry_points_enum_autogen.h"
namespace gl namespace gl
{ {
class Context;
template <EntryPoint EP>
struct EntryPointParam;
template <EntryPoint EP>
using EntryPointParamType = typename EntryPointParam<EP>::Type;
class ParamTypeInfo
{
public:
constexpr ParamTypeInfo(const char *selfClass, const ParamTypeInfo *parentType)
: mSelfClass(selfClass), mParentTypeInfo(parentType)
{
}
constexpr bool hasDynamicType(const ParamTypeInfo &typeInfo) const
{
return mSelfClass == typeInfo.mSelfClass ||
(mParentTypeInfo && mParentTypeInfo->hasDynamicType(typeInfo));
}
constexpr bool isValid() const { return mSelfClass != nullptr; }
private:
const char *mSelfClass;
const ParamTypeInfo *mParentTypeInfo;
};
#define ANGLE_PARAM_TYPE_INFO(NAME, BASENAME) \
static constexpr ParamTypeInfo TypeInfo = {#NAME, &BASENAME::TypeInfo}
class ParamsBase : angle::NonCopyable
{
public:
ParamsBase(Context *context, ...){};
template <EntryPoint EP, typename... ArgsT>
static void Factory(EntryPointParamType<EP> *objBuffer, ArgsT... args);
static constexpr ParamTypeInfo TypeInfo = {nullptr, nullptr};
};
// static
template <EntryPoint EP, typename... ArgsT>
ANGLE_INLINE void ParamsBase::Factory(EntryPointParamType<EP> *objBuffer, ArgsT... args)
{
new (objBuffer) EntryPointParamType<EP>(args...);
}
// Entry point funcs essentially re-map different entry point parameter arrays into
// the format the parameter type class expects.
#define ANGLE_ENTRY_POINT_FUNC(NAME, CLASS, ...) \
\
template<> struct EntryPointParam<EntryPoint::NAME> \
{ \
using Type = CLASS; \
}; \
\
template<> inline void CLASS::Factory<EntryPoint::NAME>(__VA_ARGS__)
#undef ANGLE_ENTRY_POINT_FUNC
template <EntryPoint EP>
struct EntryPointParam
{
using Type = ParamsBase;
};
// A template struct for determining the default value to return for each entry point. // A template struct for determining the default value to return for each entry point.
template <EntryPoint EP, typename ReturnType> template <EntryPoint EP, typename ReturnType>
struct DefaultReturnValue; struct DefaultReturnValue;
...@@ -152,7 +81,6 @@ constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue() ...@@ -152,7 +81,6 @@ constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue()
{ {
return DefaultReturnValue<EP, ReturnType>::kValue; return DefaultReturnValue<EP, ReturnType>::kValue;
} }
} // namespace gl } // namespace gl
#endif // LIBANGLE_PARAMS_H_ #endif // LIBGLESV2_ENTRY_POINT_UTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment