2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23 #ifndef R300_TEXTURE_H
24 #define R300_TEXTURE_H
26 #include "pipe/p_screen.h"
28 #include "util/u_math.h"
30 #include "r300_context.h"
33 void r300_init_screen_texture_functions(struct pipe_screen
* screen
);
35 /* Note the signature of R300_EASY_TX_FORMAT(A, R, G, B, FORMAT)... */
36 static INLINE
uint32_t r300_translate_texformat(enum pipe_format format
)
40 case PIPE_FORMAT_I8_UNORM
:
41 return R300_EASY_TX_FORMAT(X
, X
, X
, X
, X8
);
43 case PIPE_FORMAT_A8R8G8B8_UNORM
:
44 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, W8Z8Y8X8
);
45 case PIPE_FORMAT_R8G8B8A8_UNORM
:
46 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, W8Z8Y8X8
);
47 case PIPE_FORMAT_A8R8G8B8_SRGB
:
48 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, W8Z8Y8X8
) |
50 case PIPE_FORMAT_R8G8B8A8_SRGB
:
51 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, W8Z8Y8X8
) |
54 case PIPE_FORMAT_DXT1_RGB
:
55 return R300_EASY_TX_FORMAT(X
, Y
, Z
, ONE
, DXT1
);
56 case PIPE_FORMAT_DXT1_RGBA
:
57 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, DXT1
);
59 case PIPE_FORMAT_DXT3_RGBA
:
60 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, DXT3
);
62 case PIPE_FORMAT_DXT5_RGBA
:
63 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, DXT5
);
65 case PIPE_FORMAT_YCBCR
:
66 return R300_EASY_TX_FORMAT(X
, Y
, Z
, ONE
, YVYU422
) |
67 R300_TX_FORMAT_YUV_TO_RGB
;
69 case PIPE_FORMAT_Z24S8_UNORM
:
70 return R300_EASY_TX_FORMAT(X
, X
, X
, X
, W24_FP
);
72 debug_printf("r300: Implementation error: "
73 "Got unsupported texture format %s in %s\n",
74 pf_name(format
), __FUNCTION__
);
83 boolean
r300_get_texture_buffer(struct pipe_texture
* texture
,
84 struct pipe_buffer
** buffer
,
87 #endif /* R300_WINSYS_H */
89 #endif /* R300_TEXTURE_H */