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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 9105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9116 AddExpectationsForActiveTexture(GL_TEXTURE1); | 9116 AddExpectationsForActiveTexture(GL_TEXTURE1); |
9117 AddExpectationsForBindTexture(GL_TEXTURE_2D, | 9117 AddExpectationsForBindTexture(GL_TEXTURE_2D, |
9118 TestHelper::kServiceDefaultTexture2dId); | 9118 TestHelper::kServiceDefaultTexture2dId); |
9119 | 9119 |
9120 // Expect to restore active texture unit to GL_TEXTURE0. | 9120 // Expect to restore active texture unit to GL_TEXTURE0. |
9121 AddExpectationsForActiveTexture(GL_TEXTURE0); | 9121 AddExpectationsForActiveTexture(GL_TEXTURE0); |
9122 | 9122 |
9123 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 9123 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
9124 } | 9124 } |
9125 | 9125 |
| 9126 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) { |
| 9127 InitDecoder("GL_OES_texture_float", // extensions |
| 9128 "opengl es 2.0", // gl version |
| 9129 false, // has alpha |
| 9130 false, // has depth |
| 9131 false, // has stencil |
| 9132 false, // request alpha |
| 9133 false, // request depth |
| 9134 false, // request stencil |
| 9135 false); // bind generates resource |
| 9136 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9137 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); |
| 9138 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); |
| 9139 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, |
| 9140 GL_FLOAT, 0, 0); |
| 9141 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, |
| 9142 0, 0); |
| 9143 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, |
| 9144 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); |
| 9145 } |
| 9146 |
| 9147 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatGLES3) { |
| 9148 InitDecoder("GL_OES_texture_float", // extensions |
| 9149 "opengl es 3.0", // gl version |
| 9150 false, // has alpha |
| 9151 false, // has depth |
| 9152 false, // has stencil |
| 9153 false, // request alpha |
| 9154 false, // request depth |
| 9155 false, // request stencil |
| 9156 false); // bind generates resource |
| 9157 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9158 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, |
| 9159 GL_RGBA, GL_FLOAT, 0, 0, GL_RGBA32F); |
| 9160 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, |
| 9161 GL_RGB, GL_FLOAT, 0, 0, GL_RGB32F); |
| 9162 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, |
| 9163 GL_FLOAT, 0, 0); |
| 9164 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, |
| 9165 0, 0); |
| 9166 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, |
| 9167 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); |
| 9168 } |
| 9169 |
| 9170 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) { |
| 9171 InitDecoder("GL_ARB_texture_float", // extensions |
| 9172 "2.1", // gl version |
| 9173 false, // has alpha |
| 9174 false, // has depth |
| 9175 false, // has stencil |
| 9176 false, // request alpha |
| 9177 false, // request depth |
| 9178 false, // request stencil |
| 9179 false); // bind generates resource |
| 9180 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9181 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, |
| 9182 GL_RGBA, GL_FLOAT, 0, 0, GL_RGBA32F_ARB); |
| 9183 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, |
| 9184 GL_RGB, GL_FLOAT, 0, 0, GL_RGB32F_ARB); |
| 9185 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, |
| 9186 GL_LUMINANCE, GL_FLOAT, 0, 0, |
| 9187 GL_LUMINANCE32F_ARB); |
| 9188 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, |
| 9189 GL_ALPHA, GL_FLOAT, 0, 0, GL_ALPHA32F_ARB); |
| 9190 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, |
| 9191 17, 0, GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, |
| 9192 GL_LUMINANCE_ALPHA32F_ARB); |
| 9193 } |
| 9194 |
| 9195 |
9126 // TODO(gman): Complete this test. | 9196 // TODO(gman): Complete this test. |
9127 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 9197 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
9128 // } | 9198 // } |
9129 | 9199 |
9130 // TODO(gman): BufferData | 9200 // TODO(gman): BufferData |
9131 | 9201 |
9132 // TODO(gman): BufferDataImmediate | 9202 // TODO(gman): BufferDataImmediate |
9133 | 9203 |
9134 // TODO(gman): BufferSubData | 9204 // TODO(gman): BufferSubData |
9135 | 9205 |
(...skipping 16 matching lines...) Expand all Loading... |
9152 // TODO(gman): TexImage2DImmediate | 9222 // TODO(gman): TexImage2DImmediate |
9153 | 9223 |
9154 // TODO(gman): TexSubImage2DImmediate | 9224 // TODO(gman): TexSubImage2DImmediate |
9155 | 9225 |
9156 // TODO(gman): UseProgram | 9226 // TODO(gman): UseProgram |
9157 | 9227 |
9158 // TODO(gman): SwapBuffers | 9228 // TODO(gman): SwapBuffers |
9159 | 9229 |
9160 } // namespace gles2 | 9230 } // namespace gles2 |
9161 } // namespace gpu | 9231 } // namespace gpu |
OLD | NEW |