Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc

Issue 2264253003: Command buffers: ensure we only read immediate data once (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep track of the correct draw buffer Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 cmd.Init(kUniform4FakeLocation, 2); 1792 cmd.Init(kUniform4FakeLocation, 2);
1793 decoder_->set_unsafe_es3_apis_enabled(true); 1793 decoder_->set_unsafe_es3_apis_enabled(true);
1794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1795 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1795 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1796 decoder_->set_unsafe_es3_apis_enabled(false); 1796 decoder_->set_unsafe_es3_apis_enabled(false);
1797 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 1797 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1798 } 1798 }
1799 1799
1800 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivImmediateValidArgs) { 1800 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivImmediateValidArgs) {
1801 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>(); 1801 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>();
1802 EXPECT_CALL(*gl_, 1802 GLint temp[1] = {
1803 Uniform1iv(kUniform1RealLocation,
1804 1,
1805 reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
1806 GLint temp[1 * 2] = {
1807 0, 1803 0,
1808 }; 1804 };
1805 EXPECT_CALL(*gl_,
1806 Uniform1iv(kUniform1RealLocation, 1, PointsToArray(temp, 1)));
1809 cmd.Init(kUniform1FakeLocation, 1, &temp[0]); 1807 cmd.Init(kUniform1FakeLocation, 1, &temp[0]);
1810 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1808 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1811 } 1809 }
1812 1810
1813 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivImmediateInvalidValidArgs) { 1811 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivImmediateInvalidValidArgs) {
1814 EXPECT_CALL(*gl_, Uniform1iv(_, _, _)).Times(0); 1812 EXPECT_CALL(*gl_, Uniform1iv(_, _, _)).Times(0);
1815 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>(); 1813 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>();
1816 GLint temp[1 * 2] = { 1814 GLint temp[1 * 2] = {
1817 0, 1815 0,
1818 }; 1816 };
(...skipping 21 matching lines...) Expand all
1840 1838
1841 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivSamplerIsLimited) { 1839 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivSamplerIsLimited) {
1842 EXPECT_CALL(*gl_, Uniform1iv(_, _, _)).Times(0); 1840 EXPECT_CALL(*gl_, Uniform1iv(_, _, _)).Times(0);
1843 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>(); 1841 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>();
1844 GLint temp[] = {kNumTextureUnits}; 1842 GLint temp[] = {kNumTextureUnits};
1845 cmd.Init(kUniform1FakeLocation, 1, &temp[0]); 1843 cmd.Init(kUniform1FakeLocation, 1, &temp[0]);
1846 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1844 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1847 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1845 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1848 } 1846 }
1849 1847
1848 TEST_P(GLES2DecoderWithShaderTest, Uniform1ivArray) {
1849 Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>();
1850 GLint temp[3] = {
1851 0, 1, 2,
1852 };
1853 EXPECT_CALL(*gl_,
1854 Uniform1iv(kUniform8RealLocation, 2, PointsToArray(temp, 2)));
1855 cmd.Init(kUniform8FakeLocation, 2, &temp[0]);
1856 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1857 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1858
1859 EXPECT_CALL(*gl_,
1860 Uniform1iv(kUniform8RealLocation, 2, PointsToArray(temp, 2)));
1861 cmd.Init(kUniform8FakeLocation, 3, &temp[0]);
1862 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1863 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1864 }
1865
1866
1850 TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateValidArgs) { 1867 TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateValidArgs) {
1851 Uniform1uivImmediate& cmd = 1868 Uniform1uivImmediate& cmd =
1852 *GetImmediateAs<Uniform1uivImmediate>(); 1869 *GetImmediateAs<Uniform1uivImmediate>();
1853 EXPECT_CALL( 1870 GLuint temp[1] = {
1854 *gl_,
1855 Uniform1uiv(kUniform4RealLocation, 1,
1856 reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1857 GLuint temp[1 * 2] = {
1858 0, 1871 0,
1859 }; 1872 };
1873 EXPECT_CALL(*gl_,
1874 Uniform1uiv(kUniform4RealLocation, 1, PointsToArray(temp, 1)));
1860 cmd.Init(kUniform4FakeLocation, 1, &temp[0]); 1875 cmd.Init(kUniform4FakeLocation, 1, &temp[0]);
1861 decoder_->set_unsafe_es3_apis_enabled(true); 1876 decoder_->set_unsafe_es3_apis_enabled(true);
1862 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1877 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1863 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1878 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1864 decoder_->set_unsafe_es3_apis_enabled(false); 1879 decoder_->set_unsafe_es3_apis_enabled(false);
1865 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); 1880 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1866 } 1881 }
1867 1882
1868 TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateInvalidType) { 1883 TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateInvalidType) {
1869 EXPECT_CALL(*gl_, Uniform1uiv(_, _, _)).Times(0); 1884 EXPECT_CALL(*gl_, Uniform1uiv(_, _, _)).Times(0);
(...skipping 25 matching lines...) Expand all
1895 decoder_->set_unsafe_es3_apis_enabled(true); 1910 decoder_->set_unsafe_es3_apis_enabled(true);
1896 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1911 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1897 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1912 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1898 decoder_->set_unsafe_es3_apis_enabled(false); 1913 decoder_->set_unsafe_es3_apis_enabled(false);
1899 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 1914 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1900 } 1915 }
1901 1916
1902 TEST_P(GLES2DecoderWithShaderTest, Uniform2uivImmediateValidArgs) { 1917 TEST_P(GLES2DecoderWithShaderTest, Uniform2uivImmediateValidArgs) {
1903 Uniform2uivImmediate& cmd = 1918 Uniform2uivImmediate& cmd =
1904 *GetImmediateAs<Uniform2uivImmediate>(); 1919 *GetImmediateAs<Uniform2uivImmediate>();
1905 EXPECT_CALL(
1906 *gl_,
1907 Uniform2uiv(kUniform5RealLocation, 1,
1908 reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1909 GLuint temp[2 * 1] = { 1920 GLuint temp[2 * 1] = {
1910 0, 1921 0,
1911 }; 1922 };
1923 EXPECT_CALL(*gl_,
1924 Uniform2uiv(kUniform5RealLocation, 1, PointsToArray(temp, 2)));
1912 cmd.Init(kUniform5FakeLocation, 1, &temp[0]); 1925 cmd.Init(kUniform5FakeLocation, 1, &temp[0]);
1913 decoder_->set_unsafe_es3_apis_enabled(true); 1926 decoder_->set_unsafe_es3_apis_enabled(true);
1914 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1927 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1915 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1928 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1916 decoder_->set_unsafe_es3_apis_enabled(false); 1929 decoder_->set_unsafe_es3_apis_enabled(false);
1917 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); 1930 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1918 } 1931 }
1919 1932
1920 TEST_P(GLES2DecoderWithShaderTest, Uniform3uiValidArgs) { 1933 TEST_P(GLES2DecoderWithShaderTest, Uniform3uiValidArgs) {
1921 EXPECT_CALL(*gl_, Uniform3uiv(kUniform6RealLocation, 1, _)); 1934 EXPECT_CALL(*gl_, Uniform3uiv(kUniform6RealLocation, 1, _));
1922 Uniform3ui cmd; 1935 Uniform3ui cmd;
1923 cmd.Init(kUniform6FakeLocation, 2, 3, 4); 1936 cmd.Init(kUniform6FakeLocation, 2, 3, 4);
1924 decoder_->set_unsafe_es3_apis_enabled(true); 1937 decoder_->set_unsafe_es3_apis_enabled(true);
1925 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1938 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1926 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1939 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1927 decoder_->set_unsafe_es3_apis_enabled(false); 1940 decoder_->set_unsafe_es3_apis_enabled(false);
1928 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 1941 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1929 } 1942 }
1930 1943
1931 TEST_P(GLES2DecoderWithShaderTest, Uniform3uivImmediateValidArgs) { 1944 TEST_P(GLES2DecoderWithShaderTest, Uniform3uivImmediateValidArgs) {
1932 Uniform3uivImmediate& cmd = 1945 Uniform3uivImmediate& cmd =
1933 *GetImmediateAs<Uniform3uivImmediate>(); 1946 *GetImmediateAs<Uniform3uivImmediate>();
1934 EXPECT_CALL(
1935 *gl_,
1936 Uniform3uiv(kUniform6RealLocation, 1,
1937 reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1938 GLuint temp[3 * 1] = { 1947 GLuint temp[3 * 1] = {
1939 0, 1948 0,
1940 }; 1949 };
1950 EXPECT_CALL(*gl_,
1951 Uniform3uiv(kUniform6RealLocation, 1, PointsToArray(temp, 3)));
1941 cmd.Init(kUniform6FakeLocation, 1, &temp[0]); 1952 cmd.Init(kUniform6FakeLocation, 1, &temp[0]);
1942 decoder_->set_unsafe_es3_apis_enabled(true); 1953 decoder_->set_unsafe_es3_apis_enabled(true);
1943 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1954 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1944 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1955 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1945 decoder_->set_unsafe_es3_apis_enabled(false); 1956 decoder_->set_unsafe_es3_apis_enabled(false);
1946 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); 1957 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1947 } 1958 }
1948 1959
1949 TEST_P(GLES2DecoderWithShaderTest, Uniform4uiValidArgs) { 1960 TEST_P(GLES2DecoderWithShaderTest, Uniform4uiValidArgs) {
1950 EXPECT_CALL(*gl_, Uniform4uiv(kUniform7RealLocation, 1, _)); 1961 EXPECT_CALL(*gl_, Uniform4uiv(kUniform7RealLocation, 1, _));
1951 Uniform4ui cmd; 1962 Uniform4ui cmd;
1952 cmd.Init(kUniform7FakeLocation, 2, 3, 4, 5); 1963 cmd.Init(kUniform7FakeLocation, 2, 3, 4, 5);
1953 decoder_->set_unsafe_es3_apis_enabled(true); 1964 decoder_->set_unsafe_es3_apis_enabled(true);
1954 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1965 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1955 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1966 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1956 decoder_->set_unsafe_es3_apis_enabled(false); 1967 decoder_->set_unsafe_es3_apis_enabled(false);
1957 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 1968 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1958 } 1969 }
1959 1970
1960 TEST_P(GLES2DecoderWithShaderTest, Uniform4uivImmediateValidArgs) { 1971 TEST_P(GLES2DecoderWithShaderTest, Uniform4uivImmediateValidArgs) {
1961 Uniform4uivImmediate& cmd = 1972 Uniform4uivImmediate& cmd =
1962 *GetImmediateAs<Uniform4uivImmediate>(); 1973 *GetImmediateAs<Uniform4uivImmediate>();
1963 EXPECT_CALL(
1964 *gl_,
1965 Uniform4uiv(kUniform7RealLocation, 1,
1966 reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
1967 GLuint temp[4 * 1] = { 1974 GLuint temp[4 * 1] = {
1968 0, 1975 0,
1969 }; 1976 };
1977 EXPECT_CALL(*gl_,
1978 Uniform4uiv(kUniform7RealLocation, 1, PointsToArray(temp, 4)));
1970 cmd.Init(kUniform7FakeLocation, 1, &temp[0]); 1979 cmd.Init(kUniform7FakeLocation, 1, &temp[0]);
1971 decoder_->set_unsafe_es3_apis_enabled(true); 1980 decoder_->set_unsafe_es3_apis_enabled(true);
1972 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 1981 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
1973 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1982 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1974 decoder_->set_unsafe_es3_apis_enabled(false); 1983 decoder_->set_unsafe_es3_apis_enabled(false);
1975 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp))); 1984 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
1976 } 1985 }
1977 1986
1978 TEST_P(GLES2DecoderTest, BindAttribLocationBucket) { 1987 TEST_P(GLES2DecoderTest, BindAttribLocationBucket) {
1979 const uint32_t kBucketId = 123; 1988 const uint32_t kBucketId = 123;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 } 2356 }
2348 2357
2349 // TODO(gman): DeleteProgram 2358 // TODO(gman): DeleteProgram
2350 2359
2351 // TODO(gman): UseProgram 2360 // TODO(gman): UseProgram
2352 2361
2353 // TODO(gman): DeleteShader 2362 // TODO(gman): DeleteShader
2354 2363
2355 } // namespace gles2 2364 } // namespace gles2
2356 } // namespace gpu 2365 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698