1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 uniform HIGHP_SAMPLER_FLOAT sampler2D sGpuBufferF;
6 uniform HIGHP_SAMPLER_FLOAT isampler2D sGpuBufferI;
8 ivec2 get_gpu_buffer_uv(HIGHP_FS_ADDRESS int address) {
9 return ivec2(uint(address) % WR_MAX_VERTEX_TEXTURE_WIDTH,
10 uint(address) / WR_MAX_VERTEX_TEXTURE_WIDTH);
13 vec4 fetch_from_gpu_buffer_1f(HIGHP_FS_ADDRESS int address) {
14 ivec2 uv = get_gpu_buffer_uv(address);
15 return texelFetch(sGpuBufferF, uv, 0);
18 vec4[2] fetch_from_gpu_buffer_2f(HIGHP_FS_ADDRESS int address) {
19 ivec2 uv = get_gpu_buffer_uv(address);
21 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(0, 0)),
22 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(1, 0))
26 vec4[3] fetch_from_gpu_buffer_3f(HIGHP_FS_ADDRESS int address) {
27 ivec2 uv = get_gpu_buffer_uv(address);
29 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(0, 0)),
30 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(1, 0)),
31 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(2, 0))
35 vec4[4] fetch_from_gpu_buffer_4f(HIGHP_FS_ADDRESS int address) {
36 ivec2 uv = get_gpu_buffer_uv(address);
38 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(0, 0)),
39 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(1, 0)),
40 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(2, 0)),
41 TEXEL_FETCH(sGpuBufferF, uv, 0, ivec2(3, 0))
45 ivec4 fetch_from_gpu_buffer_1i(HIGHP_FS_ADDRESS int address) {
46 ivec2 uv = get_gpu_buffer_uv(address);
47 return texelFetch(sGpuBufferI, uv, 0);