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"
35 void r300_init_screen_texture_functions(struct pipe_screen
* screen
);
37 unsigned r300_texture_get_stride(struct r300_texture
* tex
, unsigned level
);
39 /* Note the signature of R300_EASY_TX_FORMAT(A, R, G, B, FORMAT)... */
40 static INLINE
uint32_t r300_translate_texformat(enum pipe_format format
)
44 case PIPE_FORMAT_I8_UNORM
:
45 return R300_EASY_TX_FORMAT(X
, X
, X
, X
, X8
);
47 case PIPE_FORMAT_A8R8G8B8_UNORM
:
48 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, W8Z8Y8X8
);
49 case PIPE_FORMAT_R8G8B8A8_UNORM
:
50 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, W8Z8Y8X8
);
51 case PIPE_FORMAT_A8R8G8B8_SRGB
:
52 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, W8Z8Y8X8
) |
54 case PIPE_FORMAT_R8G8B8A8_SRGB
:
55 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, W8Z8Y8X8
) |
58 case PIPE_FORMAT_DXT1_RGB
:
59 return R300_EASY_TX_FORMAT(X
, Y
, Z
, ONE
, DXT1
);
60 case PIPE_FORMAT_DXT1_RGBA
:
61 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, DXT1
);
63 case PIPE_FORMAT_DXT3_RGBA
:
64 return R300_EASY_TX_FORMAT(X
, Y
, Z
, W
, DXT3
);
66 case PIPE_FORMAT_DXT5_RGBA
:
67 return R300_EASY_TX_FORMAT(Y
, Z
, W
, X
, DXT5
);
69 case PIPE_FORMAT_YCBCR
:
70 return R300_EASY_TX_FORMAT(X
, Y
, Z
, ONE
, YVYU422
) |
71 R300_TX_FORMAT_YUV_TO_RGB
;
73 case PIPE_FORMAT_Z24S8_UNORM
:
74 return R300_EASY_TX_FORMAT(X
, X
, X
, X
, W24_FP
);
76 case PIPE_FORMAT_R16_SNORM
:
77 return R300_EASY_TX_FORMAT(X
, X
, X
, X
, Z5Y6X5
);
79 debug_printf("r300: Implementation error: "
80 "Got unsupported texture format %s in %s\n",
81 pf_name(format
), __FUNCTION__
);
90 boolean
r300_get_texture_buffer(struct pipe_texture
* texture
,
91 struct pipe_buffer
** buffer
,
94 #endif /* R300_WINSYS_H */
96 #endif /* R300_TEXTURE_H */