Commit 8b6587a7 by Geoff Lang

Use the type cache for the types used in the emulated GLSL functions.

BUG=angleproject:1044 Change-Id: I7c4bde80448b2cd64921b809a3a0dfb37c4e0f47 Reviewed-on: https://chromium-review.googlesource.com/286643Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent bf067eff
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "compiler/translator/BuiltInFunctionEmulator.h" #include "compiler/translator/BuiltInFunctionEmulator.h"
#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h" #include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
#include "compiler/translator/Cache.h"
#include "compiler/translator/SymbolTable.h" #include "compiler/translator/SymbolTable.h"
#include "compiler/translator/VersionGLSL.h" #include "compiler/translator/VersionGLSL.h"
...@@ -18,10 +19,10 @@ void InitBuiltInFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu, ...@@ -18,10 +19,10 @@ void InitBuiltInFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
// evaluated. This is unlikely to show up in real shaders, but is something to // evaluated. This is unlikely to show up in real shaders, but is something to
// consider. // consider.
TType *float1 = new TType(EbtFloat); const TType *float1 = TCache::getType(EbtFloat);
TType *float2 = new TType(EbtFloat, 2); const TType *float2 = TCache::getType(EbtFloat, 2);
TType *float3 = new TType(EbtFloat, 3); const TType *float3 = TCache::getType(EbtFloat, 3);
TType *float4 = new TType(EbtFloat, 4); const TType *float4 = TCache::getType(EbtFloat, 4);
if (shaderType == GL_FRAGMENT_SHADER) if (shaderType == GL_FRAGMENT_SHADER)
{ {
...@@ -44,8 +45,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator ...@@ -44,8 +45,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator
// Emulate packUnorm2x16 and unpackUnorm2x16 (GLSL 4.10) // Emulate packUnorm2x16 and unpackUnorm2x16 (GLSL 4.10)
if (targetGLSLVersion < GLSL_VERSION_410) if (targetGLSLVersion < GLSL_VERSION_410)
{ {
TType *float2 = new TType(EbtFloat, 2); const TType *float2 = TCache::getType(EbtFloat, 2);
TType *uint1 = new TType(EbtUInt); const TType *uint1 = TCache::getType(EbtUInt);
emu->addEmulatedFunction(EOpPackUnorm2x16, float2, emu->addEmulatedFunction(EOpPackUnorm2x16, float2,
"uint webgl_packUnorm2x16_emu(vec2 v)\n" "uint webgl_packUnorm2x16_emu(vec2 v)\n"
...@@ -68,8 +69,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator ...@@ -68,8 +69,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator
// by using floatBitsToInt, floatBitsToUint, intBitsToFloat, and uintBitsToFloat (GLSL 3.30). // by using floatBitsToInt, floatBitsToUint, intBitsToFloat, and uintBitsToFloat (GLSL 3.30).
if (targetGLSLVersion >= GLSL_VERSION_330 && targetGLSLVersion < GLSL_VERSION_420) if (targetGLSLVersion >= GLSL_VERSION_330 && targetGLSLVersion < GLSL_VERSION_420)
{ {
TType *float2 = new TType(EbtFloat, 2); const TType *float2 = TCache::getType(EbtFloat, 2);
TType *uint1 = new TType(EbtUInt); const TType *uint1 = TCache::getType(EbtUInt);
emu->addEmulatedFunction(EOpPackSnorm2x16, float2, emu->addEmulatedFunction(EOpPackSnorm2x16, float2,
"uint webgl_packSnorm2x16_emu(vec2 v)\n" "uint webgl_packSnorm2x16_emu(vec2 v)\n"
......
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