| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 << GLES2Util::GetStringShaderType(shadertype) << ", " | 1934 << GLES2Util::GetStringShaderType(shadertype) << ", " |
| 1935 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " | 1935 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " |
| 1936 << static_cast<const void*>(range) << ", " | 1936 << static_cast<const void*>(range) << ", " |
| 1937 << static_cast<const void*>(precision) << ", "); | 1937 << static_cast<const void*>(precision) << ", "); |
| 1938 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); | 1938 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); |
| 1939 typedef cmds::GetShaderPrecisionFormat::Result Result; | 1939 typedef cmds::GetShaderPrecisionFormat::Result Result; |
| 1940 Result* result = GetResultAs<Result*>(); | 1940 Result* result = GetResultAs<Result*>(); |
| 1941 if (!result) { | 1941 if (!result) { |
| 1942 return; | 1942 return; |
| 1943 } | 1943 } |
| 1944 result->success = false; | 1944 |
| 1945 helper_->GetShaderPrecisionFormat( | 1945 ShaderPrecisionCacheKey key(shadertype, precisiontype); |
| 1946 shadertype, precisiontype, GetResultShmId(), GetResultShmOffset()); | 1946 ShaderPrecisionCacheMap::iterator i = shader_precision_cache_.find(key); |
| 1947 WaitForCmd(); | 1947 if (i != shader_precision_cache_.end()) { |
| 1948 *result = i->second; |
| 1949 } else { |
| 1950 result->success = false; |
| 1951 helper_->GetShaderPrecisionFormat( |
| 1952 shadertype, precisiontype, GetResultShmId(), GetResultShmOffset()); |
| 1953 WaitForCmd(); |
| 1954 if (result->success) |
| 1955 shader_precision_cache_[key] = *result; |
| 1956 } |
| 1957 |
| 1948 if (result->success) { | 1958 if (result->success) { |
| 1949 if (range) { | 1959 if (range) { |
| 1950 range[0] = result->min_range; | 1960 range[0] = result->min_range; |
| 1951 range[1] = result->max_range; | 1961 range[1] = result->max_range; |
| 1952 GPU_CLIENT_LOG(" min_range: " << range[0]); | 1962 GPU_CLIENT_LOG(" min_range: " << range[0]); |
| 1953 GPU_CLIENT_LOG(" min_range: " << range[1]); | 1963 GPU_CLIENT_LOG(" min_range: " << range[1]); |
| 1954 } | 1964 } |
| 1955 if (precision) { | 1965 if (precision) { |
| 1956 precision[0] = result->precision; | 1966 precision[0] = result->precision; |
| 1957 GPU_CLIENT_LOG(" min_range: " << precision[0]); | 1967 GPU_CLIENT_LOG(" min_range: " << precision[0]); |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 return helper_->InsertSyncPointCHROMIUM(); | 3463 return helper_->InsertSyncPointCHROMIUM(); |
| 3454 } | 3464 } |
| 3455 | 3465 |
| 3456 // Include the auto-generated part of this file. We split this because it means | 3466 // Include the auto-generated part of this file. We split this because it means |
| 3457 // we can easily edit the non-auto generated parts right here in this file | 3467 // we can easily edit the non-auto generated parts right here in this file |
| 3458 // instead of having to edit some template or the code generator. | 3468 // instead of having to edit some template or the code generator. |
| 3459 #include "../client/gles2_implementation_impl_autogen.h" | 3469 #include "../client/gles2_implementation_impl_autogen.h" |
| 3460 | 3470 |
| 3461 } // namespace gles2 | 3471 } // namespace gles2 |
| 3462 } // namespace gpu | 3472 } // namespace gpu |
| OLD | NEW |