Files
2nd/10_Wiki/Topics/Domain_Programming/DevOps_and_Security/Data Array Textures.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

4.8 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-data-array-textures Data Array Textures 10_Wiki/Topics verified self
Texture Array
GL_TEXTURE_2D_ARRAY
WebGL2 Array Texture
none A 0.9 applied
webgl
gpu
texture
graphics
rendering
2026-05-10 pending
language framework
glsl webgl2

Data Array Textures

매 한 줄

"매 N 장 의 동일 size texture 의 single bind". 매 GL_TEXTURE_2D_ARRAY 의 atlas 의 alternative 의 sub-texel bleed 의 X 의 mipmap-safe 의 layered access 의 enable. 매 2026 년 의 WebGPU 의 default storage 의 voxel terrain, sprite atlas, lookup table 의 standard.

매 핵심

매 vs Atlas

  • Atlas: 매 single 2D texture 의 grid. 매 mipmap 의 bleed problem.
  • Array texture: 매 layer 의 independent. 매 mipmap-safe. 매 single bind 의 N draw call 의 1 draw call 의 reduction.

매 제약

  • 매 모든 layer 의 same size + same format.
  • 매 max_array_layers (보통 2048) 의 hardware limit.
  • 매 sampler 의 layer index 의 third coord (z) 로 access.

매 응용

  1. Voxel/Minecraft-like terrain (block type → layer index).
  2. Sprite animation (frame → layer).
  3. LUT (lookup table) batch.
  4. Instanced material variation.
  5. ML inference의 batched feature map.

💻 패턴

WebGL2 array texture upload

const gl = canvas.getContext('webgl2');
const tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D_ARRAY, tex);

const W = 64, H = 64, LAYERS = 16;
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, W, H, LAYERS);

for (let i = 0; i < LAYERS; i++) {
  const pixels = loadLayer(i); // Uint8Array(W*H*4)
  gl.texSubImage3D(
    gl.TEXTURE_2D_ARRAY, 0,
    0, 0, i,         // x, y, layer offset
    W, H, 1,
    gl.RGBA, gl.UNSIGNED_BYTE, pixels
  );
}
gl.texParameteri(gl.TEXTURE_2D_ARRAY, gl.TEXTURE_MIN_FILTER, gl.LINEAR);

GLSL 300 es sampling

#version 300 es
precision highp float;
precision highp sampler2DArray;

uniform sampler2DArray uBlocks;
in vec2 vUV;
flat in int vBlockType;
out vec4 fragColor;

void main() {
  fragColor = texture(uBlocks, vec3(vUV, float(vBlockType)));
}

WebGPU equivalent

const tex = device.createTexture({
  size: [W, H, LAYERS],
  format: 'rgba8unorm',
  usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST,
  dimension: '2d', // array via depthOrArrayLayers
});

device.queue.writeTexture(
  { texture: tex, origin: [0, 0, layer] },
  pixels,
  { bytesPerRow: W * 4 },
  { width: W, height: H, depthOrArrayLayers: 1 }
);

WGSL sampling

@group(0) @binding(0) var blocks: texture_2d_array<f32>;
@group(0) @binding(1) var samp: sampler;

@fragment
fn fs_main(@location(0) uv: vec2f, @location(1) @interpolate(flat) layer: u32) -> @location(0) vec4f {
  return textureSample(blocks, samp, uv, layer);
}

Three.js DataArrayTexture

import { DataArrayTexture, RGBAFormat, UnsignedByteType } from 'three';

const data = new Uint8Array(W * H * LAYERS * 4);
// fill data...
const tex = new DataArrayTexture(data, W, H, LAYERS);
tex.format = RGBAFormat;
tex.type = UnsignedByteType;
tex.needsUpdate = true;
material.uniforms.uBlocks.value = tex;

Mipmap generation

gl.bindTexture(gl.TEXTURE_2D_ARRAY, tex);
gl.generateMipmap(gl.TEXTURE_2D_ARRAY);
// → each layer mipmapped independently → no atlas-style bleed

매 결정 기준

상황 Approach
< 16 unique textures, dynamic Texture atlas (simple, cached)
Many same-size layers, mipmap critical Array texture
Different sizes / formats Bindless / texture array of handles (WebGPU)
Voxel terrain Array texture (layer = block type)
Cubemap variant TextureCubeArray

기본값: 매 same-size + N > 8 → array texture.

🔗 Graph

🤖 LLM 활용

언제: 매 shader code generation 의 boilerplate 의 GLSL/WGSL 의 sample. 매 LLM 의 layer index 의 binding 의 OK. 언제 X: 매 driver-specific 의 size limit 의 query 는 runtime 의 getParameter. 매 LLM 의 hardcode 의 X.

안티패턴

  • Mixed sizes의 attempt: 매 array texture 의 disqualify. 매 atlas 또는 bindless.
  • Layer count 의 over 2048: 매 split 의 multi-array-texture 또는 bindless.
  • Mipmap 의 atlas로: 매 bleed 의 inevitable. 매 array texture 의 fix.

🧪 검증 / 중복

  • Verified (Khronos WebGL2 spec, WebGPU spec, Three.js docs).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — array texture / WebGL2 + WebGPU usage