Commit ea586549 by Yuly Novikov Committed by Commit Bot

Cleanup after translator component removal

- Unite translator with translator_lib - Remove flags and defines for shared library exports BUG=angleproject:1596 Change-Id: Icd145a4b79e2472766a2b56017bb0f36f244482e Reviewed-on: https://chromium-review.googlesource.com/410261Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 619c833b
......@@ -73,25 +73,6 @@ if (is_win) {
angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
static_library("translator") {
sources = [
"src/compiler/translator/ShaderLang.cpp",
"src/compiler/translator/ShaderVars.cpp",
]
if (angle_enable_hlsl) {
defines = [ "ANGLE_ENABLE_HLSL" ]
}
configs -= angle_undefine_configs
configs += [ ":internal_config" ]
public_configs = [ ":translator_static_config" ]
public_deps = [
":translator_lib",
]
}
# Holds the shared includes so we only need to list them once.
source_set("includes") {
sources = [
......@@ -121,10 +102,6 @@ static_library("preprocessor") {
]
}
config("translator_static_config") {
defines = [ "ANGLE_TRANSLATOR_STATIC" ]
}
config("translator_disable_pool_alloc") {
defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ]
}
......@@ -185,7 +162,7 @@ static_library("angle_image_util") {
]
}
static_library("translator_lib") {
static_library("translator") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
defines = []
......@@ -207,10 +184,7 @@ static_library("translator_lib") {
defines += [ "ANGLE_ENABLE_HLSL" ]
}
configs -= angle_undefine_configs
configs += [
":internal_config",
":translator_static_config",
]
configs += [ ":internal_config" ]
public_configs = [ ":external_config" ]
if (use_libfuzzer) {
all_dependent_configs = [ ":translator_disable_pool_alloc" ]
......
......@@ -6,23 +6,6 @@
#ifndef GLSLANG_SHADERLANG_H_
#define GLSLANG_SHADERLANG_H_
#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#if defined(_WIN32) || defined(_WIN64)
#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
#define COMPILER_EXPORT __declspec(dllexport)
#else
#define COMPILER_EXPORT __declspec(dllimport)
#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
#else // defined(_WIN32) || defined(_WIN64)
#define COMPILER_EXPORT __attribute__((visibility("default")))
#endif
#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
#define COMPILER_EXPORT
#endif
#include <stddef.h>
#include "KHR/khrplatform.h"
......@@ -394,19 +377,19 @@ using ShHandle = void *;
// compiler operations.
// If the function succeeds, the return value is true, else false.
//
COMPILER_EXPORT bool ShInitialize();
bool ShInitialize();
//
// Driver should call this at shutdown.
// If the function succeeds, the return value is true, else false.
//
COMPILER_EXPORT bool ShFinalize();
bool ShFinalize();
//
// Initialize built-in resources with minimum expected values.
// Parameters:
// resources: The object to initialize. Will be comparable with memcmp.
//
COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
void ShInitBuiltInResources(ShBuiltInResources *resources);
//
// Returns the a concatenated list of the items in ShBuiltInResources as a
......@@ -414,7 +397,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
// This function must be updated whenever ShBuiltInResources is changed.
// Parameters:
// handle: Specifies the handle of the compiler to be used.
COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle handle);
const std::string &ShGetBuiltInResourcesString(const ShHandle handle);
//
// Driver calls these to create and destroy compiler objects.
......@@ -429,12 +412,11 @@ COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle ha
// SH_HLSL_3_0_OUTPUT or SH_HLSL_4_1_OUTPUT. Note: Each output type may only
// be supported in some configurations.
// resources: Specifies the built-in resources.
COMPILER_EXPORT ShHandle ShConstructCompiler(
sh::GLenum type,
ShShaderSpec spec,
ShShaderOutput output,
const ShBuiltInResources *resources);
COMPILER_EXPORT void ShDestruct(ShHandle handle);
ShHandle ShConstructCompiler(sh::GLenum type,
ShShaderSpec spec,
ShShaderOutput output,
const ShBuiltInResources *resources);
void ShDestruct(ShHandle handle);
//
// Compiles the given shader source.
......@@ -460,38 +442,36 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
// SH_VARIABLES: Extracts attributes, uniforms, and varyings.
// Can be queried by calling ShGetVariableInfo().
//
COMPILER_EXPORT bool ShCompile(const ShHandle handle,
const char *const shaderStrings[],
size_t numStrings,
ShCompileOptions compileOptions);
bool ShCompile(const ShHandle handle,
const char *const shaderStrings[],
size_t numStrings,
ShCompileOptions compileOptions);
// Clears the results from the previous compilation.
COMPILER_EXPORT void ShClearResults(const ShHandle handle);
void ShClearResults(const ShHandle handle);
// Return the version of the shader language.
COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
int ShGetShaderVersion(const ShHandle handle);
// Return the currently set language output type.
COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType(
const ShHandle handle);
ShShaderOutput ShGetShaderOutputType(const ShHandle handle);
// Returns null-terminated information log for a compiled shader.
// Parameters:
// handle: Specifies the compiler
COMPILER_EXPORT const std::string &ShGetInfoLog(const ShHandle handle);
const std::string &ShGetInfoLog(const ShHandle handle);
// Returns null-terminated object code for a compiled shader.
// Parameters:
// handle: Specifies the compiler
COMPILER_EXPORT const std::string &ShGetObjectCode(const ShHandle handle);
const std::string &ShGetObjectCode(const ShHandle handle);
// Returns a (original_name, hash) map containing all the user defined
// names in the shader, including variable names, function names, struct
// names, and struct field names.
// Parameters:
// handle: Specifies the compiler
COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
const ShHandle handle);
const std::map<std::string, std::string> *ShGetNameHashingMap(const ShHandle handle);
// Shader variable inspection.
// Returns a pointer to a list of variables of the designated type.
......@@ -499,12 +479,12 @@ COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
// Returns NULL on failure.
// Parameters:
// handle: Specifies the compiler
COMPILER_EXPORT const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle);
COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle);
COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle);
COMPILER_EXPORT const std::vector<sh::OutputVariable> *ShGetOutputVariables(const ShHandle handle);
COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
COMPILER_EXPORT sh::WorkGroupSize ShGetComputeShaderLocalGroupSize(const ShHandle handle);
const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle);
const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle);
const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle);
const std::vector<sh::OutputVariable> *ShGetOutputVariables(const ShHandle handle);
const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
sh::WorkGroupSize ShGetComputeShaderLocalGroupSize(const ShHandle handle);
// Returns true if the passed in variables pack in maxVectors following
// the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
......@@ -513,9 +493,8 @@ COMPILER_EXPORT sh::WorkGroupSize ShGetComputeShaderLocalGroupSize(const ShHandl
// Parameters:
// maxVectors: the available rows of registers.
// variables: an array of variables.
COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
int maxVectors,
const std::vector<sh::ShaderVariable> &variables);
bool ShCheckVariablesWithinPackingLimits(int maxVectors,
const std::vector<sh::ShaderVariable> &variables);
// Gives the compiler-assigned register for an interface block.
// The method writes the value to the output variable "indexOut".
......@@ -524,15 +503,14 @@ COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
// handle: Specifies the compiler
// interfaceBlockName: Specifies the interface block
// indexOut: output variable that stores the assigned register
COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
const std::string &interfaceBlockName,
unsigned int *indexOut);
bool ShGetInterfaceBlockRegister(const ShHandle handle,
const std::string &interfaceBlockName,
unsigned int *indexOut);
// Gives a map from uniform names to compiler-assigned registers in the default
// interface block. Note that the map contains also registers of samplers that
// have been extracted from structs.
COMPILER_EXPORT const std::map<std::string, unsigned int> *ShGetUniformRegisterMap(
const ShHandle handle);
const std::map<std::string, unsigned int> *ShGetUniformRegisterMap(const ShHandle handle);
// Temporary duplicate of the scoped APIs, to be removed when we roll ANGLE and fix Chromium.
// TODO(jmadill): Consolidate with these APIs once we roll ANGLE.
......
......@@ -29,7 +29,7 @@ enum InterpolationType
};
// Validate link & SSO consistency of interpolation qualifiers
COMPILER_EXPORT bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
enum BlockLayoutType
......@@ -43,7 +43,7 @@ enum BlockLayoutType
// Note: we must override the copy constructor and assignment operator so we can
// work around excessive GCC binary bloating:
// See https://code.google.com/p/angleproject/issues/detail?id=697
struct COMPILER_EXPORT ShaderVariable
struct ShaderVariable
{
ShaderVariable();
ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
......@@ -92,7 +92,7 @@ struct COMPILER_EXPORT ShaderVariable
}
};
struct COMPILER_EXPORT Uniform : public ShaderVariable
struct Uniform : public ShaderVariable
{
Uniform();
~Uniform();
......@@ -113,7 +113,7 @@ struct COMPILER_EXPORT Uniform : public ShaderVariable
// An interface variable is a variable which passes data between the GL data structures and the
// shader execution: either vertex shader inputs or fragment shader outputs. These variables can
// have integer locations to pass back to the GL API.
struct COMPILER_EXPORT InterfaceVariable : public ShaderVariable
struct InterfaceVariable : public ShaderVariable
{
InterfaceVariable();
~InterfaceVariable();
......@@ -125,7 +125,7 @@ struct COMPILER_EXPORT InterfaceVariable : public ShaderVariable
int location;
};
struct COMPILER_EXPORT Attribute : public InterfaceVariable
struct Attribute : public InterfaceVariable
{
Attribute();
~Attribute();
......@@ -135,7 +135,7 @@ struct COMPILER_EXPORT Attribute : public InterfaceVariable
bool operator!=(const Attribute &other) const { return !operator==(other); }
};
struct COMPILER_EXPORT OutputVariable : public InterfaceVariable
struct OutputVariable : public InterfaceVariable
{
OutputVariable();
~OutputVariable();
......@@ -145,7 +145,7 @@ struct COMPILER_EXPORT OutputVariable : public InterfaceVariable
bool operator!=(const OutputVariable &other) const { return !operator==(other); }
};
struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
struct InterfaceBlockField : public ShaderVariable
{
InterfaceBlockField();
~InterfaceBlockField();
......@@ -167,7 +167,7 @@ struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
bool isRowMajorLayout;
};
struct COMPILER_EXPORT Varying : public ShaderVariable
struct Varying : public ShaderVariable
{
Varying();
~Varying();
......@@ -193,7 +193,7 @@ struct COMPILER_EXPORT Varying : public ShaderVariable
bool isInvariant;
};
struct COMPILER_EXPORT InterfaceBlock
struct InterfaceBlock
{
InterfaceBlock();
~InterfaceBlock();
......@@ -216,7 +216,7 @@ struct COMPILER_EXPORT InterfaceBlock
std::vector<InterfaceBlockField> fields;
};
struct COMPILER_EXPORT WorkGroupSize
struct WorkGroupSize
{
void fill(int fillValue);
void setLocalSize(int localSizeX, int localSizeY, int localSizeZ);
......
......@@ -58,8 +58,7 @@ dest_folder = os.path.join(chrome_folder, sorted_chrome_bins[0])
print('Copying DLLs from ' + source_folder + ' to ' + dest_folder + '.')
# Translator.dll appears if we build in component=shared_library mode.
for dll in ['libGLESv2.dll', 'libEGL.dll', 'translator.dll']:
for dll in ['libGLESv2.dll', 'libEGL.dll']:
src = os.path.join(source_folder, dll)
if os.path.exists(src):
# Make a backup of the original unmodified DLLs if they are present.
......
......@@ -106,6 +106,8 @@
'compiler/translator/ScalarizeVecAndMatConstructorArgs.h',
'compiler/translator/SearchSymbol.cpp',
'compiler/translator/SearchSymbol.h',
'compiler/translator/ShaderLang.cpp',
'compiler/translator/ShaderVars.cpp',
'compiler/translator/SymbolTable.cpp',
'compiler/translator/SymbolTable.h',
'compiler/translator/Types.cpp',
......@@ -252,7 +254,7 @@
'sources': [ '<@(angle_preprocessor_sources)', ],
},
{
'target_name': 'translator_lib',
'target_name': 'translator',
'type': 'static_library',
'dependencies': [ 'preprocessor', 'angle_common' ],
'includes': [ '../gyp/common_defines.gypi', ],
......@@ -261,12 +263,6 @@
'.',
'../include',
],
'defines':
[
# define the static translator to indicate exported
# classes are (in fact) locally defined
'ANGLE_TRANSLATOR_STATIC',
],
'sources':
[
'<@(angle_translator_lib_sources)',
......@@ -336,50 +332,5 @@
}],
],
},
{
'target_name': 'translator',
'type': 'static_library',
'dependencies': [ 'translator_lib', 'angle_common' ],
'includes': [ '../gyp/common_defines.gypi', ],
'include_dirs':
[
'.',
'../include',
],
'defines':
[
'ANGLE_TRANSLATOR_STATIC',
],
'direct_dependent_settings':
{
'defines':
[
'ANGLE_TRANSLATOR_STATIC',
],
},
'sources':
[
'compiler/translator/ShaderLang.cpp',
'compiler/translator/ShaderVars.cpp'
],
'conditions':
[
['angle_enable_hlsl==1',
{
'defines':
[
'ANGLE_ENABLE_HLSL',
],
'direct_dependent_settings':
{
'defines':
[
'ANGLE_ENABLE_HLSL',
],
},
}],
],
},
],
}
......@@ -24,7 +24,7 @@ struct Uniform;
struct Varying;
struct InterfaceBlock;
struct COMPILER_EXPORT BlockMemberInfo
struct BlockMemberInfo
{
BlockMemberInfo() : offset(-1), arrayStride(-1), matrixStride(-1), isRowMajorMatrix(false) {}
......@@ -46,7 +46,7 @@ struct COMPILER_EXPORT BlockMemberInfo
bool isRowMajorMatrix;
};
class COMPILER_EXPORT BlockLayoutEncoder
class BlockLayoutEncoder
{
public:
BlockLayoutEncoder();
......@@ -77,7 +77,7 @@ class COMPILER_EXPORT BlockLayoutEncoder
// Block layout according to the std140 block layout
// See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
class COMPILER_EXPORT Std140BlockEncoder : public BlockLayoutEncoder
class Std140BlockEncoder : public BlockLayoutEncoder
{
public:
Std140BlockEncoder();
......
......@@ -24,7 +24,7 @@ namespace sh
// The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED
// for everything else (D3D10+ constant blocks and all attributes/varyings).
class COMPILER_EXPORT HLSLBlockEncoder : public BlockLayoutEncoder
class HLSLBlockEncoder : public BlockLayoutEncoder
{
public:
enum HLSLBlockEncoderStrategy
......@@ -54,9 +54,8 @@ class COMPILER_EXPORT HLSLBlockEncoder : public BlockLayoutEncoder
// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder
// class to count the number of used registers in a struct (which are individually packed according to the same rules).
COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Varying &variable, bool transposeMatrices);
COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
unsigned int HLSLVariableRegisterCount(const Varying &variable, bool transposeMatrices);
unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
}
#endif // COMMON_BLOCKLAYOUTHLSL_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