~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/frontends/wgl/stw_context.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <GL/gl.h>
35
35
#include <GL/wglext.h>
36
36
 
37
 
#include "pipe/p_compiler.h"
 
37
#include "util/compiler.h"
38
38
#include "pipe/p_context.h"
39
39
#include "pipe/p_state.h"
40
40
#include "util/compiler.h"
69
69
{
70
70
   struct stw_context *src;
71
71
   struct stw_context *dst;
72
 
   BOOL ret = FALSE;
 
72
   BOOL ret = false;
73
73
 
74
74
   if (!stw_dev)
75
 
      return FALSE;
 
75
      return false;
76
76
 
77
77
   stw_lock_contexts(stw_dev);
78
78
 
98
98
{
99
99
   struct stw_context *ctx1;
100
100
   struct stw_context *ctx2;
101
 
   BOOL ret = FALSE;
 
101
   BOOL ret = false;
102
102
 
103
103
   if (!stw_dev)
104
 
      return FALSE;
 
104
      return false;
105
105
 
106
106
   stw_lock_contexts(stw_dev);
107
107
 
110
110
 
111
111
   if (ctx1 && ctx2) {
112
112
      ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx);
113
 
      ctx1->shared = TRUE;
114
 
      ctx2->shared = TRUE;
 
113
      ctx1->shared = true;
 
114
      ctx2->shared = true;
115
115
   }
116
116
 
117
117
   stw_unlock_contexts(stw_dev);
173
173
      return 0;
174
174
 
175
175
   if (shareCtx != NULL)
176
 
      shareCtx->shared = TRUE;
 
176
      shareCtx->shared = true;
177
177
 
178
178
   ctx = CALLOC_STRUCT( stw_context );
179
179
   if (ctx == NULL)
312
312
DrvDeleteContext(DHGLRC dhglrc)
313
313
{
314
314
   struct stw_context *ctx ;
315
 
   BOOL ret = FALSE;
 
315
   BOOL ret = false;
316
316
 
317
317
   if (!stw_dev)
318
 
      return FALSE;
 
318
      return false;
319
319
 
320
320
   stw_lock_contexts(stw_dev);
321
321
   ctx = stw_lookup_context_locked(dhglrc);
330
330
         st_api_make_current(NULL, NULL, NULL);
331
331
 
332
332
      stw_destroy_context(ctx);
333
 
      ret = TRUE;
 
333
      ret = true;
334
334
   }
335
335
 
336
336
   return ret;
340
340
stw_unbind_context(struct stw_context *ctx)
341
341
{
342
342
   if (!ctx)
343
 
      return FALSE;
 
343
      return false;
344
344
 
345
345
   /* The expectation is that ctx is the same context which is
346
346
    * current for this thread.  We should check that and return False
347
347
    * if not the case.
348
348
    */
349
349
   if (ctx != stw_current_context())
350
 
      return FALSE;
351
 
 
352
 
   if (stw_make_current( NULL, NULL, NULL ) == FALSE)
353
 
      return FALSE;
354
 
 
355
 
   return TRUE;
 
350
      return false;
 
351
 
 
352
   if (stw_make_current( NULL, NULL, NULL ) == false)
 
353
      return false;
 
354
 
 
355
   return true;
356
356
}
357
357
 
358
358
BOOL APIENTRY
361
361
   struct stw_context *ctx;
362
362
 
363
363
   if (!stw_dev)
364
 
      return FALSE;
 
364
      return false;
365
365
 
366
366
   stw_lock_contexts(stw_dev);
367
367
   ctx = stw_lookup_context_locked( dhglrc );
430
430
stw_make_current(struct stw_framebuffer *fb, struct stw_framebuffer *fbRead, struct stw_context *ctx)
431
431
{
432
432
   struct stw_context *old_ctx = NULL;
433
 
   BOOL ret = FALSE;
 
433
   BOOL ret = false;
434
434
 
435
435
   if (!stw_dev)
436
 
      return FALSE;
 
436
      return false;
437
437
 
438
438
   old_ctx = stw_current_context();
439
439
   if (old_ctx != NULL) {
440
440
      if (old_ctx == ctx) {
441
441
         if (old_ctx->current_framebuffer == fb && old_ctx->current_read_framebuffer == fbRead) {
442
442
            /* Return if already current. */
443
 
            return TRUE;
 
443
            return true;
444
444
         }
445
445
      } else {
446
446
         if (old_ctx->shared) {
559
559
   struct stw_context *ctx = stw_lookup_context(dhglrc);
560
560
   if (dhglrc && !ctx) {
561
561
      stw_make_current_by_handles(NULL, NULL, 0);
562
 
      return FALSE;
 
562
      return false;
563
563
   }
564
564
 
565
565
   struct stw_framebuffer *fb = get_unlocked_refd_framebuffer_from_dc(hDrawDC);
566
566
   if (ctx && !fb) {
567
567
      stw_make_current_by_handles(NULL, NULL, 0);
568
 
      return FALSE;
 
568
      return false;
569
569
   }
570
570
 
571
571
   struct stw_framebuffer *fbRead = (hDrawDC == hReadDC || hReadDC == NULL) ?
573
573
   if (ctx && !fbRead) {
574
574
      release_old_framebuffers(fb, NULL, ctx);
575
575
      stw_make_current_by_handles(NULL, NULL, 0);
576
 
      return FALSE;
 
576
      return false;
577
577
   }
578
578
 
579
579
   BOOL success = stw_make_current(fb, fbRead, ctx);