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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 bool ShaderTranslator::Translate(const char* shader) { | 122 bool ShaderTranslator::Translate(const char* shader) { |
123 // Make sure this instance is initialized. | 123 // Make sure this instance is initialized. |
124 DCHECK(compiler_ != NULL); | 124 DCHECK(compiler_ != NULL); |
125 DCHECK(shader != NULL); | 125 DCHECK(shader != NULL); |
126 ClearResults(); | 126 ClearResults(); |
127 | 127 |
128 bool success = false; | 128 bool success = false; |
129 int compile_options = | 129 int compile_options = |
130 SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS | | 130 SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS | |
131 SH_MAP_LONG_VARIABLE_NAMES; | 131 SH_MAP_LONG_VARIABLE_NAMES | SH_ENFORCE_PACKING_RESTRICTIONS; |
132 | 132 |
133 #if !defined(OS_WIN) | 133 #if !defined(OS_WIN) |
134 // Cannot reliably clamp an array index in HLSL. | 134 // Cannot reliably clamp an array index in HLSL. |
135 // https://code.google.com/p/angleproject/issues/detail?id=399 | 135 // https://code.google.com/p/angleproject/issues/detail?id=399 |
136 compile_options |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS; | 136 compile_options |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS; |
137 #endif | 137 #endif |
138 | 138 |
139 if (needs_built_in_function_emulation_) | 139 if (needs_built_in_function_emulation_) |
140 compile_options |= SH_EMULATE_BUILT_IN_FUNCTIONS; | 140 compile_options |= SH_EMULATE_BUILT_IN_FUNCTIONS; |
141 if (ShCompile(compiler_, &shader, 1, compile_options)) { | 141 if (ShCompile(compiler_, &shader, 1, compile_options)) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void ShaderTranslator::ClearResults() { | 205 void ShaderTranslator::ClearResults() { |
206 translated_shader_.reset(); | 206 translated_shader_.reset(); |
207 info_log_.reset(); | 207 info_log_.reset(); |
208 attrib_map_.clear(); | 208 attrib_map_.clear(); |
209 uniform_map_.clear(); | 209 uniform_map_.clear(); |
210 } | 210 } |
211 | 211 |
212 } // namespace gles2 | 212 } // namespace gles2 |
213 } // namespace gpu | 213 } // namespace gpu |
214 | 214 |
OLD | NEW |