Lines Matching defs:vec4
53 typedef Vec4 vec4;
71 g_color_eps = vec4(1.f / (1 << 13));
92 vec4 g_color_eps;
241 inline bool ColorEqual(const vec4& c0, const vec4& c1, const vec4& epsilon)
254 inline bool ColorEqual(const vec3& c0, const vec3& c1, const vec4& epsilon)
265 bool ValidateReadBuffer(int x, int y, int w, int h, const vec4& expected)
267 std::vector<vec4> display(w * h);
273 display[i / 4] = vec4(static_cast<GLfloat>(data[i] / 255.), static_cast<GLfloat>(data[i + 1] / 255.),
466 bool IsEqual(vec4 a, vec4 b)
510 NL "layout(local_size_x = 1, local_size_y = 1) in;" NL "layout(std430) buffer Output {" NL " vec4 data;" NL
511 "} g_out;" NL "void main() {" NL " g_out.data = vec4(1.0, 2.0, 3.0, 4.0);" NL "}";
529 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4), NULL, GL_DYNAMIC_DRAW);
540 vec4* data;
543 data = static_cast<vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4), GL_MAP_READ_BIT));
545 if (!IsEqual(data[0], vec4(1.0f, 2.0f, 3.0f, 4.0f)))
1104 << ");" NL "layout(std140) uniform InputBuffer {" NL " vec4 data["
1106 << "];" NL "} g_in_buffer[12];" NL "layout(std430) buffer OutputBuffer {" NL " vec4 data0["
1107 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data1["
1108 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data2["
1109 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data3["
1110 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data4["
1111 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data5["
1112 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data6["
1113 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data7["
1114 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data8["
1115 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data9["
1116 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data10["
1117 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data11["
1160 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4) * kBufferSize * 12, NULL, GL_DYNAMIC_DRAW);
1167 std::vector<vec4> data(kBufferSize);
1170 data[j] = vec4(static_cast<float>(i) * static_cast<float>(kBufferSize) + static_cast<float>(j));
1173 glBufferData(GL_UNIFORM_BUFFER, sizeof(vec4) * kBufferSize, &data[0], GL_DYNAMIC_DRAW);
1191 vec4* data;
1194 data = static_cast<vec4*>(
1195 glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4) * 12 * kBufferSize, GL_MAP_READ_BIT));
1208 if (!IsEqual(data[index * 12 + i], vec4(static_cast<float>(index * 12 + i))))
1293 "uniform mediump sampler2DArray g_sampler2;" NL "layout(std430) buffer OutputBuffer {" NL " vec4 data0["
1294 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data1["
1295 << global_size.x() * global_size.y() * global_size.z() << "];" NL " vec4 data2["
1302 "vec4(vec3(gl_GlobalInvocationID) / vec3(kGlobalSize), 1.0));" NL
1332 std::vector<vec4> buffer_data(kBufferSize * 4);
1336 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4) * kBufferSize * 4, &buffer_data[0], GL_DYNAMIC_DRAW);
1339 std::vector<vec4> texture_data(kBufferSize, vec4(123.0f));
1376 vec4* data;
1380 data = static_cast<vec4*>(
1381 glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4) * 3 * kBufferSize, GL_MAP_READ_BIT));
1385 if (!IsEqual(data[index], vec4(123.0f)))
1553 std::vector<vec4> display(kWidth * kHeight);
1561 vec4(static_cast<GLfloat>(colorData[i] / 255.), static_cast<GLfloat>(colorData[i + 1] / 255.),
1567 vec4 kColorEps = g_color_eps;
1577 const vec4 c = vec4(float(y + x) / 255.0f, 1.0f, 1.0f, 1.0f);
1604 " gl_Position = vec4(g_quad[gl_VertexID], 0, 1);" NL "}";
1607 NL "layout(location = 0) out mediump vec4 o_color;" NL "uniform mediump usampler2D g_image1;" NL
1611 " if (c1 == c2) o_color = vec4(float(c1.x)/255.0, 1.0, 1.0, 1.0);" NL
1612 " else o_color = vec4(1, 0, 0, 1);" NL "}";
1864 "uniform vec2 g_1;" NL "uniform vec3 g_2;" NL "uniform vec4 g_3;" NL "uniform mat2 g_4;" NL
1871 " if (g_3 != vec4(7.0, 8.0, 9.0, 10.0)) g_result = 0;" NL NL
2455 "#version 310 es" NL "layout(binding = 0, std430) buffer Output {" NL " vec4 g_output;" NL "};" NL
2456 "vec4 CalculateOutput();" NL "void Run() {" NL " g_output = CalculateOutput();" NL "}";
2460 " vec4 g_output;" NL "};" NL "vec4 CalculateOutput() {" NL " g_output = vec4(0);" NL
2461 " return vec4(1, 2, 3, 4);" NL "}";
2550 NL "layout(binding = 0, std430) buffer Output {" NL " vec4 g_output;" NL "};" NL
2551 "vec4 CalculateOutput();" NL "void Run() {" NL " g_output = CalculateOutput();" NL "}",
2553 NL "vec4 CalculateOutput() {" NL " g_output = vec4(0);" NL " return vec4(1, 2, 3, 4);" NL "}"
2562 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4), &vec4(0.0f)[0], GL_DYNAMIC_DRAW);
2568 vec4* data;
2571 data = static_cast<vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4), GL_MAP_READ_BIT));
2572 if (!IsEqual(data[0], vec4(1.0f, 2.0f, 3.0f, 4.0f)))
2580 glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4), &vec4(0.0f)[0]);
2591 data = static_cast<vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4), GL_MAP_READ_BIT));
2593 if (!IsEqual(data[0], vec4(1.0f, 2.0f, 3.0f, 4.0f)))
2769 std::vector<vec4> data(kBufferSize);
2773 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4) * kBufferSize, &data[0], GL_DYNAMIC_DRAW);
2793 vec4* result;
2794 result = static_cast<vec4*>(
2795 glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4) * kBufferSize, GL_MAP_READ_BIT));
2799 if (!IsEqual(result[i], vec4(static_cast<float>(i))))
2822 "layout(local_size_x = 128) in;" NL "layout(std430) buffer Output {" NL " vec4 g_output[256];" NL "};" NL
2827 " g_output[0] = vec4(g_shared_buf[1]);" NL " g_output[128] = vec4(g_shared_buf[0]);" NL
2833 " g_output[index] = vec4(g_shared_data[index].index);" // load data from shared memory
2834 NL " g_output[index + 128u] = vec4(g_shared_data[index + 128u].index);" NL
3091 "layout(local_size_x = 4) in;" NL "layout(std430) buffer Output {" NL " vec4 g_output[4];" NL "};" NL
3093 " g_output[gl_GlobalInvocationID.x] = vec4(quad[gl_GlobalInvocationID.x], 0, 1);" NL "}";
3101 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
3106 const char* const glsl_fs = NL "layout(location = 0) out mediump vec4 o_color;" NL "void main() {" NL
3107 " o_color = vec4(0, 1, 0, 1);" NL "}";
3119 glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(vec4) * 4, NULL, GL_DYNAMIC_DRAW);
3139 if (!ValidateReadBuffer(0, 0, getWindowWidth(), getWindowHeight(), vec4(0, 1, 0, 1)))
3210 " gl_Position = vec4(g_input[gl_VertexID], 0.0, 1.0);" NL " color = vec3(0.0, 1.0, 0.0);" NL "}";
3212 "#version 310 es" NL "flat in mediump vec3 color;" NL "layout(location = 0) out mediump vec4 g_color;" NL
3213 "void main() {" NL " g_color = vec4(color, 1.0);" NL "}";
3878 " vec4 pixel = imageLoad(g_input_image, pixel_xy);" NL
3967 const char* const glsl_cs = NL "layout(local_size_x = 4) in;" NL "struct Vertex {" NL " vec4 position;" NL
3968 " vec4 color;" NL "};" NL "layout(binding = 0, std430) buffer VertexBuffer {" NL
3971 " g_vertex[gl_GlobalInvocationID.x].color *= vec4(0.0, 1.0, 0.0, 1.0);" NL "}";
3981 NL "layout(location = 0) in mediump vec4 g_position;" NL "layout(location = 1) in mediump vec4 g_color;" NL
3982 "flat out mediump vec4 color;" NL "void main() {" NL " gl_Position = g_position;" NL
3985 NL "flat in mediump vec4 color;" NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL
4005 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(vec4), 0);
4006 glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(vec4), reinterpret_cast<void*>(sizeof(vec4)));
4114 NL "layout(location = 0) in mediump vec4 g_position;" NL "layout(location = 1) in mediump vec3 g_color;" NL
4120 NL "flat in mediump vec3 color;" NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL
4121 " g_color = vec4(color, 1.0);" NL "}";
4279 "uniform int g_add_value;" NL "uniform uint g_counter_y;" NL "uniform vec4 g_image_value;" NL
4500 std::vector<vec4> data(4 * 4);
4510 vec4(static_cast<GLfloat>(colorData[i] / 255.), static_cast<GLfloat>(colorData[i + 1] / 255.),
4513 vec4 epsilon = vec4(1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f); // texture format is RGBA8.
4516 if (!ColorEqual(data[i], vec4(0.25f, 0.5f, 0.75f, 1.0f), epsilon))
4588 "3.0));" NL "void main() {" NL " gl_Position = vec4(g_vertex[gl_VertexID], 0.0, 1.0);" NL "}";
4589 const char* const glsl_fs = NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL
4590 " g_color = vec4(1.0, 0.0, 0.0, 1.0);" NL "}";
4605 " imageStore(g_output_image, pixel_xy + ivec2(x, y), vec4(0, 1, 0, 1));" NL " }" NL
4618 "layout(local_size_x = TILE_WIDTH, local_size_y=TILE_HEIGHT) in;" NL NL "vec4 Process(vec4 ic) {" NL
4619 " return ic + vec4(1.0, 0.0, 0.0, 0.0);" NL "}" NL "void main() {" NL
4622 " vec4 ic = imageLoad(g_input_image, pixel_xy);" NL
4674 std::vector<vec4> data(128 * 128);
4685 vec4(static_cast<GLfloat>(colorData[i] / 255.), static_cast<GLfloat>(colorData[i + 1] / 255.),
4690 if (!IsEqual(data[i], vec4(1, 1, 0, 1)))
4766 NL "layout(location = 0) in mediump vec4 g_position;" NL "layout(location = 1) in mediump vec4 g_color;" NL
4767 "struct Vertex {" NL " mediump vec4 position;" NL " mediump vec4 color;" NL "};" NL
4768 "flat out mediump vec4 color;" NL "layout(binding = 0) buffer StageData {" NL " Vertex vertex[];" NL
4773 NL "flat mediump in vec4 color;" NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL
4786 NL "layout(local_size_x = 3) in;" NL "struct Vertex {" NL " vec4 position;" NL " vec4 color;" NL "};" NL
4788 "uniform vec4 g_color1;" NL "uniform int g_two;" NL "void UpdateVertex2(int i) {" NL
4789 " g_vertex[i].color -= vec4(-1, 1, 0, 0);" NL "}" NL "void main() {" NL
4791 " case 0u: g_vertex[gl_GlobalInvocationID.x].color += vec4(1, 0, 0, 0); break;" NL
4805 glBufferData(GL_SHADER_STORAGE_BUFFER, 3 * sizeof(vec4) * 2, NULL, GL_STATIC_COPY);
4809 glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 3 * sizeof(vec4) * 2, NULL, GL_STREAM_COPY);
4820 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(vec4), 0);
4821 glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(vec4), reinterpret_cast<void*>(sizeof(vec4)));
4876 if (!ValidateReadBuffer(0, 0, getWindowWidth(), getWindowHeight(), vec4(0, 1, 0, 1)))
4933 "layout (local_size_x = 4,local_size_y=4 ) in;" NL "shared vec4 g_shared1[4];" NL
4948 " vec4 result = vec4(0.0, 1.0, 0.0, 1.0);" NL NL
4950 " if (!CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 1.0)) result = vec4(1.0, 0.0, 0.0, "
4952 " if (!CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * -1.0)) result = vec4(1.0, 0.0, 0.0, "
4955 " if (!CheckMemory(thread_xy, g_values[gl_LocalInvocationIndex] * 7.0)) result = vec4(1.0, 0.0, 0.0, "
4983 std::vector<vec4> data(4 * 4);
4994 vec4(static_cast<GLfloat>(colorData[i] / 255.), static_cast<GLfloat>(colorData[i + 1] / 255.),
4999 if (!IsEqual(data[i], vec4(0, 1, 0, 1)))
5052 "shared struct Type { vec4 v[16]; } g_shared[64];" // 16384 bytes of shared memory
5055 " g_shared[id].v = vec4[16](vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), "
5056 "vec4(1.0)," NL " vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0), "
5057 "vec4(1.0), vec4(1.0), vec4(1.0));" NL " memoryBarrierShared();" NL " barrier();" NL NL
5058 " vec4 sum = vec4(0.0);" NL " int sum_count = 0;" NL " for (int i = id - 6; i < id + 9; ++i) {" NL
5068 " sum = abs((sum / float(sum_count)) - vec4(1.0));" NL
5079 std::vector<vec4> data(1024);
5082 glBufferData(GL_SHADER_STORAGE_BUFFER, (GLsizeiptr)(sizeof(vec4) * data.size()), &data[0][0],
5093 vec4* data;
5095 static_cast<vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(vec4) * 1024, GL_MAP_READ_BIT));
5098 if (!IsEqual(data[i], vec4(1.0f)))
5420 const char* const glsl_vs = NL "layout(location = 0) in mediump vec4 g_position;" NL "void main() {" NL
5423 NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL " g_color = vec4(1);" NL "}";
5705 const char* const glsl_vs = NL "layout(location = 0) in mediump vec4 g_position;" NL "void main() {" NL
5708 NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL " g_color = vec4(1);" NL "}";
5902 NL "layout(local_size_x = 1, local_size_y = 1) in;" NL "layout(std430) buffer Output {" NL " vec4 data;" NL
5903 "} g_out;" NL "void main() {" NL " g_out.data = vec4(1.0, 2.0, 3.0, 4.0);" NL "}";
5904 const char* const glsl_vs = NL "layout(location = 0) in mediump vec4 g_position;" NL "void main() {" NL
5907 NL "layout(location = 0) out mediump vec4 g_color;" NL "void main() {" NL " g_color = vec4(1);" NL "}";
5933 const char* const glsl_cs2 = NL "layout(std430) buffer Output {" NL " vec4 data;" NL "} g_out;" NL
5934 "void main() {" NL " g_out.data = vec4(1.0, 2.0, 3.0, 4.0);" NL "}";