| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/shader_translator.h" | 5 #include "gpu/command_buffer/service/shader_translator.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 ShGetInfoLog(compiler_, info_log_.get()); | 196 ShGetInfoLog(compiler_, info_log_.get()); |
| 197 } else { | 197 } else { |
| 198 info_log_.reset(); | 198 info_log_.reset(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 return success; | 201 return success; |
| 202 } | 202 } |
| 203 | 203 |
| 204 std::string ShaderTranslator::GetStringForOptionsThatWouldEffectCompilation() | 204 std::string ShaderTranslator::GetStringForOptionsThatWouldEffectCompilation() |
| 205 const { | 205 const { |
| 206 | 206 #if ANGLE_SH_VERSION >= 124 |
| 207 #if ANGLE_SH_VERSION >= 123 | 207 const size_t kNumIntFields = 23; |
| 208 #elif ANGLE_SH_VERSION >= 123 |
| 208 const size_t kNumIntFields = 21; | 209 const size_t kNumIntFields = 21; |
| 209 #elif ANGLE_SH_VERSION >= 122 | 210 #elif ANGLE_SH_VERSION >= 122 |
| 210 const size_t kNumIntFields = 20; | 211 const size_t kNumIntFields = 20; |
| 211 #else | 212 #else |
| 212 const size_t kNumIntFields = 16; | 213 const size_t kNumIntFields = 18; |
| 213 #endif | 214 #endif |
| 214 const size_t kNumEnumFields = 1; | 215 const size_t kNumEnumFields = 1; |
| 215 const size_t kNumFunctionPointerFields = 1; | 216 const size_t kNumFunctionPointerFields = 1; |
| 216 struct MustMatchShBuiltInResource { | 217 struct MustMatchShBuiltInResource { |
| 217 typedef khronos_uint64_t (*FunctionPointer)(const char*, size_t); | 218 typedef khronos_uint64_t (*FunctionPointer)(const char*, size_t); |
| 218 enum Enum { | 219 enum Enum { |
| 219 kFirst, | 220 kFirst, |
| 220 }; | 221 }; |
| 221 int int_fields[kNumIntFields]; | 222 int int_fields[kNumIntFields]; |
| 222 FunctionPointer pointer_fields[kNumFunctionPointerFields]; | 223 FunctionPointer pointer_fields[kNumFunctionPointerFields]; |
| 223 Enum enum_fields[kNumEnumFields]; | 224 Enum enum_fields[kNumEnumFields]; |
| 224 }; | 225 }; |
| 225 // If this assert fails most likely that means something below needs updating. | 226 // If this assert fails most likely that means something below needs updating. |
| 226 COMPILE_ASSERT( | 227 COMPILE_ASSERT( |
| 227 sizeof(ShBuiltInResources) == sizeof(MustMatchShBuiltInResource), | 228 sizeof(ShBuiltInResources) == sizeof(MustMatchShBuiltInResource), |
| 228 Fields_Have_Changed_In_ShBuiltInResource_So_Update_Below); | 229 Fields_Have_Changed_In_ShBuiltInResource_So_Update_Below); |
| 229 | 230 |
| 230 return std::string( | 231 return std::string( |
| 231 ":CompileOptions:" + | 232 ":CompileOptions:" + base::IntToString(GetCompileOptions()) + |
| 232 base::IntToString(GetCompileOptions()) + | |
| 233 ":MaxVertexAttribs:" + | 233 ":MaxVertexAttribs:" + |
| 234 base::IntToString(compiler_options_.MaxVertexAttribs) + | 234 base::IntToString(compiler_options_.MaxVertexAttribs) + |
| 235 ":MaxVertexUniformVectors:" + | 235 ":MaxVertexUniformVectors:" + |
| 236 base::IntToString(compiler_options_.MaxVertexUniformVectors) + | 236 base::IntToString(compiler_options_.MaxVertexUniformVectors) + |
| 237 ":MaxVaryingVectors:" + | 237 ":MaxVaryingVectors:" + |
| 238 base::IntToString(compiler_options_.MaxVaryingVectors) + | 238 base::IntToString(compiler_options_.MaxVaryingVectors) + |
| 239 ":MaxVertexTextureImageUnits:" + | 239 ":MaxVertexTextureImageUnits:" + |
| 240 base::IntToString(compiler_options_.MaxVertexTextureImageUnits) + | 240 base::IntToString(compiler_options_.MaxVertexTextureImageUnits) + |
| 241 ":MaxCombinedTextureImageUnits:" + | 241 ":MaxCombinedTextureImageUnits:" + |
| 242 base::IntToString(compiler_options_.MaxCombinedTextureImageUnits) + | 242 base::IntToString(compiler_options_.MaxCombinedTextureImageUnits) + |
| 243 ":MaxTextureImageUnits:" + | 243 ":MaxTextureImageUnits:" + |
| 244 base::IntToString(compiler_options_.MaxTextureImageUnits) + | 244 base::IntToString(compiler_options_.MaxTextureImageUnits) + |
| 245 ":MaxFragmentUniformVectors:" + | 245 ":MaxFragmentUniformVectors:" + |
| 246 base::IntToString(compiler_options_.MaxFragmentUniformVectors) + | 246 base::IntToString(compiler_options_.MaxFragmentUniformVectors) + |
| 247 ":MaxDrawBuffers:" + | 247 ":MaxDrawBuffers:" + base::IntToString(compiler_options_.MaxDrawBuffers) + |
| 248 base::IntToString(compiler_options_.MaxDrawBuffers) + | 248 ":MaxTextureCoords:" + |
| 249 base::IntToString(compiler_options_.MaxTextureCoords) + |
| 249 ":OES_standard_derivatives:" + | 250 ":OES_standard_derivatives:" + |
| 250 base::IntToString(compiler_options_.OES_standard_derivatives) + | 251 base::IntToString(compiler_options_.OES_standard_derivatives) + |
| 251 ":OES_EGL_image_external:" + | 252 ":OES_EGL_image_external:" + |
| 252 base::IntToString(compiler_options_.OES_EGL_image_external) + | 253 base::IntToString(compiler_options_.OES_EGL_image_external) + |
| 253 ":ARB_texture_rectangle:" + | 254 ":ARB_texture_rectangle:" + |
| 254 base::IntToString(compiler_options_.ARB_texture_rectangle) + | 255 base::IntToString(compiler_options_.ARB_texture_rectangle) + |
| 255 ":EXT_draw_buffers:" + | 256 ":EXT_draw_buffers:" + |
| 256 base::IntToString(compiler_options_.EXT_draw_buffers) + | 257 base::IntToString(compiler_options_.EXT_draw_buffers) + |
| 257 ":FragmentPrecisionHigh:" + | 258 ":FragmentPrecisionHigh:" + |
| 258 base::IntToString(compiler_options_.FragmentPrecisionHigh) + | 259 base::IntToString(compiler_options_.FragmentPrecisionHigh) + |
| 259 ":MaxExpressionComplexity:" + | 260 ":MaxExpressionComplexity:" + |
| 260 base::IntToString(compiler_options_.MaxExpressionComplexity) + | 261 base::IntToString(compiler_options_.MaxExpressionComplexity) + |
| 261 ":MaxCallStackDepth:" + | 262 ":MaxCallStackDepth:" + |
| 262 base::IntToString(compiler_options_.MaxCallStackDepth) + | 263 base::IntToString(compiler_options_.MaxCallStackDepth) + |
| 263 ":EXT_frag_depth:" + | 264 ":EXT_frag_depth:" + |
| 264 #if ANGLE_SH_VERSION >= 122 | 265 #if ANGLE_SH_VERSION >= 122 |
| 265 base::IntToString(compiler_options_.EXT_frag_depth) + | 266 base::IntToString(compiler_options_.EXT_frag_depth) + |
| 266 #if ANGLE_SH_VERSION >= 123 | 267 #if ANGLE_SH_VERSION >= 123 |
| 267 ":EXT_shader_texture_lod:" + | 268 ":EXT_shader_texture_lod:" + |
| 268 base::IntToString(compiler_options_.EXT_shader_texture_lod) + | 269 base::IntToString(compiler_options_.EXT_shader_texture_lod) + |
| 270 #if ANGLE_SH_VERSION >= 124 |
| 271 ":CHROMIUM_path_rendering:" + |
| 272 base::IntToString(compiler_options_.CHROMIUM_path_rendering) + |
| 273 #endif |
| 269 #endif | 274 #endif |
| 270 ":MaxVertexOutputVectors:" + | 275 ":MaxVertexOutputVectors:" + |
| 271 base::IntToString(compiler_options_.MaxVertexOutputVectors) + | 276 base::IntToString(compiler_options_.MaxVertexOutputVectors) + |
| 272 ":MaxFragmentInputVectors:" + | 277 ":MaxFragmentInputVectors:" + |
| 273 base::IntToString(compiler_options_.MaxFragmentInputVectors) + | 278 base::IntToString(compiler_options_.MaxFragmentInputVectors) + |
| 274 ":MinProgramTexelOffset:" + | 279 ":MinProgramTexelOffset:" + |
| 275 base::IntToString(compiler_options_.MinProgramTexelOffset) + | 280 base::IntToString(compiler_options_.MinProgramTexelOffset) + |
| 276 ":MaxProgramTexelOffset:" + | 281 ":MaxProgramTexelOffset:" + |
| 277 base::IntToString(compiler_options_.MaxProgramTexelOffset)); | 282 base::IntToString(compiler_options_.MaxProgramTexelOffset)); |
| 278 #else // ANGLE_SH_VERSION < 122 | 283 #else // ANGLE_SH_VERSION < 122 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 info_log_.reset(); | 337 info_log_.reset(); |
| 333 attrib_map_.clear(); | 338 attrib_map_.clear(); |
| 334 uniform_map_.clear(); | 339 uniform_map_.clear(); |
| 335 varying_map_.clear(); | 340 varying_map_.clear(); |
| 336 name_map_.clear(); | 341 name_map_.clear(); |
| 337 } | 342 } |
| 338 | 343 |
| 339 } // namespace gles2 | 344 } // namespace gles2 |
| 340 } // namespace gpu | 345 } // namespace gpu |
| 341 | 346 |
| OLD | NEW |