Created
June 29, 2023 19:58
-
-
Save Forenard/535fa46e3d95f8b6949095aaf62de2d8 to your computer and use it in GitHub Desktop.
Blitでuint4をそのままコピーするシェーダー
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Unlit/Uint4Copy" | |
{ | |
Properties | |
{ | |
[NoScaleOffset] _MainTex ("Texture", 2D) = "white" { } | |
} | |
SubShader | |
{ | |
Tags { "RenderType" = "Opaque" } | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
struct appdata | |
{ | |
float4 vertex : POSITION; | |
float2 uv : TEXCOORD0; | |
}; | |
struct v2f | |
{ | |
float2 uv : TEXCOORD0; | |
float4 vertex : SV_POSITION; | |
}; | |
Texture2D<uint4> _MainTex; | |
v2f vert(appdata v) | |
{ | |
v2f o; | |
o.vertex = UnityObjectToClipPos(v.vertex); | |
o.uv = v.uv; | |
return o; | |
} | |
uint4 frag(v2f i) : SV_Target | |
{ | |
int2 size; | |
_MainTex.GetDimensions(size.x, size.y); | |
return _MainTex[int2(i.uv * float2(size))]; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment