2 * Copyright (C) 2008-2009 Advanced Micro Devices, Inc.
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * Richard Li <RichardZ.Li@amd.com>, <richardradeon@gmail.com>
29 #include "main/glheader.h"
30 #include "main/imports.h"
32 #include "shader/program.h"
35 #include "r600_context.h"
37 #include "r700_chip.h"
38 #include "r700_oglprog.h"
40 #if 0 /* to be enabled */
41 #include "r700_fragprog.h"
42 #include "r700_vertprog.h"
43 #endif /* to be enabled */
45 static struct gl_program
*r700NewProgram(GLcontext
* ctx
,
49 struct gl_program
*pProgram
= NULL
;
50 #if 0 /* to be enabled */
51 struct r700_vertex_program
*vp
;
52 struct r700_fragment_program
*fp
;
56 case GL_VERTEX_STATE_PROGRAM_NV
:
57 case GL_VERTEX_PROGRAM_ARB
:
58 vp
= CALLOC_STRUCT(r700_vertex_program
);
59 pProgram
= _mesa_init_vertex_program(ctx
,
63 vp
->translated
= GL_FALSE
;
64 vp
->loaded
= GL_FALSE
;
65 vp
->shadercode
.buf
= NULL
;
67 case GL_FRAGMENT_PROGRAM_NV
:
68 case GL_FRAGMENT_PROGRAM_ARB
:
69 fp
= CALLOC_STRUCT(r700_fragment_program
);
70 pProgram
= _mesa_init_fragment_program(ctx
,
74 fp
->translated
= GL_FALSE
;
75 fp
->loaded
= GL_FALSE
;
76 fp
->shadercode
.buf
= NULL
;
79 _mesa_problem(ctx
, "Bad target in r700NewProgram");
81 #endif /* to be enabled */
85 static void r700DeleteProgram(GLcontext
* ctx
, struct gl_program
*prog
)
87 #if 0 /* to be enabled */
88 struct r700_vertex_program
* vp
;
89 struct r700_fragment_program
* fp
;
90 context_t
*context
= R700_CONTEXT(ctx
);
94 case GL_VERTEX_STATE_PROGRAM_NV
:
95 case GL_VERTEX_PROGRAM_ARB
:
96 vp
= (struct r700_vertex_program
*)prog
;
97 /* Release DMA region */
98 (context
->chipobj
.FreeDmaRegion
)(context
, &(vp
->shadercode
));
100 Clean_Up_Assembler(&(vp
->r700AsmCode
));
101 Clean_Up_Shader(&(vp
->r700Shader
));
103 case GL_FRAGMENT_PROGRAM_NV
:
104 case GL_FRAGMENT_PROGRAM_ARB
:
105 fp
= (struct r700_fragment_program
*)prog
;
106 /* Release DMA region */
107 (context
->chipobj
.FreeDmaRegion
)(context
, &(fp
->shadercode
));
109 Clean_Up_Assembler(&(fp
->r700AsmCode
));
110 Clean_Up_Shader(&(fp
->r700Shader
));
113 _mesa_problem(ctx
, "Bad target in r700NewProgram");
116 _mesa_delete_program(ctx
, prog
);
117 #endif /* to be enabled */
121 r700ProgramStringNotify(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
126 static GLboolean
r700IsProgramNative(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
132 void r700InitShaderFuncs(struct dd_function_table
*functions
)
134 functions
->NewProgram
= r700NewProgram
;
135 functions
->DeleteProgram
= r700DeleteProgram
;
136 functions
->ProgramStringNotify
= r700ProgramStringNotify
;
137 functions
->IsProgramNative
= r700IsProgramNative
;