/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "u_format.h"
#include "u_format_s3tc.h"
#include "u_format_rgtc.h"
#include "u_format_latc.h"
#include "u_format_etc.h"
#include "pipe/p_compiler.h"
#include "u_math.h"
#include "u_half.h"
#include "u_format.h"
#include "u_format_other.h"
#include "util/format_srgb.h"
#include "u_format_yuv.h"
#include "u_format_zs.h"
union util_format_none {
uint8_t value;
struct {
uint8_t r;
} chan;
};
static inline void
util_format_none_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
float *dst = dst_row;
const uint8_t *src = src_row;
for(x = 0; x < width; x += 1) {
uint8_t value = *(const uint8_t *)src;
uint8_t r;
r = value;
dst[0] = (float)r; /* r */
dst[1] = 0; /* g */
dst[2] = 0; /* b */
dst[3] = 1; /* a */
src += 1;
dst += 4;
}
src_row += src_stride;
dst_row += dst_stride/sizeof(*dst_row);
}
}
static inline void
util_format_none_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
const float *src = src_row;
uint8_t *dst = dst_row;
for(x = 0; x < width; x += 1) {
uint8_t value = 0;
value |= (uint8_t)CLAMP(src[0], 0.0f, 255.0f);
*(uint8_t *)dst = value;
src += 4;
dst += 1;
}
dst_row += dst_stride;
src_row += src_stride/sizeof(*src_row);
}
}
static inline void
util_format_none_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
uint8_t value = *(const uint8_t *)src;
uint8_t r;
r = value;
dst[0] = (float)r; /* r */
dst[1] = 0; /* g */
dst[2] = 0; /* b */
dst[3] = 1; /* a */
}
static inline void
util_format_none_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
uint8_t *dst = dst_row;
const uint8_t *src = src_row;
for(x = 0; x < width; x += 1) {
uint8_t value = *(const uint8_t *)src;
uint8_t r;
r = value;
dst[0] = (uint8_t)(((uint32_t)MIN2(r, 1)) * 0xff / 0x1); /* r */
dst[1] = 0; /* g */
dst[2] = 0; /* b */
dst[3] = 255; /* a */
src += 1;
dst += 4;
}
src_row += src_stride;
dst_row += dst_stride/sizeof(*dst_row);
}
}
static inline void
util_format_none_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
const uint8_t *src = src_row;
uint8_t *dst = dst_row;
for(x = 0; x < width; x += 1) {
uint8_t value = 0;
value |= (uint8_t)(((uint32_t)src[0]) * 0x1 / 0xff);
*(uint8_t *)dst = value;
src += 4;
dst += 1;
}
dst_row += dst_stride;
src_row += src_stride/sizeof(*src_row);
}
}
union util_format_b8g8r8a8_unorm {
uint32_t value;
struct {
#ifdef PIPE_ARCH_BIG_ENDIAN
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
#else
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
#endif
} chan;
};
static inline void
util_format_b8g8r8a8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
float *dst = dst_row;
const uint8_t *src = src_row;
for(x = 0; x < width; x += 1) {
#ifdef PIPE_ARCH_BIG_ENDIAN
uint32_t value = *(const uint32_t *)src;
uint32_t b;
uint32_t g;
uint32_t r;
uint32_t a;
b = value >> 24;
g = (value >> 16) & 0xff;
r = (value >> 8) & 0xff;
a = (value) & 0xff;
dst[0] = ubyte_to_float(r); /* r */
dst[1] = ubyte_to_float(g); /* g */
dst[2] = ubyte_to_float(b); /* b */
dst[3] = ubyte_to_float(a); /* a */
#else
uint32_t value = *(const uint32_t *)src;
uint32_t b;
uint32_t g;
uint32_t r;
uint32_t a;
b = (value) & 0xff;
g = (value >> 8) & 0xff;
r = (value >> 16) & 0xff;
a = value >> 24;
dst[0] = ubyte_to_float(r); /* r */
dst[1] = ubyte_to_float(g); /* g */
dst[2] = ubyte_to_float(b); /* b */
dst[3] = ubyte_to_float(a); /* a */
#endif
src += 4;
dst += 4;
}
src_row += src_stride;
dst_row += dst_stride/sizeof(*dst_row);
}
}
static inline void
util_format_b8g8r8a8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
{
unsigned x, y;
for(y = 0; y < height; y += 1) {
const float *src = src_row;
uint8_t *dst = dst_row;
for(x = 0; x < width; x += 1) {
#ifdef PIPE_ARCH_BIG_ENDIAN
uint32_t value = 0;
value |= (float_to_ubyte(src[2])) << 24;
value |= ((float_to_ubyte(src[1])) & 0xff) << 16;
value |= ((float_to_ubyte(src[0])) & 0xff) << 8;
value |= (float_to_ubyte(src[3])) & 0xff;
*(uint32_t *)dst = value;
#else
uint32_t value = 0;
value |= (float_to_ubyte(src[2])) & 0xff;
value |= ((float_to_ubyte(src[1])) & 0xff) << 8;
value |= ((float_to_ubyte(src[0])) & 0xff) << 16;
value |= (float_to_ubyte(src[3])) << 24;
*(uint32_t *)dst = value;
#endif
src += 4;
dst += 4;
}
dst_row += dst_stride;
src_row += src_stride/sizeof(*src_row);
}
}
static inline void
util_format_b8g8r8a8_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
{
#ifdef PIPE_ARCH_BIG_ENDIAN
uint32_t value = *(const uint32_t *)src;
uint32_t b;
uint32_t g;
uint32_t r;
uint32_t a;
b = value >> 24;
g = (value >> 16) & 0xff;
r = (value >> 8) & 0xff;
a = (value) & 0xff;
dst[0] = ubyte_to_float(r); /* r */
dst[1] = ubyte_to_float(g); /* g */
dst[2] = ubyte_to_float(b); /* b */
dst[3] = ubyte_to_float(a); /* a */
#else
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
mesa-17.0.0.zip (2000个子文件)
u_format_table.c 1.48MB
enums.c 634KB
nir_opt_algebraic.c 559KB
u_indices_gen.c 527KB
indirect.c 397KB
dlist.c 292KB
si_shader.c 273KB
r600_shader.c 271KB
anv_entrypoints.c 228KB
format_pack.c 225KB
nir_constant_expressions.c 223KB
svga_tgsi_vgpu10.c 218KB
tgsi_exec.c 194KB
teximage.c 185KB
format_unpack.c 173KB
program_parse.tab.c 166KB
vk_format_table.c 162KB
glcpp-parse.c 148KB
lp_bld_sample_soa.c 147KB
ac_nir_to_llvm.c 145KB
device9.c 143KB
evergreen_state.c 139KB
fbobject.c 136KB
nine_state.c 136KB
lp_bld_tgsi_soa.c 135KB
si_state.c 133KB
bufferobj.c 128KB
brw_eu_emit.c 127KB
s_texfilter.c 123KB
isl_format_layout.c 122KB
meta.c 121KB
lp_state_fs.c 120KB
lp_bld_arit.c 118KB
nine_shader.c 118KB
sp_tex_sample.c 117KB
intel_mipmap_tree.c 113KB
svga_tgsi_insn.c 109KB
r600_state.c 107KB
lex.yy.c 106KB
nine_lock.c 105KB
vc4_program.c 103KB
spirv_to_nir.c 102KB
genX_cmd_buffer.c 101KB
glformats.c 99KB
nine_ff.c 97KB
radv_cmd_buffer.c 95KB
egl_dri2.c 94KB
draw_llvm.c 93KB
st_cb_texture.c 93KB
u_format_tests.c 92KB
blorp_blit.c 91KB
svga_dump.c 90KB
r600_state_common.c 89KB
lp_bld_tgsi_action.c 89KB
mipmap.c 86KB
u_blitter.c 86KB
etnaviv_compiler.c 84KB
ilo_state.c 84KB
nvc0_query_hw_sm.c 84KB
glcpp-lex.c 83KB
svga_format.c 83KB
si_state_shaders.c 81KB
shaderapi.c 81KB
get.c 81KB
lp_bld_sample.c 80KB
r600_texture.c 79KB
fakeglx.c 78KB
varray.c 77KB
r300_state.c 76KB
toy_tgsi.c 76KB
st_format.c 76KB
glxcmds.c 75KB
r200_state.c 74KB
eglapi.c 73KB
texparam.c 73KB
r600_asm.c 73KB
toy_compiler_disasm.c 71KB
glx_api.c 71KB
anv_device.c 70KB
api_exec.c 69KB
ir3_compiler_nir.c 68KB
attrib.c 68KB
radv_device.c 67KB
lp_bld_sample_aos.c 67KB
texobj.c 67KB
isl.c 67KB
brw_wm_surface_state.c 66KB
genX_pipeline.c 64KB
formats.c 64KB
radeon_state.c 64KB
st_program.c 63KB
tgsi_to_nir.c 63KB
tgsi_ureg.c 63KB
tgsi_lowering.c 62KB
dri2.c 62KB
compute.c 62KB
brw_context.c 61KB
si_descriptors.c 60KB
anv_blorp.c 59KB
vbo_exec_array.c 58KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
宛如一个zz蛤
- 粉丝: 5
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功