Commit 9e0478f6 by Jamie Madill

Move the block layout code to translator.

This code is easily accessible from the translator, with the proper export calls. This facilitates adding a common static library, since this code calls some methods in translator. BUG=angle:773 Change-Id: I0c50098ec3f67c2df7749b3c2518be0a9fd939e2 Reviewed-on: https://chromium-review.googlesource.com/240093Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 2c7ea058
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
'../include/angle_gl.h', '../include/angle_gl.h',
'common/angleutils.h', 'common/angleutils.h',
'common/angleutils.cpp', 'common/angleutils.cpp',
'common/blocklayout.cpp',
'common/blocklayout.h',
'common/debug.cpp', 'common/debug.cpp',
'common/debug.h', 'common/debug.h',
'common/event_tracer.cpp', 'common/event_tracer.cpp',
...@@ -138,6 +136,8 @@ ...@@ -138,6 +136,8 @@
'compiler/translator/VariablePacker.h', 'compiler/translator/VariablePacker.h',
'compiler/translator/VersionGLSL.cpp', 'compiler/translator/VersionGLSL.cpp',
'compiler/translator/VersionGLSL.h', 'compiler/translator/VersionGLSL.h',
'compiler/translator/blocklayout.cpp',
'compiler/translator/blocklayout.h',
'compiler/translator/compilerdebug.cpp', 'compiler/translator/compilerdebug.cpp',
'compiler/translator/compilerdebug.h', 'compiler/translator/compilerdebug.h',
'compiler/translator/depgraph/DependencyGraph.cpp', 'compiler/translator/depgraph/DependencyGraph.cpp',
......
...@@ -6,27 +6,27 @@ ...@@ -6,27 +6,27 @@
#include "compiler/translator/OutputHLSL.h" #include "compiler/translator/OutputHLSL.h"
#include <algorithm>
#include <cfloat>
#include <stdio.h>
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "common/blocklayout.h"
#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h" #include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
#include "compiler/translator/compilerdebug.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/DetectDiscontinuity.h" #include "compiler/translator/DetectDiscontinuity.h"
#include "compiler/translator/SearchSymbol.h"
#include "compiler/translator/UnfoldShortCircuit.h"
#include "compiler/translator/FlagStd140Structs.h" #include "compiler/translator/FlagStd140Structs.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/NodeSearch.h" #include "compiler/translator/NodeSearch.h"
#include "compiler/translator/RewriteElseBlocks.h" #include "compiler/translator/RewriteElseBlocks.h"
#include "compiler/translator/UtilsHLSL.h" #include "compiler/translator/SearchSymbol.h"
#include "compiler/translator/util.h"
#include "compiler/translator/UniformHLSL.h"
#include "compiler/translator/StructureHLSL.h" #include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/TranslatorHLSL.h" #include "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/UnfoldShortCircuit.h"
#include <algorithm> #include "compiler/translator/UniformHLSL.h"
#include <cfloat> #include "compiler/translator/UtilsHLSL.h"
#include <stdio.h> #include "compiler/translator/blocklayout.h"
#include "compiler/translator/compilerdebug.h"
#include "compiler/translator/util.h"
namespace sh namespace sh
{ {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <map> #include <map>
#include "angle_gl.h" #include "angle_gl.h"
#include "compiler/translator/IntermNode.h" #include "compiler/translator/IntermNode.h"
#include "compiler/translator/ParseContext.h" #include "compiler/translator/ParseContext.h"
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
// Methods for GLSL to HLSL translation for uniforms and interface blocks. // Methods for GLSL to HLSL translation for uniforms and interface blocks.
// //
#include "OutputHLSL.h"
#include "common/blocklayout.h"
#include "common/utilities.h"
#include "compiler/translator/UniformHLSL.h" #include "compiler/translator/UniformHLSL.h"
#include "common/utilities.h"
#include "compiler/translator/StructureHLSL.h" #include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/util.h"
#include "compiler/translator/UtilsHLSL.h"
#include "compiler/translator/TranslatorHLSL.h" #include "compiler/translator/TranslatorHLSL.h"
#include "compiler/translator/UtilsHLSL.h"
#include "compiler/translator/blocklayout.h"
#include "compiler/translator/util.h"
namespace sh namespace sh
{ {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_ #ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_
#define COMPILER_TRANSLATOR_UNIFORMHLSL_H_ #define COMPILER_TRANSLATOR_UNIFORMHLSL_H_
#include "compiler/translator/Types.h" #include "compiler/translator/OutputHLSL.h"
namespace sh namespace sh
{ {
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// Implementation for block layout classes and methods. // Implementation for block layout classes and methods.
// //
#include "common/blocklayout.h" #include "compiler/translator/blocklayout.h"
#include "common/mathutil.h" #include "common/mathutil.h"
#include "common/utilities.h" #include "common/utilities.h"
......
...@@ -24,7 +24,7 @@ struct Uniform; ...@@ -24,7 +24,7 @@ struct Uniform;
struct Varying; struct Varying;
struct InterfaceBlock; struct InterfaceBlock;
struct BlockMemberInfo struct COMPILER_EXPORT BlockMemberInfo
{ {
BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix) BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
: offset(offset), : offset(offset),
...@@ -44,7 +44,7 @@ struct BlockMemberInfo ...@@ -44,7 +44,7 @@ struct BlockMemberInfo
bool isRowMajorMatrix; bool isRowMajorMatrix;
}; };
class BlockLayoutEncoder class COMPILER_EXPORT BlockLayoutEncoder
{ {
public: public:
BlockLayoutEncoder(); BlockLayoutEncoder();
...@@ -73,7 +73,7 @@ class BlockLayoutEncoder ...@@ -73,7 +73,7 @@ class BlockLayoutEncoder
// Block layout according to the std140 block layout // 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 // See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
class Std140BlockEncoder : public BlockLayoutEncoder class COMPILER_EXPORT Std140BlockEncoder : public BlockLayoutEncoder
{ {
public: public:
Std140BlockEncoder(); Std140BlockEncoder();
...@@ -91,7 +91,7 @@ class Std140BlockEncoder : public BlockLayoutEncoder ...@@ -91,7 +91,7 @@ class Std140BlockEncoder : public BlockLayoutEncoder
// The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED // The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED
// for everything else (D3D10+ constant blocks and all attributes/varyings). // for everything else (D3D10+ constant blocks and all attributes/varyings).
class HLSLBlockEncoder : public BlockLayoutEncoder class COMPILER_EXPORT HLSLBlockEncoder : public BlockLayoutEncoder
{ {
public: public:
enum HLSLBlockEncoderStrategy enum HLSLBlockEncoderStrategy
...@@ -119,8 +119,8 @@ class HLSLBlockEncoder : public BlockLayoutEncoder ...@@ -119,8 +119,8 @@ class HLSLBlockEncoder : public BlockLayoutEncoder
// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder // 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). // class to count the number of used registers in a struct (which are individually packed according to the same rules).
unsigned int HLSLVariableRegisterCount(const Varying &variable); COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Varying &variable);
unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType); COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
} }
......
...@@ -9,20 +9,19 @@ ...@@ -9,20 +9,19 @@
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include <algorithm>
#include "common/debug.h"
#include "common/platform.h"
#include "common/utilities.h"
#include "common/version.h"
#include "compiler/translator/blocklayout.h"
#include "libANGLE/Data.h" #include "libANGLE/Data.h"
#include "libANGLE/ResourceManager.h" #include "libANGLE/ResourceManager.h"
#include "libANGLE/features.h" #include "libANGLE/features.h"
#include "libANGLE/renderer/Renderer.h" #include "libANGLE/renderer/Renderer.h"
#include "libANGLE/renderer/ProgramImpl.h" #include "libANGLE/renderer/ProgramImpl.h"
#include "common/debug.h"
#include "common/version.h"
#include "common/utilities.h"
#include "common/platform.h"
#include "common/blocklayout.h"
#include <algorithm>
namespace gl namespace gl
{ {
const char * const g_fakepath = "C:\\fakepath"; const char * const g_fakepath = "C:\\fakepath";
......
...@@ -7,16 +7,14 @@ ...@@ -7,16 +7,14 @@
#ifndef LIBANGLE_UNIFORM_H_ #ifndef LIBANGLE_UNIFORM_H_
#define LIBANGLE_UNIFORM_H_ #define LIBANGLE_UNIFORM_H_
#include "common/debug.h"
#include "libANGLE/angletypes.h"
#include "common/blocklayout.h"
#include "angle_gl.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include "angle_gl.h"
#include "common/debug.h"
#include "compiler/translator/blocklayout.h"
#include "libANGLE/angletypes.h"
namespace gl namespace gl
{ {
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
// //
#include "libANGLE/renderer/d3d/DynamicHLSL.h" #include "libANGLE/renderer/d3d/DynamicHLSL.h"
#include "common/utilities.h"
#include "compiler/translator/blocklayout.h"
#include "libANGLE/renderer/d3d/ShaderD3D.h" #include "libANGLE/renderer/d3d/ShaderD3D.h"
#include "libANGLE/renderer/d3d/RendererD3D.h" #include "libANGLE/renderer/d3d/RendererD3D.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/Shader.h" #include "libANGLE/Shader.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "common/utilities.h"
#include "common/blocklayout.h"
// For use with ArrayString, see angleutils.h // For use with ArrayString, see angleutils.h
META_ASSERT(GL_INVALID_INDEX == UINT_MAX); META_ASSERT(GL_INVALID_INDEX == UINT_MAX);
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
[ [
'common/angleutils.cpp', 'common/angleutils.cpp',
'common/angleutils.h', 'common/angleutils.h',
'common/blocklayout.cpp',
'common/blocklayout.h',
'common/debug.cpp', 'common/debug.cpp',
'common/debug.h', 'common/debug.h',
'common/mathutil.cpp', 'common/mathutil.cpp',
......
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